Projects
Threads by month
- ----- 2025 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
November 2005
- 6 participants
- 85 discussions
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Desprès <nicolas.despres(a)lrde.epita.fr>
Move ranch-cxx into src.
* lib/cxx/src: New.
* lib/cxx/ranch-cxx/inputs.hh:,
* lib/cxx/ranch-cxx/outputs.hh:,
* lib/cxx/ranch-cxx/inputs.hxx:,
* lib/cxx/ranch-cxx/ranch.hh:,
* lib/cxx/ranch-cxx/outputs.hxx:,
* lib/cxx/ranch-cxx/bencher.cc:,
* lib/cxx/ranch-cxx/misc:,
* lib/cxx/ranch-cxx/misc/yamlize.hxx:,
* lib/cxx/ranch-cxx/misc/yamlize.hh:,
* lib/cxx/ranch-cxx/misc/Makefile.am:,
* lib/cxx/ranch-cxx/misc/yamlize.cc:,
* lib/cxx/ranch-cxx/dumper:,
* lib/cxx/ranch-cxx/dumper/dumper.cc:,
* lib/cxx/ranch-cxx/dumper/yaml.hh:,
* lib/cxx/ranch-cxx/dumper/libdumper.hh:,
* lib/cxx/ranch-cxx/dumper/yaml.cc:,
* lib/cxx/ranch-cxx/dumper/all.hh:,
* lib/cxx/ranch-cxx/dumper/libdumper.cc:,
* lib/cxx/ranch-cxx/dumper/Makefile.am:,
* lib/cxx/ranch-cxx/dumper/dumper.hh:,
* lib/cxx/ranch-cxx/dumper/fwd.hh:,
* lib/cxx/ranch-cxx/input:,
* lib/cxx/ranch-cxx/input/input.cc:,
* lib/cxx/ranch-cxx/input/input.hxx:,
* lib/cxx/ranch-cxx/input/Makefile.am:,
* lib/cxx/ranch-cxx/input/input.hh:,
* lib/cxx/ranch-cxx/output:,
* lib/cxx/ranch-cxx/output/output.cc:,
* lib/cxx/ranch-cxx/output/u-time.cc:,
* lib/cxx/ranch-cxx/output/output.hxx:,
* lib/cxx/ranch-cxx/output/all.hh:,
* lib/cxx/ranch-cxx/output/u-time.hxx:,
* lib/cxx/ranch-cxx/output/Makefile.am:,
* lib/cxx/ranch-cxx/output/output.hh:,
* lib/cxx/ranch-cxx/output/u-time.hh:,
* lib/cxx/ranch-cxx/ranch.mk:,
* lib/cxx/ranch-cxx/bencher.hh:,
* lib/cxx/ranch-cxx/io.hh:,
* lib/cxx/ranch-cxx/Makefile.am:,
* lib/cxx/ranch-cxx/bencher.hxx:,
* lib/cxx/ranch-cxx/io.hxx:,
* lib/cxx/ranch-cxx: Move to ...
* lib/cxx/src/ranch-cxx: ... here.
Makefile.am | 32 ----------------
bencher.cc | 103 ----------------------------------------------------
bencher.hh | 66 ---------------------------------
bencher.hxx | 45 ----------------------
dumper/Makefile.am | 19 ---------
dumper/all.hh | 8 ----
dumper/dumper.cc | 14 -------
dumper/dumper.hh | 31 ---------------
dumper/fwd.hh | 16 --------
dumper/libdumper.cc | 16 --------
dumper/libdumper.hh | 16 --------
dumper/yaml.cc | 94 -----------------------------------------------
dumper/yaml.hh | 34 -----------------
input/Makefile.am | 11 -----
input/input.cc | 13 ------
input/input.hh | 29 --------------
input/input.hxx | 21 ----------
inputs.hh | 38 -------------------
inputs.hxx | 39 -------------------
io.hh | 37 ------------------
io.hxx | 50 -------------------------
misc/Makefile.am | 12 ------
misc/yamlize.cc | 26 -------------
misc/yamlize.hh | 32 ----------------
misc/yamlize.hxx | 21 ----------
output/Makefile.am | 20 ----------
output/all.hh | 8 ----
output/output.cc | 23 -----------
output/output.hh | 35 -----------------
output/output.hxx | 27 -------------
output/u-time.cc | 34 -----------------
output/u-time.hh | 34 -----------------
output/u-time.hxx | 20 ----------
outputs.hh | 37 ------------------
outputs.hxx | 38 -------------------
ranch.hh | 10 -----
ranch.mk | 2 -
37 files changed, 1111 deletions(-)
Index: lib/cxx/ranch-cxx/inputs.hh
--- lib/cxx/ranch-cxx/inputs.hh (revision 28)
+++ lib/cxx/ranch-cxx/inputs.hh (working copy)
@@ -1,38 +0,0 @@
-
-
-#ifndef RANCH_INPUTS_HH
-# define RANCH_INPUTS_HH
-
-# include <list>
-# include <input/input.hh>
-
-namespace Ranch
-{
- class Inputs
- {
- public:
- Inputs& add(Input::Input& input);
-
- typedef std::list<Input::Input*> list_type;
-
- typedef list_type::const_iterator const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- typedef list_type::iterator iterator;
-
- iterator begin();
- iterator end();
-
- protected:
-
- list_type list_;
- }; // class Inputs
-
-} // namespace Ranch
-
-# include <inputs.hxx>
-
-#endif // !RANCH_INPUTS_HH
-
Index: lib/cxx/ranch-cxx/outputs.hh
--- lib/cxx/ranch-cxx/outputs.hh (revision 28)
+++ lib/cxx/ranch-cxx/outputs.hh (working copy)
@@ -1,37 +0,0 @@
-
-
-#ifndef RANCH_OUTPUTS_HH
-# define RANCH_OUTPUTS_HH
-
-# include <list>
-# include <output/output.hh>
-
-namespace Ranch
-{
- class Outputs
- {
- public:
- Outputs& add(Output::Output& output);
-
- typedef std::list<Output::Output*> list_type;
-
- typedef list_type::const_iterator const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- typedef list_type::iterator iterator;
-
- iterator begin();
- iterator end();
-
- protected:
- list_type list_;
- }; // class Outputs
-
-} // namespace Ranch
-
-# include <outputs.hxx>
-
-#endif // !RANCH_OUTPUTS_HH
-
Index: lib/cxx/ranch-cxx/inputs.hxx
--- lib/cxx/ranch-cxx/inputs.hxx (revision 28)
+++ lib/cxx/ranch-cxx/inputs.hxx (working copy)
@@ -1,39 +0,0 @@
-
-#ifndef RANCH_INPUTS_HXX
-# define RANCH_INPUTS_HXX
-
-# include <inputs.hh>
-
-namespace Ranch
-{
-
- inline Inputs& Inputs::add(Input::Input& input)
- {
- list_.push_back(&input);
- return *this;
- }
-
- inline Inputs::const_iterator Inputs::begin() const
- {
- return list_.begin();
- }
-
- inline Inputs::const_iterator Inputs::end() const
- {
- return list_.end();
- }
-
- inline Inputs::iterator Inputs::begin()
- {
- return list_.begin();
- }
-
- inline Inputs::iterator Inputs::end()
- {
- return list_.end();
- }
-
-
-} // namespace Ranch
-
-#endif // !RANCH_INPUTS_HXX
Index: lib/cxx/ranch-cxx/ranch.hh
--- lib/cxx/ranch-cxx/ranch.hh (revision 28)
+++ lib/cxx/ranch-cxx/ranch.hh (working copy)
@@ -1,10 +0,0 @@
-
-#ifndef RANCH_HH
-# define RANCH_HH
-
-# include <bencher.hh>
-# include <input/input.hh>
-# include <output/all.hh>
-# include <dumper/all.hh>
-
-#endif // !RANCH_HH
Index: lib/cxx/ranch-cxx/outputs.hxx
--- lib/cxx/ranch-cxx/outputs.hxx (revision 28)
+++ lib/cxx/ranch-cxx/outputs.hxx (working copy)
@@ -1,38 +0,0 @@
-
-#ifndef RANCH_OUTPUTS_HXX
-# define RANCH_OUTPUTS_HXX
-
-# include <outputs.hh>
-
-namespace Ranch
-{
-
- inline Outputs& Outputs::add(Output::Output& output)
- {
- list_.push_back(&output);
- return *this;
- }
-
- inline Outputs::const_iterator Outputs::begin() const
- {
- return list_.begin();
- }
-
- inline Outputs::const_iterator Outputs::end() const
- {
- return list_.end();
- }
-
- inline Outputs::iterator Outputs::begin()
- {
- return list_.begin();
- }
-
- inline Outputs::iterator Outputs::end()
- {
- return list_.end();
- }
-
-} // namespace Ranch
-
-#endif // !RANCH_OUTPUTS_HXX
Index: lib/cxx/ranch-cxx/bencher.cc
--- lib/cxx/ranch-cxx/bencher.cc (revision 28)
+++ lib/cxx/ranch-cxx/bencher.cc (working copy)
@@ -1,103 +0,0 @@
-#include <bencher.hh>
-#include <cstdarg>
-#include <dumper/libdumper.hh>
-#include <dumper/dumper.hh>
-
-namespace Ranch
-{
-
- Dumper::Dumper* Bencher::dumper_ = Dumper::yaml_stdout();
-
- Dumper::Dumper& Bencher::dumper(Dumper::Dumper& dumper)
- {
- Dumper::Dumper* old_dumper = dumper_;
- dumper_ = &dumper;
- return *old_dumper;
- }
-
- Dumper::Dumper& Bencher::dumper()
- {
- return *dumper_;
- }
-
- Bencher::Bencher(const std::string& name,
- Inputs& inputs,
- Outputs& outputs,
- const std::string& comment) :
- name_(name),
- inputs_(inputs),
- outputs_(outputs),
- comment_(comment),
- first_start_call_(true)
- {
- }
-
- Bencher::Bencher(const std::string& name, const std::string& comment) :
- name_(name),
- inputs_(),
- outputs_(),
- comment_(comment),
- first_start_call_(true)
- {
- }
-
- Bencher::~Bencher()
- {
- dumper_->end_bench(*this);
- }
-
- void Bencher::start()
- {
- begin_bench_();
- dumper_->begin_score(*this);
- start_outputs_();
- }
-
- void Bencher::start(double size_input_1, ...)
- {
- va_list ap;
-
- begin_bench_();
- Inputs::iterator i = inputs_.begin();
- (*i)->value(size_input_1);
-
- va_start(ap, size_input_1);
- for (++i; i != inputs_.end(); ++i)
- (*i)->value(va_arg(ap, double));
- va_end(ap);
- dumper_->begin_score(*this);
- start_outputs_();
- }
-
- void Bencher::stop(double score_output_1, ...)
- {
- va_list ap;
-
- Outputs::iterator i = outputs_.begin();
- (*i)->value(score_output_1);
-
- va_start(ap, score_output_1);
- for (++i; i != outputs_.end(); ++i)
- (*i)->value(va_arg(ap, double));
- va_end(ap);
- dumper_->end_score(*this);
- }
-
- void Bencher::start_outputs_()
- {
- for (Outputs::iterator i = outputs_.begin();
- i != outputs_.end();
- ++i)
- (*i)->start();
- }
-
- void Bencher::begin_bench_()
- {
- if (first_start_call_)
- {
- first_start_call_ = false;
- dumper_->begin_bench(*this);
- }
- }
-
-} // namespace Ranch
Index: lib/cxx/ranch-cxx/misc/yamlize.hxx
--- lib/cxx/ranch-cxx/misc/yamlize.hxx (revision 28)
+++ lib/cxx/ranch-cxx/misc/yamlize.hxx (working copy)
@@ -1,21 +0,0 @@
-
-#ifndef RANCH_MISC_YAMLIZE_HXX
-# define RANCH_MISC_YAMLIZE_HXX
-
-# include <misc/yamlize.hh>
-
-namespace Ranch
-{
- namespace Misc
- {
-
- inline std::ostream& operator<< (std::ostream& ostr,
- const Yamlize& yamlize)
- {
- return yamlize.print(ostr);
- }
-
- } // namespace Misc
-} // namespace Ranch
-
-#endif // !RANCH_MISC_YAMLIZE_HXX
Index: lib/cxx/ranch-cxx/misc/yamlize.hh
--- lib/cxx/ranch-cxx/misc/yamlize.hh (revision 28)
+++ lib/cxx/ranch-cxx/misc/yamlize.hh (working copy)
@@ -1,32 +0,0 @@
-
-#ifndef RANCH_MISC_YAMLIZE_HH
-# define RANCH_MISC_YAMLIZE_HH
-
-# include <iosfwd>
-# include <string>
-
-namespace Ranch
-{
- namespace Misc
- {
-
- class Yamlize
- {
- public:
- Yamlize(const std::string& str);
-
- std::ostream& print(std::ostream& ostr) const;
-
- protected:
- std::string str_;
-
- }; // class Yamlize
-
- std::ostream& operator<< (std::ostream& ostr, const Yamlize& yamlize);
-
- } // namespace Misc
-} // namespace Ranch
-
-# include <misc/yamlize.hxx>
-
-#endif // !RANCH_MISC_YAMLIZE_HH
Index: lib/cxx/ranch-cxx/misc/Makefile.am
--- lib/cxx/ranch-cxx/misc/Makefile.am (revision 28)
+++ lib/cxx/ranch-cxx/misc/Makefile.am (working copy)
@@ -1,12 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = libmisc.la
-libmisc_la_SOURCES = \
- yamlize.hh \
- yamlize.cc \
- yamlize.hxx
-pkgincludedir = $(includedir)/$(PACKAGE)/misc
-pkginclude_HEADERS = \
- yamlize.hh \
- yamlize.hxx
-
Index: lib/cxx/ranch-cxx/misc/yamlize.cc
--- lib/cxx/ranch-cxx/misc/yamlize.cc (revision 28)
+++ lib/cxx/ranch-cxx/misc/yamlize.cc (working copy)
@@ -1,26 +0,0 @@
-#include "misc/yamlize.hh"
-#include <ostream>
-
-namespace Ranch
-{
- namespace Misc
- {
-
- Yamlize::Yamlize(const std::string& str) :
- str_(str)
- {
- }
-
- std::ostream& Yamlize::print(std::ostream& ostr) const
- {
- ostr << '\'';
- for (std::string::const_iterator i = str_.begin(); i != str_.end(); ++i)
- if (*i == '\'')
- ostr << "''";
- else
- ostr << *i;
- return ostr << '\'';
- }
-
- } // namespace Misc
-} // namespace Ranch
Index: lib/cxx/ranch-cxx/dumper/dumper.cc
--- lib/cxx/ranch-cxx/dumper/dumper.cc (revision 28)
+++ lib/cxx/ranch-cxx/dumper/dumper.cc (working copy)
@@ -1,14 +0,0 @@
-#include "dumper/dumper.hh"
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Dumper::Dumper(std::ostream& ostr) :
- ostr_(ostr)
- {
- }
-
- } // namespace Dumper
-} // namespace Ranch
Index: lib/cxx/ranch-cxx/dumper/yaml.hh
--- lib/cxx/ranch-cxx/dumper/yaml.hh (revision 28)
+++ lib/cxx/ranch-cxx/dumper/yaml.hh (working copy)
@@ -1,34 +0,0 @@
-
-#ifndef RANCH_YAML_HH
-# define RANCH_YAML_HH
-
-# include <dumper/dumper.hh>
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- class Yaml : public Dumper
- {
- public:
- Yaml(std::ostream& ostr);
-
- virtual void begin_bench(const Bencher& bencher);
- virtual void end_bench(const Bencher& bencher);
-
- virtual void begin_score(const Bencher& bencher);
- virtual void end_score(const Bencher& bencher);
-
- protected:
- void print_indent_();
-
- protected:
- unsigned int indent_;
- }; // class Yaml
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_YAML_HH
-
Index: lib/cxx/ranch-cxx/dumper/libdumper.hh
--- lib/cxx/ranch-cxx/dumper/libdumper.hh (revision 28)
+++ lib/cxx/ranch-cxx/dumper/libdumper.hh (working copy)
@@ -1,16 +0,0 @@
-#ifndef RANCH_LIBDUMPER_HH
-# define RANCH_LIBDUMPER_HH
-
-# include "dumper/fwd.hh"
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Dumper* yaml_stdout();
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_LIBDUMPER_HH
Index: lib/cxx/ranch-cxx/dumper/yaml.cc
--- lib/cxx/ranch-cxx/dumper/yaml.cc (revision 28)
+++ lib/cxx/ranch-cxx/dumper/yaml.cc (working copy)
@@ -1,94 +0,0 @@
-#include <dumper/yaml.hh>
-#include <misc/yamlize.hh>
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Yaml::Yaml(std::ostream& ostr) :
- Dumper(ostr),
- indent_(0)
- {
- }
-
- void Yaml::print_indent_()
- {
- for (unsigned int i = 0; i < indent_; ++i)
- ostr_ << " ";
- }
-
- void Yaml::begin_bench(const Bencher& bencher)
- {
- print_indent_();
- ostr_ << "- " << Misc::Yamlize(bencher.name()) << ':' << std::endl;
- print_indent_();
- ostr_ << " type:" << std::endl;
- print_indent_();
- ostr_ << " inputs:" << std::endl;
- for (Inputs::const_iterator i = bencher.inputs().begin();
- i != bencher.inputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << Misc::Yamlize((*i)->name())
- << ": " << Misc::Yamlize((*i)->unit()) << std::endl;
- }
- print_indent_();
- ostr_ << " outputs:" << std::endl;
- for (Outputs::const_iterator i = bencher.outputs().begin();
- i != bencher.outputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << Misc::Yamlize((*i)->name())
- << ": " << Misc::Yamlize((*i)->unit()) << std::endl;
- }
- print_indent_();
- ostr_ << " comment: |" << std::endl;
- print_indent_();
- ostr_ << " " << bencher.comment() << std::endl;
- print_indent_();
- ostr_ << " content:" << std::endl;
- indent_ += 3;
- }
-
- void Yaml::end_bench(const Bencher&)
- {
- indent_ -= 3;
- }
-
- void Yaml::begin_score(const Bencher& bencher)
- {
- print_indent_();
- ostr_ << "-" << std::endl;
- print_indent_();
- ostr_ << " inputs:" << std::endl;
- for (Inputs::const_iterator i = bencher.inputs().begin();
- i != bencher.inputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << (*i)->value() << "\t# "<< **i << std::endl;
- }
- print_indent_();
- ostr_ << " benches:" << std::endl;
- indent_ += 2;
- }
-
- void Yaml::end_score(const Bencher& bencher)
- {
- indent_ -= 2;
- print_indent_();
- ostr_ << " outputs:" << std::endl;
- for (Outputs::const_iterator i = bencher.outputs().begin();
- i != bencher.outputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << (*i)->value() << "\t# "<< **i << std::endl;
- }
- }
-
- } // namespace Dumper
-} // namespace Ranch
Index: lib/cxx/ranch-cxx/dumper/all.hh
--- lib/cxx/ranch-cxx/dumper/all.hh (revision 28)
+++ lib/cxx/ranch-cxx/dumper/all.hh (working copy)
@@ -1,8 +0,0 @@
-#ifndef RANCH_DUMPER_ALL_HH
-# define RANCH_DUMPER_ALL_HH
-
-# include <dumper/dumper.hh>
-# include <dumper/yaml.hh>
-
-#endif // !RANCH_DUMPER_ALL_HH
-
Index: lib/cxx/ranch-cxx/dumper/libdumper.cc
--- lib/cxx/ranch-cxx/dumper/libdumper.cc (revision 28)
+++ lib/cxx/ranch-cxx/dumper/libdumper.cc (working copy)
@@ -1,16 +0,0 @@
-#include <iostream>
-#include "dumper/yaml.hh"
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Dumper* yaml_stdout()
- {
- static Yaml yaml_stdout(std::cout);
- return &yaml_stdout;
- }
-
- } // namespace Dumper
-} // namespace Ranch
Index: lib/cxx/ranch-cxx/dumper/Makefile.am
--- lib/cxx/ranch-cxx/dumper/Makefile.am (revision 28)
+++ lib/cxx/ranch-cxx/dumper/Makefile.am (working copy)
@@ -1,19 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = libdumper.la
-libdumper_la_SOURCES = \
- all.hh \
- fwd.hh \
- libdumper.hh \
- libdumper.cc \
- dumper.hh \
- dumper.cc \
- yaml.hh \
- yaml.cc
-pkgincludedir = $(includedir)/$(PACKAGE)/dumper
-pkginclude_HEADERS = \
- all.hh \
- fwd.hh \
- libdumper.hh \
- dumper.hh \
- yaml.hh
Index: lib/cxx/ranch-cxx/dumper/dumper.hh
--- lib/cxx/ranch-cxx/dumper/dumper.hh (revision 28)
+++ lib/cxx/ranch-cxx/dumper/dumper.hh (working copy)
@@ -1,31 +0,0 @@
-
-#ifndef RANCH_DUMPER_HH
-# define RANCH_DUMPER_HH
-
-# include <string>
-# include <bencher.hh>
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- class Dumper
- {
- public:
- Dumper(std::ostream& ostr);
-
- virtual void begin_bench(const Bencher& bencher) = 0;
- virtual void end_bench(const Bencher& bencher) = 0;
-
- virtual void begin_score(const Bencher& bencher) = 0;
- virtual void end_score(const Bencher& bencher) = 0;
-
- protected:
- std::ostream& ostr_;
- }; // class Dumper
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_DUMPER_HH
Index: lib/cxx/ranch-cxx/dumper/fwd.hh
--- lib/cxx/ranch-cxx/dumper/fwd.hh (revision 28)
+++ lib/cxx/ranch-cxx/dumper/fwd.hh (working copy)
@@ -1,16 +0,0 @@
-#ifndef RANCH_DUMPER_FWD_HH
-# define RANCH_DUMPER_FWD_HH
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- class Dumper;
- class Yaml;
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_DUMPER_FWD_HH
-
Index: lib/cxx/ranch-cxx/input/input.cc
--- lib/cxx/ranch-cxx/input/input.cc (revision 28)
+++ lib/cxx/ranch-cxx/input/input.cc (working copy)
@@ -1,13 +0,0 @@
-#include <input/input.hh>
-
-namespace Ranch
-{
- namespace Input
- {
-
- } // namespace Input
-
-} // namespace Ranch
-
-
-
Index: lib/cxx/ranch-cxx/input/input.hxx
--- lib/cxx/ranch-cxx/input/input.hxx (revision 28)
+++ lib/cxx/ranch-cxx/input/input.hxx (working copy)
@@ -1,21 +0,0 @@
-
-#ifndef RANCH_INPUT_INPUT_HXX
-# define RANCH_INPUT_INPUT_HXX
-
-# include <input/input.hh>
-# include <ostream>
-
-namespace Ranch
-{
- namespace Input
- {
-
- inline Input::Input(const std::string& name, const std::string& unit) :
- IO(name, unit)
- {
- }
-
- } // namespace Input
-} // namespace Ranch
-
-#endif // !RANCH_INPUT_INPUT_HXX
Index: lib/cxx/ranch-cxx/input/Makefile.am
--- lib/cxx/ranch-cxx/input/Makefile.am (revision 28)
+++ lib/cxx/ranch-cxx/input/Makefile.am (working copy)
@@ -1,11 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = libinput.la
-libinput_la_SOURCES = \
- input.hh \
- input.hxx \
- input.cc
-pkgincludedir = $(includedir)/$(PACKAGE)/input
-pkginclude_HEADERS = \
- input.hh \
- input.hxx
Index: lib/cxx/ranch-cxx/input/input.hh
--- lib/cxx/ranch-cxx/input/input.hh (revision 28)
+++ lib/cxx/ranch-cxx/input/input.hh (working copy)
@@ -1,29 +0,0 @@
-
-
-#ifndef RANCH_INPUT_INPUT_HH
-# define RANCH_INPUT_INPUT_HH
-
-# include <string>
-# include <iosfwd>
-# include <io.hh>
-
-namespace Ranch
-{
- namespace Input
- {
-
- class Input : public IO
- {
- public:
- Input(const std::string& name, const std::string& unit = "");
-
- }; // class Input
-
- } // namespace Input
-
-} // namespace Ranch
-
-# include <input/input.hxx>
-
-#endif // !RANCH_INPUT_INPUT_HH
-
Index: lib/cxx/ranch-cxx/output/output.cc
--- lib/cxx/ranch-cxx/output/output.cc (revision 28)
+++ lib/cxx/ranch-cxx/output/output.cc (working copy)
@@ -1,23 +0,0 @@
-#include <output/output.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- Output::~Output()
- {
- }
-
- void Output::start()
- {
- }
-
- void Output::stop()
- {
- }
-
- } // namespace Output
-} // namespace Ranch
-
-
Index: lib/cxx/ranch-cxx/output/u-time.cc
--- lib/cxx/ranch-cxx/output/u-time.cc (revision 28)
+++ lib/cxx/ranch-cxx/output/u-time.cc (working copy)
@@ -1,34 +0,0 @@
-#include <output/u-time.hh>
-#include <sys/times.h>
-#include <cstdio>
-#include <cerrno>
-#include <unistd.h>
-
-namespace Ranch
-{
- namespace Output
- {
-
- void UTime::start()
- {
- start_time_ = utime_();
- }
-
- void UTime::stop()
- {
- value_ = (utime_() - start_time_) * sysconf(_SC_CLK_TCK) * 1.0e-4;
- }
-
- double UTime::utime_()
- {
- struct tms buf;
-
- if (times(&buf) == ((clock_t) - 1))
- perror("ranch: times");
- return (double)buf.tms_utime;
- }
-
- } // namespace Output
-} // namespace Ranch
-
-
Index: lib/cxx/ranch-cxx/output/output.hxx
--- lib/cxx/ranch-cxx/output/output.hxx (revision 28)
+++ lib/cxx/ranch-cxx/output/output.hxx (working copy)
@@ -1,27 +0,0 @@
-
-#ifndef RANCH_OUTPUT_OUTPUT_HXX
-# define RANCH_OUTPUT_OUTPUT_HXX
-
-# include <output/output.hh>
-# include <ostream>
-
-namespace Ranch
-{
- namespace Output
- {
-
- inline Output::Output(const std::string& name, const std::string& unit) :
- IO(name, unit)
- {
- }
-
- inline double Output::operator() ()
- {
- stop();
- return value_;
- }
-
- } // namespace Output
-} // namespace Ranch
-
-#endif // !RANCH_OUTPUT_OUTPUT_HXX
Index: lib/cxx/ranch-cxx/output/all.hh
--- lib/cxx/ranch-cxx/output/all.hh (revision 28)
+++ lib/cxx/ranch-cxx/output/all.hh (working copy)
@@ -1,8 +0,0 @@
-#ifndef RANCH_OUTPUT_ALL_HH
-# define RANCH_OUTPUT_ALL_HH
-
-# include "output/output.hh"
-# include "output/u-time.hh"
-
-#endif // !RANCH_OUTPUT_ALL_HH
-
Index: lib/cxx/ranch-cxx/output/u-time.hxx
--- lib/cxx/ranch-cxx/output/u-time.hxx (revision 28)
+++ lib/cxx/ranch-cxx/output/u-time.hxx (working copy)
@@ -1,20 +0,0 @@
-
-#ifndef RANCH_OUTPUT_UTIME_HXX
-# define RANCH_OUTPUT_UTIME_HXX
-
-# include <output/u-time.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- inline UTime::UTime() :
- Output("utime", "sec")
- {
- }
-
- } // namespace Output
-} // namespace Ranch
-
-#endif // !RANCH_OUTPUT_UTIME_HXX
Index: lib/cxx/ranch-cxx/output/Makefile.am
--- lib/cxx/ranch-cxx/output/Makefile.am (revision 28)
+++ lib/cxx/ranch-cxx/output/Makefile.am (working copy)
@@ -1,20 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = liboutput.la
-liboutput_la_SOURCES = \
- all.hh \
- output.hh \
- output.hxx \
- output.cc \
- u-time.hh \
- u-time.hxx \
- u-time.cc
-pkgincludedir = $(includedir)/$(PACKAGE)/output
-pkginclude_HEADERS = \
- all.hh \
- output.hh \
- output.hxx \
- u-time.hh \
- u-time.hxx
-
-
Index: lib/cxx/ranch-cxx/output/output.hh
--- lib/cxx/ranch-cxx/output/output.hh (revision 28)
+++ lib/cxx/ranch-cxx/output/output.hh (working copy)
@@ -1,35 +0,0 @@
-
-
-#ifndef RANCH_OUTPUT_OUTPUT_HH
-# define RANCH_OUTPUT_OUTPUT_HH
-
-# include <string>
-# include <iosfwd>
-# include <io.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- class Output : public IO
- {
- public:
- Output(const std::string& name, const std::string& unit = "");
- virtual ~Output();
-
- virtual void start();
- virtual void stop();
-
- double operator() ();
-
- }; // class Output
-
- } // namespace Output
-
-} // namespace Ranch
-
-# include <output/output.hxx>
-
-#endif // !RANCH_OUTPUT_OUTPUT_HH
-
Index: lib/cxx/ranch-cxx/output/u-time.hh
--- lib/cxx/ranch-cxx/output/u-time.hh (revision 28)
+++ lib/cxx/ranch-cxx/output/u-time.hh (working copy)
@@ -1,34 +0,0 @@
-
-
-#ifndef RANCH_OUTPUT_UTIME_HH
-# define RANCH_OUTPUT_UTIME_HH
-
-# include <output/output.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- class UTime : public Output
- {
- public:
- UTime();
-
- virtual void start();
- virtual void stop();
-
- protected:
- double utime_();
-
- protected:
- double start_time_;
- }; // class UTime
-
- } // namespace Output
-} // namespace Ranch
-
-# include <output/u-time.hxx>
-
-#endif // !RANCH_OUTPUT_UTIME_HH
-
Index: lib/cxx/ranch-cxx/ranch.mk
--- lib/cxx/ranch-cxx/ranch.mk (revision 28)
+++ lib/cxx/ranch-cxx/ranch.mk (working copy)
@@ -1,2 +0,0 @@
-
-AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
Index: lib/cxx/ranch-cxx/bencher.hh
--- lib/cxx/ranch-cxx/bencher.hh (revision 28)
+++ lib/cxx/ranch-cxx/bencher.hh (working copy)
@@ -1,66 +0,0 @@
-
-#ifndef RANCH_BENCH_HH
-# define RANCH_BENCH_HH
-
-# include <string>
-# include <inputs.hh>
-# include <input/input.hh>
-# include <outputs.hh>
-# include <output/output.hh>
-# include <dumper/fwd.hh>
-
-namespace Ranch
-{
-
- class Bencher
- {
- public:
-
- static Dumper::Dumper& dumper(Dumper::Dumper& dumper);
- static Dumper::Dumper& dumper();
-
- protected:
- static Dumper::Dumper* dumper_;
-
- public:
-
- Bencher(const std::string& name,
- Inputs& inputs,
- Outputs& outputs,
- const std::string& comment = "");
- Bencher(const std::string& name, const std::string& comment = "");
- ~Bencher();
-
- // The va_args require at least one argument. So we declare one function
- // for zero and another for 1 to N arguments.
- void start();
- void start(double size_input_1, ...);
- // There is always at least one output.
- void stop(double score_output_1, ...);
-
- Bencher& add_input(Input::Input& input);
- Bencher& add_output(Output::Output& output);
-
- const std::string& name() const;
- const Inputs& inputs() const;
- const Outputs& outputs() const;
- const std::string& comment() const;
-
- protected:
- void start_outputs_();
- void begin_bench_();
-
- protected:
- std::string name_;
- Inputs inputs_;
- Outputs outputs_;
- std::string comment_;
- bool first_start_call_;
-
- }; // class Bencher
-
-} // namespace Ranch
-
-# include <bencher.hxx>
-
-#endif // !RANCH_BENCH_HH
Index: lib/cxx/ranch-cxx/io.hh
--- lib/cxx/ranch-cxx/io.hh (revision 28)
+++ lib/cxx/ranch-cxx/io.hh (working copy)
@@ -1,37 +0,0 @@
-
-
-#ifndef RANCH_IO_HH
-# define RANCH_IO_HH
-
-# include <string>
-# include <iosfwd>
-# include <list>
-
-namespace Ranch
-{
- class IO
- {
- public:
- IO(const std::string& name, const std::string& unit = "");
-
- std::ostream& print(std::ostream& ostr) const;
-
- const std::string& name() const;
- const std::string& unit() const;
- double value() const;
- void value(double value);
-
- protected:
- std::string name_;
- std::string unit_;
- double value_;
- }; // class IO
-
- std::ostream& operator<< (std::ostream& ostr, const IO& io);
-
-} // namespace Ranch
-
-# include <io.hxx>
-
-#endif // !RANCH_IO_HH
-
Index: lib/cxx/ranch-cxx/Makefile.am
--- lib/cxx/ranch-cxx/Makefile.am (revision 28)
+++ lib/cxx/ranch-cxx/Makefile.am (working copy)
@@ -1,32 +0,0 @@
-
-include $(top_srcdir)/src/ranch.mk
-
-SUBDIRS = input output dumper misc
-
-lib_LTLIBRARIES = libranch.la
-pkginclude_HEADERS = \
- ranch.hh \
- bencher.hh \
- bencher.hxx \
- io.hh \
- io.hxx \
- inputs.hh \
- inputs.hxx \
- outputs.hh \
- outputs.hxx
-libranch_la_SOURCES = \
- bencher.hh \
- bencher.hxx \
- bencher.cc \
- io.hh \
- io.hxx \
- inputs.hh \
- inputs.hxx \
- outputs.hh \
- outputs.hxx
-libranch_la_LIBADD = \
- input/libinput.la \
- output/liboutput.la \
- dumper/libdumper.la \
- misc/libmisc.la
-
Index: lib/cxx/ranch-cxx/bencher.hxx
--- lib/cxx/ranch-cxx/bencher.hxx (revision 28)
+++ lib/cxx/ranch-cxx/bencher.hxx (working copy)
@@ -1,45 +0,0 @@
-
-#ifndef RANCH_BENCHER_HXX
-# define RANCH_BENCHER_HXX
-
-# include <bencher.hh>
-
-namespace Ranch
-{
-
- inline const std::string& Bencher::name() const
- {
- return name_;
- }
-
- inline const Inputs& Bencher::inputs() const
- {
- return inputs_;
- }
-
- inline const Outputs& Bencher::outputs() const
- {
- return outputs_;
- }
-
- inline const std::string& Bencher::comment() const
- {
- return comment_;
- }
-
- inline Bencher& Bencher::add_input(Input::Input& input)
- {
- inputs_.add(input);
- return *this;
- }
-
- inline Bencher& Bencher::add_output(Output::Output& output)
- {
- outputs_.add(output);
- return *this;
- }
-
-} // namespace Ranch
-
-
-#endif // !RANCH_BENCHER_HXX
Index: lib/cxx/ranch-cxx/io.hxx
--- lib/cxx/ranch-cxx/io.hxx (revision 28)
+++ lib/cxx/ranch-cxx/io.hxx (working copy)
@@ -1,50 +0,0 @@
-
-#ifndef RANCH_IO_HXX
-# define RANCH_IO_HXX
-
-# include <io.hh>
-# include <ostream>
-
-namespace Ranch
-{
-
- inline IO::IO(const std::string& name, const std::string& unit) :
- name_(name),
- unit_(unit),
- value_(0)
- {
- }
-
- inline std::ostream& IO::print(std::ostream& ostr) const
- {
- return ostr << name_ << '(' << unit_ << ')';
- }
-
- inline const std::string& IO::name() const
- {
- return name_;
- }
-
- inline const std::string& IO::unit() const
- {
- return unit_;
- }
-
- inline double IO::value() const
- {
- return value_;
- }
-
- inline void IO::value(double value)
- {
- value_ = value;
- }
-
- inline std::ostream& operator<< (std::ostream& ostr, const IO& io)
- {
- return io.print(ostr);
- }
-
-} // namespace Ranch
-
-#endif // !RANCH_IO_HXX
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Desprès <nicolas.despres(a)lrde.epita.fr>
Move lib/cxx/src to lib/cxx/ranch-cxx.
* lib/cxx/src:,
* lib/cxx/src/inputs.hh:,
* lib/cxx/src/outputs.hh:,
* lib/cxx/src/inputs.hxx:,
* lib/cxx/src/outputs.hxx:,
* lib/cxx/src/ranch.hh:,
* lib/cxx/src/bencher.cc:,
* lib/cxx/src/misc:,
* lib/cxx/src/misc/yamlize.hxx:,
* lib/cxx/src/misc/yamlize.hh:,
* lib/cxx/src/misc/Makefile.am:,
* lib/cxx/src/misc/yamlize.cc:,
* lib/cxx/src/dumper:,
* lib/cxx/src/dumper/dumper.cc:,
* lib/cxx/src/dumper/yaml.hh:,
* lib/cxx/src/dumper/libdumper.hh:,
* lib/cxx/src/dumper/yaml.cc:,
* lib/cxx/src/dumper/all.hh:,
* lib/cxx/src/dumper/libdumper.cc:,
* lib/cxx/src/dumper/Makefile.am:,
* lib/cxx/src/dumper/dumper.hh:,
* lib/cxx/src/dumper/fwd.hh:,
* lib/cxx/src/input:,
* lib/cxx/src/input/input.cc:,
* lib/cxx/src/input/input.hxx:,
* lib/cxx/src/input/Makefile.am:,
* lib/cxx/src/input/input.hh:,
* lib/cxx/src/output:,
* lib/cxx/src/output/output.cc:,
* lib/cxx/src/output/u-time.cc:,
* lib/cxx/src/output/output.hxx:,
* lib/cxx/src/output/all.hh:,
* lib/cxx/src/output/u-time.hxx:,
* lib/cxx/src/output/Makefile.am:,
* lib/cxx/src/output/output.hh:,
* lib/cxx/src/output/u-time.hh:,
* lib/cxx/src/ranch.mk:,
* lib/cxx/src/bencher.hh:,
* lib/cxx/src/io.hh:,
* lib/cxx/src/Makefile.am:,
* lib/cxx/src/bencher.hxx:,
* lib/cxx/src/io.hxx: Move to ...
* lib/cxx/ranch-cxx: ...here.
Makefile.am | 32 ----------------
bencher.cc | 103 ----------------------------------------------------
bencher.hh | 66 ---------------------------------
bencher.hxx | 45 ----------------------
dumper/Makefile.am | 19 ---------
dumper/all.hh | 8 ----
dumper/dumper.cc | 14 -------
dumper/dumper.hh | 31 ---------------
dumper/fwd.hh | 16 --------
dumper/libdumper.cc | 16 --------
dumper/libdumper.hh | 16 --------
dumper/yaml.cc | 94 -----------------------------------------------
dumper/yaml.hh | 34 -----------------
input/Makefile.am | 11 -----
input/input.cc | 13 ------
input/input.hh | 29 --------------
input/input.hxx | 21 ----------
inputs.hh | 38 -------------------
inputs.hxx | 39 -------------------
io.hh | 37 ------------------
io.hxx | 50 -------------------------
misc/Makefile.am | 12 ------
misc/yamlize.cc | 26 -------------
misc/yamlize.hh | 32 ----------------
misc/yamlize.hxx | 21 ----------
output/Makefile.am | 20 ----------
output/all.hh | 8 ----
output/output.cc | 23 -----------
output/output.hh | 35 -----------------
output/output.hxx | 27 -------------
output/u-time.cc | 34 -----------------
output/u-time.hh | 34 -----------------
output/u-time.hxx | 20 ----------
outputs.hh | 37 ------------------
outputs.hxx | 38 -------------------
ranch.hh | 10 -----
ranch.mk | 2 -
37 files changed, 1111 deletions(-)
Index: lib/cxx/src/inputs.hh
--- lib/cxx/src/inputs.hh (revision 27)
+++ lib/cxx/src/inputs.hh (working copy)
@@ -1,38 +0,0 @@
-
-
-#ifndef RANCH_INPUTS_HH
-# define RANCH_INPUTS_HH
-
-# include <list>
-# include <input/input.hh>
-
-namespace Ranch
-{
- class Inputs
- {
- public:
- Inputs& add(Input::Input& input);
-
- typedef std::list<Input::Input*> list_type;
-
- typedef list_type::const_iterator const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- typedef list_type::iterator iterator;
-
- iterator begin();
- iterator end();
-
- protected:
-
- list_type list_;
- }; // class Inputs
-
-} // namespace Ranch
-
-# include <inputs.hxx>
-
-#endif // !RANCH_INPUTS_HH
-
Index: lib/cxx/src/outputs.hh
--- lib/cxx/src/outputs.hh (revision 27)
+++ lib/cxx/src/outputs.hh (working copy)
@@ -1,37 +0,0 @@
-
-
-#ifndef RANCH_OUTPUTS_HH
-# define RANCH_OUTPUTS_HH
-
-# include <list>
-# include <output/output.hh>
-
-namespace Ranch
-{
- class Outputs
- {
- public:
- Outputs& add(Output::Output& output);
-
- typedef std::list<Output::Output*> list_type;
-
- typedef list_type::const_iterator const_iterator;
-
- const_iterator begin() const;
- const_iterator end() const;
-
- typedef list_type::iterator iterator;
-
- iterator begin();
- iterator end();
-
- protected:
- list_type list_;
- }; // class Outputs
-
-} // namespace Ranch
-
-# include <outputs.hxx>
-
-#endif // !RANCH_OUTPUTS_HH
-
Index: lib/cxx/src/inputs.hxx
--- lib/cxx/src/inputs.hxx (revision 27)
+++ lib/cxx/src/inputs.hxx (working copy)
@@ -1,39 +0,0 @@
-
-#ifndef RANCH_INPUTS_HXX
-# define RANCH_INPUTS_HXX
-
-# include <inputs.hh>
-
-namespace Ranch
-{
-
- inline Inputs& Inputs::add(Input::Input& input)
- {
- list_.push_back(&input);
- return *this;
- }
-
- inline Inputs::const_iterator Inputs::begin() const
- {
- return list_.begin();
- }
-
- inline Inputs::const_iterator Inputs::end() const
- {
- return list_.end();
- }
-
- inline Inputs::iterator Inputs::begin()
- {
- return list_.begin();
- }
-
- inline Inputs::iterator Inputs::end()
- {
- return list_.end();
- }
-
-
-} // namespace Ranch
-
-#endif // !RANCH_INPUTS_HXX
Index: lib/cxx/src/outputs.hxx
--- lib/cxx/src/outputs.hxx (revision 27)
+++ lib/cxx/src/outputs.hxx (working copy)
@@ -1,38 +0,0 @@
-
-#ifndef RANCH_OUTPUTS_HXX
-# define RANCH_OUTPUTS_HXX
-
-# include <outputs.hh>
-
-namespace Ranch
-{
-
- inline Outputs& Outputs::add(Output::Output& output)
- {
- list_.push_back(&output);
- return *this;
- }
-
- inline Outputs::const_iterator Outputs::begin() const
- {
- return list_.begin();
- }
-
- inline Outputs::const_iterator Outputs::end() const
- {
- return list_.end();
- }
-
- inline Outputs::iterator Outputs::begin()
- {
- return list_.begin();
- }
-
- inline Outputs::iterator Outputs::end()
- {
- return list_.end();
- }
-
-} // namespace Ranch
-
-#endif // !RANCH_OUTPUTS_HXX
Index: lib/cxx/src/ranch.hh
--- lib/cxx/src/ranch.hh (revision 27)
+++ lib/cxx/src/ranch.hh (working copy)
@@ -1,10 +0,0 @@
-
-#ifndef RANCH_HH
-# define RANCH_HH
-
-# include <bencher.hh>
-# include <input/input.hh>
-# include <output/all.hh>
-# include <dumper/all.hh>
-
-#endif // !RANCH_HH
Index: lib/cxx/src/bencher.cc
--- lib/cxx/src/bencher.cc (revision 27)
+++ lib/cxx/src/bencher.cc (working copy)
@@ -1,103 +0,0 @@
-#include <bencher.hh>
-#include <cstdarg>
-#include <dumper/libdumper.hh>
-#include <dumper/dumper.hh>
-
-namespace Ranch
-{
-
- Dumper::Dumper* Bencher::dumper_ = Dumper::yaml_stdout();
-
- Dumper::Dumper& Bencher::dumper(Dumper::Dumper& dumper)
- {
- Dumper::Dumper* old_dumper = dumper_;
- dumper_ = &dumper;
- return *old_dumper;
- }
-
- Dumper::Dumper& Bencher::dumper()
- {
- return *dumper_;
- }
-
- Bencher::Bencher(const std::string& name,
- Inputs& inputs,
- Outputs& outputs,
- const std::string& comment) :
- name_(name),
- inputs_(inputs),
- outputs_(outputs),
- comment_(comment),
- first_start_call_(true)
- {
- }
-
- Bencher::Bencher(const std::string& name, const std::string& comment) :
- name_(name),
- inputs_(),
- outputs_(),
- comment_(comment),
- first_start_call_(true)
- {
- }
-
- Bencher::~Bencher()
- {
- dumper_->end_bench(*this);
- }
-
- void Bencher::start()
- {
- begin_bench_();
- dumper_->begin_score(*this);
- start_outputs_();
- }
-
- void Bencher::start(double size_input_1, ...)
- {
- va_list ap;
-
- begin_bench_();
- Inputs::iterator i = inputs_.begin();
- (*i)->value(size_input_1);
-
- va_start(ap, size_input_1);
- for (++i; i != inputs_.end(); ++i)
- (*i)->value(va_arg(ap, double));
- va_end(ap);
- dumper_->begin_score(*this);
- start_outputs_();
- }
-
- void Bencher::stop(double score_output_1, ...)
- {
- va_list ap;
-
- Outputs::iterator i = outputs_.begin();
- (*i)->value(score_output_1);
-
- va_start(ap, score_output_1);
- for (++i; i != outputs_.end(); ++i)
- (*i)->value(va_arg(ap, double));
- va_end(ap);
- dumper_->end_score(*this);
- }
-
- void Bencher::start_outputs_()
- {
- for (Outputs::iterator i = outputs_.begin();
- i != outputs_.end();
- ++i)
- (*i)->start();
- }
-
- void Bencher::begin_bench_()
- {
- if (first_start_call_)
- {
- first_start_call_ = false;
- dumper_->begin_bench(*this);
- }
- }
-
-} // namespace Ranch
Index: lib/cxx/src/misc/yamlize.hxx
--- lib/cxx/src/misc/yamlize.hxx (revision 27)
+++ lib/cxx/src/misc/yamlize.hxx (working copy)
@@ -1,21 +0,0 @@
-
-#ifndef RANCH_MISC_YAMLIZE_HXX
-# define RANCH_MISC_YAMLIZE_HXX
-
-# include <misc/yamlize.hh>
-
-namespace Ranch
-{
- namespace Misc
- {
-
- inline std::ostream& operator<< (std::ostream& ostr,
- const Yamlize& yamlize)
- {
- return yamlize.print(ostr);
- }
-
- } // namespace Misc
-} // namespace Ranch
-
-#endif // !RANCH_MISC_YAMLIZE_HXX
Index: lib/cxx/src/misc/yamlize.hh
--- lib/cxx/src/misc/yamlize.hh (revision 27)
+++ lib/cxx/src/misc/yamlize.hh (working copy)
@@ -1,32 +0,0 @@
-
-#ifndef RANCH_MISC_YAMLIZE_HH
-# define RANCH_MISC_YAMLIZE_HH
-
-# include <iosfwd>
-# include <string>
-
-namespace Ranch
-{
- namespace Misc
- {
-
- class Yamlize
- {
- public:
- Yamlize(const std::string& str);
-
- std::ostream& print(std::ostream& ostr) const;
-
- protected:
- std::string str_;
-
- }; // class Yamlize
-
- std::ostream& operator<< (std::ostream& ostr, const Yamlize& yamlize);
-
- } // namespace Misc
-} // namespace Ranch
-
-# include <misc/yamlize.hxx>
-
-#endif // !RANCH_MISC_YAMLIZE_HH
Index: lib/cxx/src/misc/Makefile.am
--- lib/cxx/src/misc/Makefile.am (revision 27)
+++ lib/cxx/src/misc/Makefile.am (working copy)
@@ -1,12 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = libmisc.la
-libmisc_la_SOURCES = \
- yamlize.hh \
- yamlize.cc \
- yamlize.hxx
-pkgincludedir = $(includedir)/$(PACKAGE)/misc
-pkginclude_HEADERS = \
- yamlize.hh \
- yamlize.hxx
-
Index: lib/cxx/src/misc/yamlize.cc
--- lib/cxx/src/misc/yamlize.cc (revision 27)
+++ lib/cxx/src/misc/yamlize.cc (working copy)
@@ -1,26 +0,0 @@
-#include "misc/yamlize.hh"
-#include <ostream>
-
-namespace Ranch
-{
- namespace Misc
- {
-
- Yamlize::Yamlize(const std::string& str) :
- str_(str)
- {
- }
-
- std::ostream& Yamlize::print(std::ostream& ostr) const
- {
- ostr << '\'';
- for (std::string::const_iterator i = str_.begin(); i != str_.end(); ++i)
- if (*i == '\'')
- ostr << "''";
- else
- ostr << *i;
- return ostr << '\'';
- }
-
- } // namespace Misc
-} // namespace Ranch
Index: lib/cxx/src/dumper/dumper.cc
--- lib/cxx/src/dumper/dumper.cc (revision 27)
+++ lib/cxx/src/dumper/dumper.cc (working copy)
@@ -1,14 +0,0 @@
-#include "dumper/dumper.hh"
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Dumper::Dumper(std::ostream& ostr) :
- ostr_(ostr)
- {
- }
-
- } // namespace Dumper
-} // namespace Ranch
Index: lib/cxx/src/dumper/yaml.hh
--- lib/cxx/src/dumper/yaml.hh (revision 27)
+++ lib/cxx/src/dumper/yaml.hh (working copy)
@@ -1,34 +0,0 @@
-
-#ifndef RANCH_YAML_HH
-# define RANCH_YAML_HH
-
-# include <dumper/dumper.hh>
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- class Yaml : public Dumper
- {
- public:
- Yaml(std::ostream& ostr);
-
- virtual void begin_bench(const Bencher& bencher);
- virtual void end_bench(const Bencher& bencher);
-
- virtual void begin_score(const Bencher& bencher);
- virtual void end_score(const Bencher& bencher);
-
- protected:
- void print_indent_();
-
- protected:
- unsigned int indent_;
- }; // class Yaml
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_YAML_HH
-
Index: lib/cxx/src/dumper/libdumper.hh
--- lib/cxx/src/dumper/libdumper.hh (revision 27)
+++ lib/cxx/src/dumper/libdumper.hh (working copy)
@@ -1,16 +0,0 @@
-#ifndef RANCH_LIBDUMPER_HH
-# define RANCH_LIBDUMPER_HH
-
-# include "dumper/fwd.hh"
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Dumper* yaml_stdout();
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_LIBDUMPER_HH
Index: lib/cxx/src/dumper/yaml.cc
--- lib/cxx/src/dumper/yaml.cc (revision 27)
+++ lib/cxx/src/dumper/yaml.cc (working copy)
@@ -1,94 +0,0 @@
-#include <dumper/yaml.hh>
-#include <misc/yamlize.hh>
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Yaml::Yaml(std::ostream& ostr) :
- Dumper(ostr),
- indent_(0)
- {
- }
-
- void Yaml::print_indent_()
- {
- for (unsigned int i = 0; i < indent_; ++i)
- ostr_ << " ";
- }
-
- void Yaml::begin_bench(const Bencher& bencher)
- {
- print_indent_();
- ostr_ << "- " << Misc::Yamlize(bencher.name()) << ':' << std::endl;
- print_indent_();
- ostr_ << " type:" << std::endl;
- print_indent_();
- ostr_ << " inputs:" << std::endl;
- for (Inputs::const_iterator i = bencher.inputs().begin();
- i != bencher.inputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << Misc::Yamlize((*i)->name())
- << ": " << Misc::Yamlize((*i)->unit()) << std::endl;
- }
- print_indent_();
- ostr_ << " outputs:" << std::endl;
- for (Outputs::const_iterator i = bencher.outputs().begin();
- i != bencher.outputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << Misc::Yamlize((*i)->name())
- << ": " << Misc::Yamlize((*i)->unit()) << std::endl;
- }
- print_indent_();
- ostr_ << " comment: |" << std::endl;
- print_indent_();
- ostr_ << " " << bencher.comment() << std::endl;
- print_indent_();
- ostr_ << " content:" << std::endl;
- indent_ += 3;
- }
-
- void Yaml::end_bench(const Bencher&)
- {
- indent_ -= 3;
- }
-
- void Yaml::begin_score(const Bencher& bencher)
- {
- print_indent_();
- ostr_ << "-" << std::endl;
- print_indent_();
- ostr_ << " inputs:" << std::endl;
- for (Inputs::const_iterator i = bencher.inputs().begin();
- i != bencher.inputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << (*i)->value() << "\t# "<< **i << std::endl;
- }
- print_indent_();
- ostr_ << " benches:" << std::endl;
- indent_ += 2;
- }
-
- void Yaml::end_score(const Bencher& bencher)
- {
- indent_ -= 2;
- print_indent_();
- ostr_ << " outputs:" << std::endl;
- for (Outputs::const_iterator i = bencher.outputs().begin();
- i != bencher.outputs().end();
- ++i)
- {
- print_indent_();
- ostr_ << " - " << (*i)->value() << "\t# "<< **i << std::endl;
- }
- }
-
- } // namespace Dumper
-} // namespace Ranch
Index: lib/cxx/src/dumper/all.hh
--- lib/cxx/src/dumper/all.hh (revision 27)
+++ lib/cxx/src/dumper/all.hh (working copy)
@@ -1,8 +0,0 @@
-#ifndef RANCH_DUMPER_ALL_HH
-# define RANCH_DUMPER_ALL_HH
-
-# include <dumper/dumper.hh>
-# include <dumper/yaml.hh>
-
-#endif // !RANCH_DUMPER_ALL_HH
-
Index: lib/cxx/src/dumper/libdumper.cc
--- lib/cxx/src/dumper/libdumper.cc (revision 27)
+++ lib/cxx/src/dumper/libdumper.cc (working copy)
@@ -1,16 +0,0 @@
-#include <iostream>
-#include "dumper/yaml.hh"
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- Dumper* yaml_stdout()
- {
- static Yaml yaml_stdout(std::cout);
- return &yaml_stdout;
- }
-
- } // namespace Dumper
-} // namespace Ranch
Index: lib/cxx/src/dumper/Makefile.am
--- lib/cxx/src/dumper/Makefile.am (revision 27)
+++ lib/cxx/src/dumper/Makefile.am (working copy)
@@ -1,19 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = libdumper.la
-libdumper_la_SOURCES = \
- all.hh \
- fwd.hh \
- libdumper.hh \
- libdumper.cc \
- dumper.hh \
- dumper.cc \
- yaml.hh \
- yaml.cc
-pkgincludedir = $(includedir)/$(PACKAGE)/dumper
-pkginclude_HEADERS = \
- all.hh \
- fwd.hh \
- libdumper.hh \
- dumper.hh \
- yaml.hh
Index: lib/cxx/src/dumper/dumper.hh
--- lib/cxx/src/dumper/dumper.hh (revision 27)
+++ lib/cxx/src/dumper/dumper.hh (working copy)
@@ -1,31 +0,0 @@
-
-#ifndef RANCH_DUMPER_HH
-# define RANCH_DUMPER_HH
-
-# include <string>
-# include <bencher.hh>
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- class Dumper
- {
- public:
- Dumper(std::ostream& ostr);
-
- virtual void begin_bench(const Bencher& bencher) = 0;
- virtual void end_bench(const Bencher& bencher) = 0;
-
- virtual void begin_score(const Bencher& bencher) = 0;
- virtual void end_score(const Bencher& bencher) = 0;
-
- protected:
- std::ostream& ostr_;
- }; // class Dumper
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_DUMPER_HH
Index: lib/cxx/src/dumper/fwd.hh
--- lib/cxx/src/dumper/fwd.hh (revision 27)
+++ lib/cxx/src/dumper/fwd.hh (working copy)
@@ -1,16 +0,0 @@
-#ifndef RANCH_DUMPER_FWD_HH
-# define RANCH_DUMPER_FWD_HH
-
-namespace Ranch
-{
- namespace Dumper
- {
-
- class Dumper;
- class Yaml;
-
- } // namespace Dumper
-} // namespace Ranch
-
-#endif // !RANCH_DUMPER_FWD_HH
-
Index: lib/cxx/src/input/input.cc
--- lib/cxx/src/input/input.cc (revision 27)
+++ lib/cxx/src/input/input.cc (working copy)
@@ -1,13 +0,0 @@
-#include <input/input.hh>
-
-namespace Ranch
-{
- namespace Input
- {
-
- } // namespace Input
-
-} // namespace Ranch
-
-
-
Index: lib/cxx/src/input/input.hxx
--- lib/cxx/src/input/input.hxx (revision 27)
+++ lib/cxx/src/input/input.hxx (working copy)
@@ -1,21 +0,0 @@
-
-#ifndef RANCH_INPUT_INPUT_HXX
-# define RANCH_INPUT_INPUT_HXX
-
-# include <input/input.hh>
-# include <ostream>
-
-namespace Ranch
-{
- namespace Input
- {
-
- inline Input::Input(const std::string& name, const std::string& unit) :
- IO(name, unit)
- {
- }
-
- } // namespace Input
-} // namespace Ranch
-
-#endif // !RANCH_INPUT_INPUT_HXX
Index: lib/cxx/src/input/Makefile.am
--- lib/cxx/src/input/Makefile.am (revision 27)
+++ lib/cxx/src/input/Makefile.am (working copy)
@@ -1,11 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = libinput.la
-libinput_la_SOURCES = \
- input.hh \
- input.hxx \
- input.cc
-pkgincludedir = $(includedir)/$(PACKAGE)/input
-pkginclude_HEADERS = \
- input.hh \
- input.hxx
Index: lib/cxx/src/input/input.hh
--- lib/cxx/src/input/input.hh (revision 27)
+++ lib/cxx/src/input/input.hh (working copy)
@@ -1,29 +0,0 @@
-
-
-#ifndef RANCH_INPUT_INPUT_HH
-# define RANCH_INPUT_INPUT_HH
-
-# include <string>
-# include <iosfwd>
-# include <io.hh>
-
-namespace Ranch
-{
- namespace Input
- {
-
- class Input : public IO
- {
- public:
- Input(const std::string& name, const std::string& unit = "");
-
- }; // class Input
-
- } // namespace Input
-
-} // namespace Ranch
-
-# include <input/input.hxx>
-
-#endif // !RANCH_INPUT_INPUT_HH
-
Index: lib/cxx/src/output/output.cc
--- lib/cxx/src/output/output.cc (revision 27)
+++ lib/cxx/src/output/output.cc (working copy)
@@ -1,23 +0,0 @@
-#include <output/output.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- Output::~Output()
- {
- }
-
- void Output::start()
- {
- }
-
- void Output::stop()
- {
- }
-
- } // namespace Output
-} // namespace Ranch
-
-
Index: lib/cxx/src/output/u-time.cc
--- lib/cxx/src/output/u-time.cc (revision 27)
+++ lib/cxx/src/output/u-time.cc (working copy)
@@ -1,34 +0,0 @@
-#include <output/u-time.hh>
-#include <sys/times.h>
-#include <cstdio>
-#include <cerrno>
-#include <unistd.h>
-
-namespace Ranch
-{
- namespace Output
- {
-
- void UTime::start()
- {
- start_time_ = utime_();
- }
-
- void UTime::stop()
- {
- value_ = (utime_() - start_time_) * sysconf(_SC_CLK_TCK) * 1.0e-4;
- }
-
- double UTime::utime_()
- {
- struct tms buf;
-
- if (times(&buf) == ((clock_t) - 1))
- perror("ranch: times");
- return (double)buf.tms_utime;
- }
-
- } // namespace Output
-} // namespace Ranch
-
-
Index: lib/cxx/src/output/output.hxx
--- lib/cxx/src/output/output.hxx (revision 27)
+++ lib/cxx/src/output/output.hxx (working copy)
@@ -1,27 +0,0 @@
-
-#ifndef RANCH_OUTPUT_OUTPUT_HXX
-# define RANCH_OUTPUT_OUTPUT_HXX
-
-# include <output/output.hh>
-# include <ostream>
-
-namespace Ranch
-{
- namespace Output
- {
-
- inline Output::Output(const std::string& name, const std::string& unit) :
- IO(name, unit)
- {
- }
-
- inline double Output::operator() ()
- {
- stop();
- return value_;
- }
-
- } // namespace Output
-} // namespace Ranch
-
-#endif // !RANCH_OUTPUT_OUTPUT_HXX
Index: lib/cxx/src/output/all.hh
--- lib/cxx/src/output/all.hh (revision 27)
+++ lib/cxx/src/output/all.hh (working copy)
@@ -1,8 +0,0 @@
-#ifndef RANCH_OUTPUT_ALL_HH
-# define RANCH_OUTPUT_ALL_HH
-
-# include "output/output.hh"
-# include "output/u-time.hh"
-
-#endif // !RANCH_OUTPUT_ALL_HH
-
Index: lib/cxx/src/output/u-time.hxx
--- lib/cxx/src/output/u-time.hxx (revision 27)
+++ lib/cxx/src/output/u-time.hxx (working copy)
@@ -1,20 +0,0 @@
-
-#ifndef RANCH_OUTPUT_UTIME_HXX
-# define RANCH_OUTPUT_UTIME_HXX
-
-# include <output/u-time.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- inline UTime::UTime() :
- Output("utime", "sec")
- {
- }
-
- } // namespace Output
-} // namespace Ranch
-
-#endif // !RANCH_OUTPUT_UTIME_HXX
Index: lib/cxx/src/output/Makefile.am
--- lib/cxx/src/output/Makefile.am (revision 27)
+++ lib/cxx/src/output/Makefile.am (working copy)
@@ -1,20 +0,0 @@
-include $(top_srcdir)/src/ranch.mk
-
-noinst_LTLIBRARIES = liboutput.la
-liboutput_la_SOURCES = \
- all.hh \
- output.hh \
- output.hxx \
- output.cc \
- u-time.hh \
- u-time.hxx \
- u-time.cc
-pkgincludedir = $(includedir)/$(PACKAGE)/output
-pkginclude_HEADERS = \
- all.hh \
- output.hh \
- output.hxx \
- u-time.hh \
- u-time.hxx
-
-
Index: lib/cxx/src/output/output.hh
--- lib/cxx/src/output/output.hh (revision 27)
+++ lib/cxx/src/output/output.hh (working copy)
@@ -1,35 +0,0 @@
-
-
-#ifndef RANCH_OUTPUT_OUTPUT_HH
-# define RANCH_OUTPUT_OUTPUT_HH
-
-# include <string>
-# include <iosfwd>
-# include <io.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- class Output : public IO
- {
- public:
- Output(const std::string& name, const std::string& unit = "");
- virtual ~Output();
-
- virtual void start();
- virtual void stop();
-
- double operator() ();
-
- }; // class Output
-
- } // namespace Output
-
-} // namespace Ranch
-
-# include <output/output.hxx>
-
-#endif // !RANCH_OUTPUT_OUTPUT_HH
-
Index: lib/cxx/src/output/u-time.hh
--- lib/cxx/src/output/u-time.hh (revision 27)
+++ lib/cxx/src/output/u-time.hh (working copy)
@@ -1,34 +0,0 @@
-
-
-#ifndef RANCH_OUTPUT_UTIME_HH
-# define RANCH_OUTPUT_UTIME_HH
-
-# include <output/output.hh>
-
-namespace Ranch
-{
- namespace Output
- {
-
- class UTime : public Output
- {
- public:
- UTime();
-
- virtual void start();
- virtual void stop();
-
- protected:
- double utime_();
-
- protected:
- double start_time_;
- }; // class UTime
-
- } // namespace Output
-} // namespace Ranch
-
-# include <output/u-time.hxx>
-
-#endif // !RANCH_OUTPUT_UTIME_HH
-
Index: lib/cxx/src/ranch.mk
--- lib/cxx/src/ranch.mk (revision 27)
+++ lib/cxx/src/ranch.mk (working copy)
@@ -1,2 +0,0 @@
-
-AM_CPPFLAGS = -I$(top_builddir)/src -I$(top_srcdir)/src
Index: lib/cxx/src/bencher.hh
--- lib/cxx/src/bencher.hh (revision 27)
+++ lib/cxx/src/bencher.hh (working copy)
@@ -1,66 +0,0 @@
-
-#ifndef RANCH_BENCH_HH
-# define RANCH_BENCH_HH
-
-# include <string>
-# include <inputs.hh>
-# include <input/input.hh>
-# include <outputs.hh>
-# include <output/output.hh>
-# include <dumper/fwd.hh>
-
-namespace Ranch
-{
-
- class Bencher
- {
- public:
-
- static Dumper::Dumper& dumper(Dumper::Dumper& dumper);
- static Dumper::Dumper& dumper();
-
- protected:
- static Dumper::Dumper* dumper_;
-
- public:
-
- Bencher(const std::string& name,
- Inputs& inputs,
- Outputs& outputs,
- const std::string& comment = "");
- Bencher(const std::string& name, const std::string& comment = "");
- ~Bencher();
-
- // The va_args require at least one argument. So we declare one function
- // for zero and another for 1 to N arguments.
- void start();
- void start(double size_input_1, ...);
- // There is always at least one output.
- void stop(double score_output_1, ...);
-
- Bencher& add_input(Input::Input& input);
- Bencher& add_output(Output::Output& output);
-
- const std::string& name() const;
- const Inputs& inputs() const;
- const Outputs& outputs() const;
- const std::string& comment() const;
-
- protected:
- void start_outputs_();
- void begin_bench_();
-
- protected:
- std::string name_;
- Inputs inputs_;
- Outputs outputs_;
- std::string comment_;
- bool first_start_call_;
-
- }; // class Bencher
-
-} // namespace Ranch
-
-# include <bencher.hxx>
-
-#endif // !RANCH_BENCH_HH
Index: lib/cxx/src/io.hh
--- lib/cxx/src/io.hh (revision 27)
+++ lib/cxx/src/io.hh (working copy)
@@ -1,37 +0,0 @@
-
-
-#ifndef RANCH_IO_HH
-# define RANCH_IO_HH
-
-# include <string>
-# include <iosfwd>
-# include <list>
-
-namespace Ranch
-{
- class IO
- {
- public:
- IO(const std::string& name, const std::string& unit = "");
-
- std::ostream& print(std::ostream& ostr) const;
-
- const std::string& name() const;
- const std::string& unit() const;
- double value() const;
- void value(double value);
-
- protected:
- std::string name_;
- std::string unit_;
- double value_;
- }; // class IO
-
- std::ostream& operator<< (std::ostream& ostr, const IO& io);
-
-} // namespace Ranch
-
-# include <io.hxx>
-
-#endif // !RANCH_IO_HH
-
Index: lib/cxx/src/Makefile.am
--- lib/cxx/src/Makefile.am (revision 27)
+++ lib/cxx/src/Makefile.am (working copy)
@@ -1,32 +0,0 @@
-
-include $(top_srcdir)/src/ranch.mk
-
-SUBDIRS = input output dumper misc
-
-lib_LTLIBRARIES = libranch.la
-pkginclude_HEADERS = \
- ranch.hh \
- bencher.hh \
- bencher.hxx \
- io.hh \
- io.hxx \
- inputs.hh \
- inputs.hxx \
- outputs.hh \
- outputs.hxx
-libranch_la_SOURCES = \
- bencher.hh \
- bencher.hxx \
- bencher.cc \
- io.hh \
- io.hxx \
- inputs.hh \
- inputs.hxx \
- outputs.hh \
- outputs.hxx
-libranch_la_LIBADD = \
- input/libinput.la \
- output/liboutput.la \
- dumper/libdumper.la \
- misc/libmisc.la
-
Index: lib/cxx/src/bencher.hxx
--- lib/cxx/src/bencher.hxx (revision 27)
+++ lib/cxx/src/bencher.hxx (working copy)
@@ -1,45 +0,0 @@
-
-#ifndef RANCH_BENCHER_HXX
-# define RANCH_BENCHER_HXX
-
-# include <bencher.hh>
-
-namespace Ranch
-{
-
- inline const std::string& Bencher::name() const
- {
- return name_;
- }
-
- inline const Inputs& Bencher::inputs() const
- {
- return inputs_;
- }
-
- inline const Outputs& Bencher::outputs() const
- {
- return outputs_;
- }
-
- inline const std::string& Bencher::comment() const
- {
- return comment_;
- }
-
- inline Bencher& Bencher::add_input(Input::Input& input)
- {
- inputs_.add(input);
- return *this;
- }
-
- inline Bencher& Bencher::add_output(Output::Output& output)
- {
- outputs_.add(output);
- return *this;
- }
-
-} // namespace Ranch
-
-
-#endif // !RANCH_BENCHER_HXX
Index: lib/cxx/src/io.hxx
--- lib/cxx/src/io.hxx (revision 27)
+++ lib/cxx/src/io.hxx (working copy)
@@ -1,50 +0,0 @@
-
-#ifndef RANCH_IO_HXX
-# define RANCH_IO_HXX
-
-# include <io.hh>
-# include <ostream>
-
-namespace Ranch
-{
-
- inline IO::IO(const std::string& name, const std::string& unit) :
- name_(name),
- unit_(unit),
- value_(0)
- {
- }
-
- inline std::ostream& IO::print(std::ostream& ostr) const
- {
- return ostr << name_ << '(' << unit_ << ')';
- }
-
- inline const std::string& IO::name() const
- {
- return name_;
- }
-
- inline const std::string& IO::unit() const
- {
- return unit_;
- }
-
- inline double IO::value() const
- {
- return value_;
- }
-
- inline void IO::value(double value)
- {
- value_ = value;
- }
-
- inline std::ostream& operator<< (std::ostream& ostr, const IO& io)
- {
- return io.print(ostr);
- }
-
-} // namespace Ranch
-
-#endif // !RANCH_IO_HXX
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Desprès <nicolas.despres(a)lrde.epita.fr>
Update header inclusion.
* lib/cxx/test/bencher-test.htt:,
* lib/cxx/src/inputs.hh:,
* lib/cxx/src/outputs.hh:,
* lib/cxx/src/inputs.hxx:,
* lib/cxx/src/ranch.hh:,
* lib/cxx/src/outputs.hxx:,
* lib/cxx/src/bencher.cc:,
* lib/cxx/src/misc/yamlize.hxx:,
* lib/cxx/src/misc/yamlize.hh:,
* lib/cxx/src/misc/Makefile.am:,
* lib/cxx/src/dumper/yaml.hh:,
* lib/cxx/src/dumper/yaml.cc:,
* lib/cxx/src/dumper/all.hh:,
* lib/cxx/src/dumper/Makefile.am:,
* lib/cxx/src/dumper/dumper.hh:,
* lib/cxx/src/input/input.cc:,
* lib/cxx/src/input/input.hxx:,
* lib/cxx/src/input/Makefile.am:,
* lib/cxx/src/input/input.hh:,
* lib/cxx/src/output/output.cc:,
* lib/cxx/src/output/u-time.cc:,
* lib/cxx/src/output/output.hxx:,
* lib/cxx/src/output/u-time.hxx:,
* lib/cxx/src/output/Makefile.am:,
* lib/cxx/src/output/output.hh:,
* lib/cxx/src/output/u-time.hh:,
* lib/cxx/src/bencher.hh:,
* lib/cxx/src/io.hh:,
* lib/cxx/src/Makefile.am:,
* lib/cxx/src/bencher.hxx:,
* lib/cxx/src/io.hxx: Use <> instead of "".
src/Makefile.am | 11 ++++++++++-
src/bencher.cc | 6 +++---
src/bencher.hh | 12 ++++++------
src/bencher.hxx | 2 +-
src/dumper/Makefile.am | 8 +++++++-
src/dumper/all.hh | 4 ++--
src/dumper/dumper.hh | 2 +-
src/dumper/yaml.cc | 4 ++--
src/dumper/yaml.hh | 2 +-
src/input/Makefile.am | 4 ++++
src/input/input.cc | 2 +-
src/input/input.hh | 4 ++--
src/input/input.hxx | 2 +-
src/inputs.hh | 4 ++--
src/inputs.hxx | 2 +-
src/io.hh | 2 +-
src/io.hxx | 2 +-
src/misc/Makefile.am | 4 ++++
src/misc/yamlize.hh | 2 +-
src/misc/yamlize.hxx | 2 +-
src/output/Makefile.am | 7 +++++++
src/output/output.cc | 2 +-
src/output/output.hh | 4 ++--
src/output/output.hxx | 2 +-
src/output/u-time.cc | 2 +-
src/output/u-time.hh | 4 ++--
src/output/u-time.hxx | 2 +-
src/outputs.hh | 4 ++--
src/outputs.hxx | 2 +-
src/ranch.hh | 8 ++++----
test/bencher-test.htt | 4 ++--
31 files changed, 76 insertions(+), 46 deletions(-)
Index: lib/cxx/test/bencher-test.htt
--- lib/cxx/test/bencher-test.htt (revision 26)
+++ lib/cxx/test/bencher-test.htt (working copy)
@@ -2,8 +2,8 @@
#include <cxxtest/TestSuite.h>
#include <sstream>
-#include "bencher.hh"
-#include "dumper/yaml.hh"
+#include <bencher.hh>
+#include <dumper/yaml.hh>
#define OUTPUT_CTOR_1 \
"- 'test1':\n\
Index: lib/cxx/src/inputs.hh
--- lib/cxx/src/inputs.hh (revision 26)
+++ lib/cxx/src/inputs.hh (working copy)
@@ -4,7 +4,7 @@
# define RANCH_INPUTS_HH
# include <list>
-# include "input/input.hh"
+# include <input/input.hh>
namespace Ranch
{
@@ -32,7 +32,7 @@
} // namespace Ranch
-# include "inputs.hxx"
+# include <inputs.hxx>
#endif // !RANCH_INPUTS_HH
Index: lib/cxx/src/outputs.hh
--- lib/cxx/src/outputs.hh (revision 26)
+++ lib/cxx/src/outputs.hh (working copy)
@@ -4,7 +4,7 @@
# define RANCH_OUTPUTS_HH
# include <list>
-# include "output/output.hh"
+# include <output/output.hh>
namespace Ranch
{
@@ -31,7 +31,7 @@
} // namespace Ranch
-# include "outputs.hxx"
+# include <outputs.hxx>
#endif // !RANCH_OUTPUTS_HH
Index: lib/cxx/src/inputs.hxx
--- lib/cxx/src/inputs.hxx (revision 26)
+++ lib/cxx/src/inputs.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_INPUTS_HXX
# define RANCH_INPUTS_HXX
-# include "inputs.hh"
+# include <inputs.hh>
namespace Ranch
{
Index: lib/cxx/src/ranch.hh
--- lib/cxx/src/ranch.hh (revision 26)
+++ lib/cxx/src/ranch.hh (working copy)
@@ -2,9 +2,9 @@
#ifndef RANCH_HH
# define RANCH_HH
-# include "bencher.hh"
-# include "input/input.hh"
-# include "output/all.hh"
-# include "dumper/all.hh"
+# include <bencher.hh>
+# include <input/input.hh>
+# include <output/all.hh>
+# include <dumper/all.hh>
#endif // !RANCH_HH
Index: lib/cxx/src/outputs.hxx
--- lib/cxx/src/outputs.hxx (revision 26)
+++ lib/cxx/src/outputs.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_OUTPUTS_HXX
# define RANCH_OUTPUTS_HXX
-# include "outputs.hh"
+# include <outputs.hh>
namespace Ranch
{
Index: lib/cxx/src/bencher.cc
--- lib/cxx/src/bencher.cc (revision 26)
+++ lib/cxx/src/bencher.cc (working copy)
@@ -1,7 +1,7 @@
-#include "bencher.hh"
+#include <bencher.hh>
#include <cstdarg>
-#include "dumper/libdumper.hh"
-#include "dumper/dumper.hh"
+#include <dumper/libdumper.hh>
+#include <dumper/dumper.hh>
namespace Ranch
{
Index: lib/cxx/src/misc/yamlize.hxx
--- lib/cxx/src/misc/yamlize.hxx (revision 26)
+++ lib/cxx/src/misc/yamlize.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_MISC_YAMLIZE_HXX
# define RANCH_MISC_YAMLIZE_HXX
-# include "misc/yamlize.hh"
+# include <misc/yamlize.hh>
namespace Ranch
{
Index: lib/cxx/src/misc/yamlize.hh
--- lib/cxx/src/misc/yamlize.hh (revision 26)
+++ lib/cxx/src/misc/yamlize.hh (working copy)
@@ -27,6 +27,6 @@
} // namespace Misc
} // namespace Ranch
-# include "misc/yamlize.hxx"
+# include <misc/yamlize.hxx>
#endif // !RANCH_MISC_YAMLIZE_HH
Index: lib/cxx/src/misc/Makefile.am
--- lib/cxx/src/misc/Makefile.am (revision 26)
+++ lib/cxx/src/misc/Makefile.am (working copy)
@@ -5,4 +5,8 @@
yamlize.hh \
yamlize.cc \
yamlize.hxx
+pkgincludedir = $(includedir)/$(PACKAGE)/misc
+pkginclude_HEADERS = \
+ yamlize.hh \
+ yamlize.hxx
Index: lib/cxx/src/dumper/yaml.hh
--- lib/cxx/src/dumper/yaml.hh (revision 26)
+++ lib/cxx/src/dumper/yaml.hh (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_YAML_HH
# define RANCH_YAML_HH
-# include "dumper/dumper.hh"
+# include <dumper/dumper.hh>
namespace Ranch
{
Index: lib/cxx/src/dumper/yaml.cc
--- lib/cxx/src/dumper/yaml.cc (revision 26)
+++ lib/cxx/src/dumper/yaml.cc (working copy)
@@ -1,5 +1,5 @@
-#include "dumper/yaml.hh"
-#include "misc/yamlize.hh"
+#include <dumper/yaml.hh>
+#include <misc/yamlize.hh>
namespace Ranch
{
Index: lib/cxx/src/dumper/all.hh
--- lib/cxx/src/dumper/all.hh (revision 26)
+++ lib/cxx/src/dumper/all.hh (working copy)
@@ -1,8 +1,8 @@
#ifndef RANCH_DUMPER_ALL_HH
# define RANCH_DUMPER_ALL_HH
-# include "dumper/dumper.hh"
-# include "dumper/yaml.hh"
+# include <dumper/dumper.hh>
+# include <dumper/yaml.hh>
#endif // !RANCH_DUMPER_ALL_HH
Index: lib/cxx/src/dumper/Makefile.am
--- lib/cxx/src/dumper/Makefile.am (revision 26)
+++ lib/cxx/src/dumper/Makefile.am (working copy)
@@ -10,4 +10,10 @@
dumper.cc \
yaml.hh \
yaml.cc
-
+pkgincludedir = $(includedir)/$(PACKAGE)/dumper
+pkginclude_HEADERS = \
+ all.hh \
+ fwd.hh \
+ libdumper.hh \
+ dumper.hh \
+ yaml.hh
Index: lib/cxx/src/dumper/dumper.hh
--- lib/cxx/src/dumper/dumper.hh (revision 26)
+++ lib/cxx/src/dumper/dumper.hh (working copy)
@@ -3,7 +3,7 @@
# define RANCH_DUMPER_HH
# include <string>
-# include "bencher.hh"
+# include <bencher.hh>
namespace Ranch
{
Index: lib/cxx/src/input/input.cc
--- lib/cxx/src/input/input.cc (revision 26)
+++ lib/cxx/src/input/input.cc (working copy)
@@ -1,4 +1,4 @@
-#include "input/input.hh"
+#include <input/input.hh>
namespace Ranch
{
Index: lib/cxx/src/input/input.hxx
--- lib/cxx/src/input/input.hxx (revision 26)
+++ lib/cxx/src/input/input.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_INPUT_INPUT_HXX
# define RANCH_INPUT_INPUT_HXX
-# include "input/input.hh"
+# include <input/input.hh>
# include <ostream>
namespace Ranch
Index: lib/cxx/src/input/Makefile.am
--- lib/cxx/src/input/Makefile.am (revision 26)
+++ lib/cxx/src/input/Makefile.am (working copy)
@@ -5,3 +5,7 @@
input.hh \
input.hxx \
input.cc
+pkgincludedir = $(includedir)/$(PACKAGE)/input
+pkginclude_HEADERS = \
+ input.hh \
+ input.hxx
Index: lib/cxx/src/input/input.hh
--- lib/cxx/src/input/input.hh (revision 26)
+++ lib/cxx/src/input/input.hh (working copy)
@@ -5,7 +5,7 @@
# include <string>
# include <iosfwd>
-# include "io.hh"
+# include <io.hh>
namespace Ranch
{
@@ -23,7 +23,7 @@
} // namespace Ranch
-# include "input/input.hxx"
+# include <input/input.hxx>
#endif // !RANCH_INPUT_INPUT_HH
Index: lib/cxx/src/output/output.cc
--- lib/cxx/src/output/output.cc (revision 26)
+++ lib/cxx/src/output/output.cc (working copy)
@@ -1,4 +1,4 @@
-#include "output/output.hh"
+#include <output/output.hh>
namespace Ranch
{
Index: lib/cxx/src/output/u-time.cc
--- lib/cxx/src/output/u-time.cc (revision 26)
+++ lib/cxx/src/output/u-time.cc (working copy)
@@ -1,4 +1,4 @@
-#include "output/u-time.hh"
+#include <output/u-time.hh>
#include <sys/times.h>
#include <cstdio>
#include <cerrno>
Index: lib/cxx/src/output/output.hxx
--- lib/cxx/src/output/output.hxx (revision 26)
+++ lib/cxx/src/output/output.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_OUTPUT_OUTPUT_HXX
# define RANCH_OUTPUT_OUTPUT_HXX
-# include "output/output.hh"
+# include <output/output.hh>
# include <ostream>
namespace Ranch
Index: lib/cxx/src/output/u-time.hxx
--- lib/cxx/src/output/u-time.hxx (revision 26)
+++ lib/cxx/src/output/u-time.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_OUTPUT_UTIME_HXX
# define RANCH_OUTPUT_UTIME_HXX
-# include "output/u-time.hh"
+# include <output/u-time.hh>
namespace Ranch
{
Index: lib/cxx/src/output/Makefile.am
--- lib/cxx/src/output/Makefile.am (revision 26)
+++ lib/cxx/src/output/Makefile.am (working copy)
@@ -9,5 +9,12 @@
u-time.hh \
u-time.hxx \
u-time.cc
+pkgincludedir = $(includedir)/$(PACKAGE)/output
+pkginclude_HEADERS = \
+ all.hh \
+ output.hh \
+ output.hxx \
+ u-time.hh \
+ u-time.hxx
Index: lib/cxx/src/output/output.hh
--- lib/cxx/src/output/output.hh (revision 26)
+++ lib/cxx/src/output/output.hh (working copy)
@@ -5,7 +5,7 @@
# include <string>
# include <iosfwd>
-# include "io.hh"
+# include <io.hh>
namespace Ranch
{
@@ -29,7 +29,7 @@
} // namespace Ranch
-# include "output/output.hxx"
+# include <output/output.hxx>
#endif // !RANCH_OUTPUT_OUTPUT_HH
Index: lib/cxx/src/output/u-time.hh
--- lib/cxx/src/output/u-time.hh (revision 26)
+++ lib/cxx/src/output/u-time.hh (working copy)
@@ -3,7 +3,7 @@
#ifndef RANCH_OUTPUT_UTIME_HH
# define RANCH_OUTPUT_UTIME_HH
-# include "output/output.hh"
+# include <output/output.hh>
namespace Ranch
{
@@ -28,7 +28,7 @@
} // namespace Output
} // namespace Ranch
-# include "output/u-time.hxx"
+# include <output/u-time.hxx>
#endif // !RANCH_OUTPUT_UTIME_HH
Index: lib/cxx/src/bencher.hh
--- lib/cxx/src/bencher.hh (revision 26)
+++ lib/cxx/src/bencher.hh (working copy)
@@ -3,11 +3,11 @@
# define RANCH_BENCH_HH
# include <string>
-# include "inputs.hh"
-# include "input/input.hh"
-# include "outputs.hh"
-# include "output/output.hh"
-# include "dumper/fwd.hh"
+# include <inputs.hh>
+# include <input/input.hh>
+# include <outputs.hh>
+# include <output/output.hh>
+# include <dumper/fwd.hh>
namespace Ranch
{
@@ -61,6 +61,6 @@
} // namespace Ranch
-# include "bencher.hxx"
+# include <bencher.hxx>
#endif // !RANCH_BENCH_HH
Index: lib/cxx/src/io.hh
--- lib/cxx/src/io.hh (revision 26)
+++ lib/cxx/src/io.hh (working copy)
@@ -31,7 +31,7 @@
} // namespace Ranch
-# include "io.hxx"
+# include <io.hxx>
#endif // !RANCH_IO_HH
Index: lib/cxx/src/Makefile.am
--- lib/cxx/src/Makefile.am (revision 26)
+++ lib/cxx/src/Makefile.am (working copy)
@@ -4,7 +4,16 @@
SUBDIRS = input output dumper misc
lib_LTLIBRARIES = libranch.la
-include_HEADERS = ranch.hh
+pkginclude_HEADERS = \
+ ranch.hh \
+ bencher.hh \
+ bencher.hxx \
+ io.hh \
+ io.hxx \
+ inputs.hh \
+ inputs.hxx \
+ outputs.hh \
+ outputs.hxx
libranch_la_SOURCES = \
bencher.hh \
bencher.hxx \
Index: lib/cxx/src/bencher.hxx
--- lib/cxx/src/bencher.hxx (revision 26)
+++ lib/cxx/src/bencher.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_BENCHER_HXX
# define RANCH_BENCHER_HXX
-# include "bencher.hh"
+# include <bencher.hh>
namespace Ranch
{
Index: lib/cxx/src/io.hxx
--- lib/cxx/src/io.hxx (revision 26)
+++ lib/cxx/src/io.hxx (working copy)
@@ -2,7 +2,7 @@
#ifndef RANCH_IO_HXX
# define RANCH_IO_HXX
-# include "io.hh"
+# include <io.hh>
# include <ostream>
namespace Ranch
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Clean the session initialization.
* web/ranch/test/functional/graph_form_controller_test.rb,
* web/ranch/test/functional/projects_controller_test.rb,
* web/ranch/app/controllers/ranch_controller.rb: No longer session
initialization since it's automaticaly done by the layout.
* web/ranch/app/views/layouts/_left_margin.rhtml: Init the session
variable if it is not.
app/controllers/ranch_controller.rb | 9 ---------
app/views/layouts/_left_margin.rhtml | 13 +++++++++++++
test/functional/graph_form_controller_test.rb | 10 ----------
test/functional/projects_controller_test.rb | 10 ----------
4 files changed, 13 insertions(+), 29 deletions(-)
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 25)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -11,16 +11,6 @@
@controller = GraphFormController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
-
- @request.session[:projects] = Project.find_by_sql "SELECT id, name " +
- "FROM projects " +
- "WHERE 1 " +
- "ORDER BY name"
- @request.session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
- "FROM benches " +
- "WHERE 1 " +
- "GROUP BY name " +
- "ORDER BY project_id, name"
end
def test_index
Index: web/ranch/test/functional/projects_controller_test.rb
--- web/ranch/test/functional/projects_controller_test.rb (revision 25)
+++ web/ranch/test/functional/projects_controller_test.rb (working copy)
@@ -11,16 +11,6 @@
@controller = ProjectsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
-
- @request.session[:projects] = Project.find_by_sql "SELECT id, name " +
- "FROM projects " +
- "WHERE 1 " +
- "ORDER BY name"
- @request.session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
- "FROM benches " +
- "WHERE 1 " +
- "GROUP BY name " +
- "ORDER BY project_id, name"
end
def test_show
Index: web/ranch/app/controllers/ranch_controller.rb
--- web/ranch/app/controllers/ranch_controller.rb (revision 25)
+++ web/ranch/app/controllers/ranch_controller.rb (working copy)
@@ -3,15 +3,6 @@
layout 'ranch_benches_list'
def index
- session[:projects] = Project.find_by_sql "SELECT id, name " +
- "FROM projects " +
- "WHERE 1 " +
- "ORDER BY name"
- session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
- "FROM benches " +
- "WHERE 1 " +
- "GROUP BY name " +
- "ORDER BY project_id, name"
end
end
Index: web/ranch/app/views/layouts/_left_margin.rhtml
--- web/ranch/app/views/layouts/_left_margin.rhtml (revision 25)
+++ web/ranch/app/views/layouts/_left_margin.rhtml (working copy)
@@ -1,4 +1,17 @@
<!-- -*- html -*- -->
+<%
+ if session[:projects].nil? or session[:benches].nil?
+ session[:projects] = Project.find_by_sql "SELECT id, name " +
+ "FROM projects " +
+ "WHERE 1 " +
+ "ORDER BY name"
+ session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
+ "FROM benches " +
+ "WHERE 1 " +
+ "GROUP BY name " +
+ "ORDER BY project_id, name"
+ end
+%>
<table>
<% for project in session[:projects] %>
<tr>
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Change layout.
* web/ranch/test/functional/ranch_controller_test.rb: New. Controller
of the main layout.
* web/ranch/test/functional/graph_form_controller_test.rb: Add
session fixtures.
* web/ranch/test/functional/projects_controller_test.rb: Test the
show request.
* web/ranch/app/helpers/ranch_helper.rb: New.
* web/ranch/app/controllers/ranch_controller.rb: New. Init the
session variable.
* web/ranch/app/controllers/graph_form_controller.rb: Use the
ranch_benches_list layout.
* web/ranch/app/controllers/projects_controller.rb: Add the show
request and remove index and list.
* web/ranch/app/views/layouts/ranch.rhtml: Layout without the the
left margin.
* web/ranch/app/views/layouts/ranch_benches_list.rhtml: New. Layout
with the left margin.
* web/ranch/app/views/layouts/_head.rhtml,
* web/ranch/app/views/layouts/_banner.rhtml,
* web/ranch/app/views/layouts/_left_margin.rhtml,
* web/ranch/app/views/layouts/_top_banner.rhtml,
* web/ranch/app/views/layouts/_menubar.rhtml,
* web/ranch/app/views/layouts/_bottom_banner.rhtml: New. Part of the
layout.
* web/ranch/app/views/graph_form/index.rhtml: Update to the new
layout.
* web/ranch/app/views/projects/list.rhtml: Remove. Useless since
the list is available in the main layout.
* web/ranch/app/views/projects/show.rhtml: New. Display project's
properties.
* web/ranch/app/views/ranch: New.
* web/ranch/app/views/ranch/_welcome.rhtml: New. The home page.
* web/ranch/app/views/ranch/index.rhtml: New. Main page.
* web/ranch/config/routes.rb: First page is RanchController#index.
* web/ranch/test/functional/benches_controller_test.rb,
* web/ranch/app/helpers/benches_helper.rb,
* web/ranch/app/controllers/benches_controller.rb,
* web/ranch/app/views/benches,
* web/ranch/app/views/benches/list.rhtml: Remove. Useless since this
list is available in the layout.
app/controllers/graph_form_controller.rb | 2 -
app/controllers/projects_controller.rb | 11 +-----
app/controllers/ranch_controller.rb | 17 +++++++++
app/helpers/ranch_helper.rb | 2 +
app/views/graph_form/index.rhtml | 46 +++++++++++---------------
app/views/layouts/_banner.rhtml | 5 ++
app/views/layouts/_bottom_banner.rhtml | 6 +++
app/views/layouts/_head.rhtml | 6 +++
app/views/layouts/_left_margin.rhtml | 28 +++++++++++++++
app/views/layouts/_menubar.rhtml | 12 ++++++
app/views/layouts/_top_banner.rhtml | 5 ++
app/views/layouts/ranch.rhtml | 16 ++-------
app/views/layouts/ranch_benches_list.rhtml | 28 +++++++++++++++
app/views/projects/show.rhtml | 12 ++++++
app/views/ranch/_welcome.rhtml | 6 +++
app/views/ranch/index.rhtml | 3 +
config/routes.rb | 2 -
test/functional/graph_form_controller_test.rb | 10 +++++
test/functional/projects_controller_test.rb | 24 +++++++------
test/functional/ranch_controller_test.rb | 18 ++++++++++
20 files changed, 201 insertions(+), 58 deletions(-)
Index: web/ranch/test/functional/ranch_controller_test.rb
--- web/ranch/test/functional/ranch_controller_test.rb (revision 0)
+++ web/ranch/test/functional/ranch_controller_test.rb (revision 0)
@@ -0,0 +1,18 @@
+require File.dirname(__FILE__) + '/../test_helper'
+require 'ranch_controller'
+
+# Re-raise errors caught by the controller.
+class RanchController; def rescue_action(e) raise e end; end
+
+class RanchControllerTest < Test::Unit::TestCase
+ def setup
+ @controller = RanchController.new
+ @request = ActionController::TestRequest.new
+ @response = ActionController::TestResponse.new
+ end
+
+ # Replace this with your real tests.
+ def test_truth
+ assert true
+ end
+end
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 24)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -11,6 +11,16 @@
@controller = GraphFormController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
+
+ @request.session[:projects] = Project.find_by_sql "SELECT id, name " +
+ "FROM projects " +
+ "WHERE 1 " +
+ "ORDER BY name"
+ @request.session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
+ "FROM benches " +
+ "WHERE 1 " +
+ "GROUP BY name " +
+ "ORDER BY project_id, name"
end
def test_index
Index: web/ranch/test/functional/projects_controller_test.rb
--- web/ranch/test/functional/projects_controller_test.rb (revision 24)
+++ web/ranch/test/functional/projects_controller_test.rb (working copy)
@@ -11,21 +11,23 @@
@controller = ProjectsController.new
@request = ActionController::TestRequest.new
@response = ActionController::TestResponse.new
- end
- def test_index
- get :index
- assert_response :success
- assert_template 'list'
+ @request.session[:projects] = Project.find_by_sql "SELECT id, name " +
+ "FROM projects " +
+ "WHERE 1 " +
+ "ORDER BY name"
+ @request.session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
+ "FROM benches " +
+ "WHERE 1 " +
+ "GROUP BY name " +
+ "ORDER BY project_id, name"
end
- def test_list
- get :list
-
+ def test_show
+ get :show, { :project_id => 1 }
assert_response :success
- assert_template 'list'
-
- assert_not_nil assigns(:projects)
+ assert_template 'show'
+ assert_not_nil assigns(:project)
end
end
Index: web/ranch/app/helpers/ranch_helper.rb
--- web/ranch/app/helpers/ranch_helper.rb (revision 0)
+++ web/ranch/app/helpers/ranch_helper.rb (revision 0)
@@ -0,0 +1,2 @@
+module RanchHelper
+end
Index: web/ranch/app/controllers/ranch_controller.rb
--- web/ranch/app/controllers/ranch_controller.rb (revision 0)
+++ web/ranch/app/controllers/ranch_controller.rb (revision 0)
@@ -0,0 +1,17 @@
+class RanchController < ApplicationController
+
+ layout 'ranch_benches_list'
+
+ def index
+ session[:projects] = Project.find_by_sql "SELECT id, name " +
+ "FROM projects " +
+ "WHERE 1 " +
+ "ORDER BY name"
+ session[:benches] = Bench.find_by_sql "SELECT id, name, project_id " +
+ "FROM benches " +
+ "WHERE 1 " +
+ "GROUP BY name " +
+ "ORDER BY project_id, name"
+ end
+
+end
Index: web/ranch/app/controllers/graph_form_controller.rb
--- web/ranch/app/controllers/graph_form_controller.rb (revision 24)
+++ web/ranch/app/controllers/graph_form_controller.rb (working copy)
@@ -1,7 +1,7 @@
class GraphFormController < ApplicationController
helper :graph, :graph_form
- layout 'ranch'
+ layout 'ranch_benches_list'
DEFAULT_REVISION_RANGE = 100
Index: web/ranch/app/controllers/projects_controller.rb
--- web/ranch/app/controllers/projects_controller.rb (revision 24)
+++ web/ranch/app/controllers/projects_controller.rb (working copy)
@@ -1,14 +1,9 @@
class ProjectsController < ApplicationController
- layout 'ranch'
+ layout 'ranch_benches_list'
- def index
- list
- render :action => 'list'
- end
-
- def list
- @projects = Project.find_all
+ def show
+ @project = Project.find_by_id params[:project_id]
end
end
Index: web/ranch/app/views/layouts/ranch.rhtml
--- web/ranch/app/views/layouts/ranch.rhtml (revision 24)
+++ web/ranch/app/views/layouts/ranch.rhtml (working copy)
@@ -1,21 +1,13 @@
<!-- -*- html -*- -->
<html>
- <head>
- <title>Ranch: regression benchmark system</title>
- <%= stylesheet_link_tag 'scaffold' %>
- </head>
+ <%= render :partial => "layouts/head" %>
<body>
- <div style="text-align: center;">
- <h1>Ranch</h1>
- <hr>
- </div>
+ <%= render :partial => "layouts/top_banner" %>
+ <%= render :partial => "layouts/menubar" %>
<%= @content_for_layout %>
- <div style="text-align: center;">
- <hr>
- Powered by RubyOnRails
- </div>
+ <%= render :partial => "layouts/bottom_banner" %>
</body>
</html>
Index: web/ranch/app/views/layouts/ranch_benches_list.rhtml
--- web/ranch/app/views/layouts/ranch_benches_list.rhtml (revision 0)
+++ web/ranch/app/views/layouts/ranch_benches_list.rhtml (revision 0)
@@ -0,0 +1,28 @@
+ <!-- -*- html -*- -->
+
+<html>
+ <%= render :partial => "layouts/head" %>
+ <body>
+ <%= render :partial => "layouts/top_banner" %>
+ <%= render :partial => "layouts/menubar" %>
+
+ <p>
+ <table cellspacing=0 cellpadding=0 border=0 width='100%' height="80%" cols=2>
+ <tr>
+ <td class=left_margin valign=top width="15%">
+ <%= render :partial => "layouts/left_margin" %>
+ </td>
+ <td class=content align=left valign=top width="80%">
+
+ <%= @content_for_layout %>
+
+ </td>
+ </tr>
+ </table>
+ </p>
+
+ <%= render :partial => "layouts/bottom_banner" %>
+ </body>
+</html>
+
+
Index: web/ranch/app/views/layouts/_head.rhtml
--- web/ranch/app/views/layouts/_head.rhtml (revision 0)
+++ web/ranch/app/views/layouts/_head.rhtml (revision 0)
@@ -0,0 +1,6 @@
+ <!-- -*- html -*- -->
+
+<head>
+ <title>Ranch: regression benchmark system</title>
+ <%= stylesheet_link_tag 'scaffold' %>
+</head>
Index: web/ranch/app/views/layouts/_banner.rhtml
--- web/ranch/app/views/layouts/_banner.rhtml (revision 0)
+++ web/ranch/app/views/layouts/_banner.rhtml (revision 0)
@@ -0,0 +1,5 @@
+ <!-- -*- html -*- -->
+<div style="text-align: center;">
+ <h1>Ranch</h1>
+ <hr>
+</div>
Index: web/ranch/app/views/layouts/_left_margin.rhtml
--- web/ranch/app/views/layouts/_left_margin.rhtml (revision 0)
+++ web/ranch/app/views/layouts/_left_margin.rhtml (revision 0)
@@ -0,0 +1,28 @@
+ <!-- -*- html -*- -->
+<table>
+ <% for project in session[:projects] %>
+ <tr>
+ <td><%= link_to project.name, :controller => "projects",
+ :action => "show",
+ :project_id => project.id %></td>
+ </tr>
+ <tr>
+ <td>
+ <table>
+ <% for bench in session[:benches] %>
+ <% if bench.project_id == project.id %>
+ <tr>
+ <td width=10>
+ </td>
+ <td>
+ <%= link_to bench.name, :controller => "graph_form",
+ :action => "index",
+ :project_id => project.id,
+ :bench_name => bench.name %>
+ </td>
+ </tr>
+ <% end %>
+ <% end %>
+ </table>
+ <% end %>
+</table>
Index: web/ranch/app/views/layouts/_top_banner.rhtml
--- web/ranch/app/views/layouts/_top_banner.rhtml (revision 0)
+++ web/ranch/app/views/layouts/_top_banner.rhtml (revision 0)
@@ -0,0 +1,5 @@
+ <!-- -*- html -*- -->
+<div style="text-align: center;">
+ <h1>Ranch</h1>
+ <hr>
+</div>
Index: web/ranch/app/views/layouts/_menubar.rhtml
--- web/ranch/app/views/layouts/_menubar.rhtml (revision 0)
+++ web/ranch/app/views/layouts/_menubar.rhtml (revision 0)
@@ -0,0 +1,12 @@
+ <!-- -*- html -*- -->
+
+<div style="text-align: center;">
+<table class=menubar align=center valign=top>
+ <tr>
+ <td>
+ <%= link_to "Home", :controller => "ranch", :action => "index" %>
+ </td>
+ </tr>
+</table>
+<hr>
+</div>
Index: web/ranch/app/views/layouts/_bottom_banner.rhtml
--- web/ranch/app/views/layouts/_bottom_banner.rhtml (revision 0)
+++ web/ranch/app/views/layouts/_bottom_banner.rhtml (revision 0)
@@ -0,0 +1,6 @@
+ <!-- -*- html -*- -->
+
+<div style="text-align: center;">
+ <hr>
+ Powered by RubyOnRails
+</div>
Index: web/ranch/app/views/graph_form/index.rhtml
--- web/ranch/app/views/graph_form/index.rhtml (revision 24)
+++ web/ranch/app/views/graph_form/index.rhtml (working copy)
@@ -1,39 +1,36 @@
<!-- -*- html -*- -->
-<div style="text-align: center;">
-<%= content_tag "h2", "#{(a)project.name}: #{@bench_name}" %>
+<%= content_tag "h3", "#{(a)project.name}: #{@bench_name}" %>
<%= start_form_tag :action => "draw",
:project_id => @project.id,
:bench_name => @bench_name %>
-</div>
-<p>
-<center>
-<p>
+
+<table cellspacing=10>
<!-- REVISION -->
-<p>
-<table>
- <tr>
- <td></td>
- <td>Start</td>
- <td>Stop</td>
- </tr>
<tr>
<td>Revision:</td>
+ <td>
+ <table>
+ <tr>
+ <td>from</td>
<td><%= text_field "revision", "start", "size" => 8,
"value" => @revision[:start] %></td>
+ <td>to</td>
<td><%= text_field "revision", "stop", "size" => 8,
"value" => @revision[:stop] %></td>
</tr>
</table>
-</p>
+ </td>
+</tr>
<!-- INPUTS -->
-<p>
+<tr>
+ <td>Inputs:</td>
+ <td>
<table>
<tr>
- <td>Inputs</td>
<td>
<select id="input_set_num" name="input_set_num">
<% i = 0
@@ -53,21 +50,25 @@
</td>
</tr>
</table>
-</p>
+ </td>
+</tr>
<!-- OUTPUTS -->
-<p>
-<table>
<tr>
<td>Output:</td>
+ <td>
+ <table>
+ <tr>
<td><%= outputs_tag "output_arg_num", @bench_name, @output_arg_num %></td>
</tr>
+ </td>
</table>
-</p>
+</tr>
<!-- SUBMIT BUTTON -->
+</table>
</p>
<p style="color: red;"><%= flash[:error] %></p>
<p><%= submit_tag "Draw" %></p>
@@ -94,9 +95,4 @@
<% else %>
<%= content_tag "p", "No chart to display - click on Draw" %>
<% end %>
-</p>
-</center></p>
-<p><%= link_to "Back", :controller => "benches",
- :action => "list",
- :project_id => @project.id %></p>
Index: web/ranch/app/views/projects/show.rhtml
--- web/ranch/app/views/projects/show.rhtml (revision 0)
+++ web/ranch/app/views/projects/show.rhtml (revision 0)
@@ -0,0 +1,12 @@
+ <!-- -*- html -*- -->
+
+<%= content_tag "h3", "#{(a)project.name}" %>
+
+<p>
+<table>
+ <tr>
+ <td>Head revision:</td>
+ <td><%= @project.head_revision %></td>
+ </tr>
+</table>
+</p>
Index: web/ranch/app/views/ranch/_welcome.rhtml
--- web/ranch/app/views/ranch/_welcome.rhtml (revision 0)
+++ web/ranch/app/views/ranch/_welcome.rhtml (revision 0)
@@ -0,0 +1,6 @@
+ <!-- -*- html -*- -->
+
+<h1>Welcome</h1>
+<p>
+Ranch is a regression benchmark system.
+</p>
Index: web/ranch/app/views/ranch/index.rhtml
--- web/ranch/app/views/ranch/index.rhtml (revision 0)
+++ web/ranch/app/views/ranch/index.rhtml (revision 0)
@@ -0,0 +1,3 @@
+ <!-- -*- html -*- -->
+
+<%= render :partial => "welcome" %>
Index: web/ranch/config/routes.rb
--- web/ranch/config/routes.rb (revision 24)
+++ web/ranch/config/routes.rb (working copy)
@@ -8,7 +8,7 @@
# You can have the root of your site routed by hooking up ''
# -- just remember to delete public/index.html.
- map.connect '', :controller => "projects"
+ map.connect '', :controller => "ranch"
# Allow downloading Web Service WSDL as a file with an extension
# instead of a file named 'wsdl'
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Map an inputs set to an outputs set.
* web/ranch/test/functional/graph_form_controller_test.rb: Test that
the input_set_num is set.
* web/ranch/test/fixtures/inputs.yml: Clean up the code.
* web/ranch/test/fixtures/outputs.yml: More "realistic" value.
* web/ranch/test/fixtures/benches.yml: Add a revision number to all
the benches.
* web/ranch/app/helpers/graph_helper.rb: Pass the input set number
to the grapher.
* web/ranch/app/controllers/graph_controller.rb,
* web/ranch/app/controllers/graph_form_controller.rb: Exploit the
input set number.
* web/ranch/app/views/graph_form/index.rhtml: Add a drop down box
filled with all the input set.
* web/ranch/db/schema.rb: Add a set_num filed to the inputs and
outputs table.
app/controllers/graph_controller.rb | 1
app/controllers/graph_form_controller.rb | 8 +-
app/helpers/graph_helper.rb | 4 +
app/views/graph_form/index.rhtml | 75 ++++++++++++++++----------
db/schema.rb | 4 +
test/fixtures/benches.yml | 4 +
test/fixtures/inputs.yml | 26 +++++----
test/fixtures/outputs.yml | 27 ++++-----
test/functional/graph_form_controller_test.rb | 6 +-
9 files changed, 98 insertions(+), 57 deletions(-)
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 23)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -41,6 +41,7 @@
assert_not_nil assigns(:bench_name)
assert_not_nil assigns(:output_arg_num)
assert_not_nil assigns(:inputs)
+ assert_not_nil assigns(:input_set_num)
assert_kind_of Hash, assigns(:revision)
assert_equal 2, assigns(:revision)[:start]
assert_equal 8, assigns(:revision)[:stop]
@@ -60,6 +61,7 @@
assert_not_nil assigns(:bench_name)
assert_not_nil assigns(:output_arg_num)
assert_not_nil assigns(:inputs)
+ assert_not_nil assigns(:input_set_num)
assert_kind_of Hash, assigns(:revision)
assert_equal 1, assigns(:revision)[:start]
assert_equal assigns(:project).head_revision, assigns(:revision)[:stop]
@@ -77,9 +79,10 @@
assert_equal 1, assigns(:project).id
assert_equal 'determinize', assigns(:bench_name)
- assert flash.has_key? :error
+ assert(flash.has_key?(:error))
assert_not_nil assigns(:output_arg_num)
assert_not_nil assigns(:inputs)
+ assert_not_nil assigns(:input_set_num)
end
def test_draw_output_arg_num
@@ -97,6 +100,7 @@
assert_equal 0, assigns(:output_arg_num)
assert_equal 3, assigns(:output_arg_nb)
assert_not_nil assigns(:inputs)
+ assert_not_nil assigns(:input_set_num)
end
end
Index: web/ranch/test/fixtures/inputs.yml
--- web/ranch/test/fixtures/inputs.yml (revision 23)
+++ web/ranch/test/fixtures/inputs.yml (working copy)
@@ -1,27 +1,33 @@
<% id = 0 %>
-<% (1..10).each do |rev| %>
+# Generate a set of determinize inputs.
+
+<% (1..10).each do |bench_id| %>
<% val = 2
- while val <= 256 do %>
+ set_num = 0
+ while set_num < 4 do %>
-<% arg_num = 0
+ <% arg_num = 1
{
'nb_states' => '',
'nb_transition' => '',
'foo' => 'unit_foo'
}.each do |name, unit| %>
-<%= "determinize_r#{rev}_#{name}_#{val}:" %>
+<%= "determinize_r#{bench_id}_#{name}_#{set_num}:" %>
id: <%= id += 1 %>
name: <%= name %>
unit: <%= unit.inspect %>
value: <%= val %>
- bench_id: <%= rev %>
- arg_num: <%= arg_num += 1 %>
-
-<% end
- val *= 2 %>
-<% end %>
+ bench_id: <%= bench_id %>
+ arg_num: <%= arg_num %>
+ set_num: <%= set_num %>
+
+ <% arg_num += 1
+ end %>
+ <% val *= 2
+ set_num += 1
+ end %>
<% end %>
Index: web/ranch/test/fixtures/outputs.yml
--- web/ranch/test/fixtures/outputs.yml (revision 23)
+++ web/ranch/test/fixtures/outputs.yml (working copy)
@@ -1,28 +1,29 @@
<% id = 0 %>
-<% val = 5
+<% outputs = {
+ 'utime' => { :unit => 'sec', :val => 20, :inc => -1 },
+ 'memory' => { :unit => 'KB', :val => 50000, :inc => -1000 },
+ 'nb_states' => { :unit => '', :val => 5, :inc => 42 },
+ }
(1..10).each do |rev| %>
-<% input = 2
- while input <= 256 do %>
+ <% set_num = 0
+ while set_num < 4 do %>
<% arg_num = 0
- {
- 'utime' => 'sec',
- 'memory' => 'KB',
- 'nb_states' => ''
- }.each do |name, unit| %>
+ outputs.each do |name, desc| %>
-<%= "determinize_r#{rev}_#{name}:" %>
+<%= "determinize_r#{rev}_#{name}_#{set_num}:" %>
id: <%= id += 1 %>
name: <%= name %>
- unit: <%= unit.inspect %>
- value: <%= val += input + rev + name.size %>
+ unit: <%= desc[:unit].inspect %>
+ value: <%= desc[:val] += desc[:inc] + set_num * 10%>
bench_id: <%= rev %>
arg_num: <%= arg_num += 1 %>
+ set_num: <%= set_num %>
-<% end
- input *= 2 %>
<% end %>
+ <% set_num += 1
+ end %>
<% end %>
Index: web/ranch/test/fixtures/benches.yml
--- web/ranch/test/fixtures/benches.yml (revision 23)
+++ web/ranch/test/fixtures/benches.yml (working copy)
@@ -13,13 +13,17 @@
id: <%= id += 1 %>
project_id: 1
name: quotient
+ revision: 1
open:
id: <%= id += 1 %>
project_id: 2
name: open
+ revision: 1
+
close:
id: <%= id += 1 %>
project_id: 2
name: close
+ revision: 1
Index: web/ranch/app/helpers/graph_helper.rb
--- web/ranch/app/helpers/graph_helper.rb (revision 23)
+++ web/ranch/app/helpers/graph_helper.rb (working copy)
@@ -5,6 +5,7 @@
rev_start,
rev_stop,
arg_num,
+ input_set_num,
options={})
url = {
:controller => 'graph',
@@ -13,7 +14,8 @@
:bench_name => bench_name,
:rev_start => rev_start,
:rev_stop => rev_stop,
- :arg_num => arg_num
+ :arg_num => arg_num,
+ :input_set_num => input_set_num
}
options = url.merge(options)
"<img src=\"#{url_for options}\" " +
Index: web/ranch/app/controllers/graph_controller.rb
--- web/ranch/app/controllers/graph_controller.rb (revision 23)
+++ web/ranch/app/controllers/graph_controller.rb (working copy)
@@ -13,6 +13,7 @@
"AND benches.name = '#@bench_name' " +
"AND outputs.bench_id = benches.id " +
"AND outputs.arg_num = #{params[:arg_num]} " +
+ "AND outputs.set_num = #{params[:input_set_num]} " +
"AND #{params[:rev_start]} <= benches.revision " +
"AND benches.revision <= #{params[:rev_stop]} " +
"ORDER BY benches.revision"
Index: web/ranch/app/controllers/graph_form_controller.rb
--- web/ranch/app/controllers/graph_form_controller.rb (revision 23)
+++ web/ranch/app/controllers/graph_form_controller.rb (working copy)
@@ -9,6 +9,7 @@
@bench_name = params[:bench_name]
@project = Project.find params[:project_id]
select_inputs
+ @intput_set_num = 0
@output_arg_num = 0
@draw_on = false
@revision = {}
@@ -22,6 +23,7 @@
@project = Project.find params[:project_id]
@draw_on = true
select_inputs
+ @input_set_num = params[:input_set_num].to_i
@output_arg_num = params[:output_arg_num].to_i
if @output_arg_num.zero?
@output_arg_nb = Output.find_by_sql "SELECT outputs.arg_num " +
@@ -29,11 +31,11 @@
"WHERE benches.project_id = #{(a)project.id} " +
"AND benches.name = '#@bench_name' " +
"AND outputs.bench_id = benches.id " +
+ "AND outputs.set_num = #@input_set_num " +
"GROUP BY outputs.arg_num " +
"ORDER BY outputs.arg_num "
@output_arg_nb = @output_arg_nb.size
end
-
@revision = params[:revision]
head_rev = @project.head_revision
@revision[:stop] = @revision[:stop].to_i
@@ -56,12 +58,12 @@
def select_inputs
@inputs = Input.find_by_sql "SELECT inputs.name, inputs.unit, " +
- "inputs.value, inputs.arg_num " +
+ "inputs.value, inputs.arg_num, inputs.set_num " +
"FROM inputs, benches " +
"WHERE benches.id = #{(a)project.id} " +
"AND benches.name = '#@bench_name' " +
"AND benches.id = inputs.bench_id " +
- "ORDER BY inputs.arg_num"
+ "ORDER BY inputs.set_num, inputs.arg_num"
end
end
Index: web/ranch/app/views/graph_form/index.rhtml
--- web/ranch/app/views/graph_form/index.rhtml (revision 23)
+++ web/ranch/app/views/graph_form/index.rhtml (working copy)
@@ -8,6 +8,9 @@
<p>
<center>
<p>
+
+<!-- REVISION -->
+
<p>
<table>
<tr>
@@ -23,61 +26,77 @@
"value" => @revision[:stop] %></td>
</tr>
</table>
-</p><p>
-<table>
- <tr>
- <td>Output:</td>
- <td><%= outputs_tag "output_arg_num", @bench_name, @output_arg_num %></td>
- </tr>
-</table>
-</p><p>
+</p>
+
+<!-- INPUTS -->
+
+<p>
<table>
<tr>
<td>Inputs</td>
- <td>Value</td>
- </tr>
- <% arg_num = 1
- i = 0
- while i < @inputs.size do %>
- <tr>
- <%= content_tag "td", "#{@inputs[i].name}(#{@inputs[i].unit})" %>
<td>
- <select id="#{(a)inputs[i].name}" name="#{(a)inputs[i].name}">
- <% while i < @inputs.size and arg_num == @inputs[i].arg_num do %>
- <%= content_tag "option", @inputs[i].value.to_s,
- :value => @inputs[i].value.to_s %>
-
- <% i += 1
- end
- arg_num += 1 %>
+ <select id="input_set_num" name="input_set_num">
+ <% i = 0
+ set_num = 0
+ while i < @inputs.size do
+ option_caption = ""
+ while i < @inputs.size and set_num == @inputs[i].set_num do
+ option_caption += "#{(a)inputs[i].name} #{(a)inputs[i].value} #{(a)inputs[i].unit}, "
+ i += 1
+ end %>
+ <% option_opt = { :value => set_num }
+ option_opt[:selected] = "selected" if set_num == @input_set_num %>
+ <%= content_tag "option", option_caption, option_opt %>
+ <% set_num += 1
+ end %>
</select>
</td>
</tr>
- <% end %>
</table>
</p>
+
+<!-- OUTPUTS -->
+
+<p>
+<table>
+ <tr>
+ <td>Output:</td>
+ <td><%= outputs_tag "output_arg_num", @bench_name, @output_arg_num %></td>
+ </tr>
+</table>
+</p>
+
+<!-- SUBMIT BUTTON -->
+
</p>
<p style="color: red;"><%= flash[:error] %></p>
<p><%= submit_tag "Draw" %></p>
-<p>
<%= end_form_tag %>
+
+<!-- DRAWING -->
+
+<p>
<% if @draw_on %>
<% if @output_arg_num.zero? %>
<% 1.upto(@output_arg_nb) do |i| %>
<p>
<%= graph_reg_tag @project.id, @bench_name,
- @revision[:start], @revision[:stop], i %>
+ @revision[:start], @revision[:stop],
+ i, @input_set_num %>
</p>
<% end %>
<% else %>
<%= graph_reg_tag @project.id, @bench_name,
- @revision[:start], @revision[:stop], @output_arg_num %>
+ @revision[:start], @revision[:stop],
+ @output_arg_num, @input_set_num %>
<% end %>
<% else %>
<%= content_tag "p", "No chart to display - click on Draw" %>
<% end %>
-</p></center></p>
+</p>
+
+</center></p>
<p><%= link_to "Back", :controller => "benches",
:action => "list",
:project_id => @project.id %></p>
Index: web/ranch/db/schema.rb
--- web/ranch/db/schema.rb (revision 23)
+++ web/ranch/db/schema.rb (working copy)
@@ -17,7 +17,8 @@
t.column "unit", :string, :limit => 128, :default => "nounit", :null => false
t.column "value", :float, :default => 0.0, :null => false
t.column "bench_id", :integer, :default => 0, :null => false
- t.column "arg_num", :integer, :limit => 8, :default => 0, :null => false
+ t.column "arg_num", :integer, :limit => 8, :default => 1, :null => false
+ t.column "set_num", :integer, :default => 0, :null => false
end
create_table "outputs", :force => true do |t|
@@ -26,6 +27,7 @@
t.column "unit", :string, :limit => 128, :default => "nounit", :null => false
t.column "bench_id", :integer, :default => 0, :null => false
t.column "arg_num", :integer, :limit => 8, :default => 1, :null => false
+ t.column "set_num", :integer, :default => 0, :null => false
end
add_index "outputs", ["bench_id"], :name => "bench_id"
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Add inputs value in the graph form.
* web/ranch/test/functional/graph_form_controller_test.rb: Test it.
* web/ranch/test/fixtures/inputs.yml,
* web/ranch/test/fixtures/outputs.yml: Generate data for a bench
with several run.
* web/ranch/app/controllers/graph_form_controller.rb: Select inputs
from the inputs table.
* web/ranch/app/views/graph_form/index.rhtml: Display inputs.
app/controllers/graph_form_controller.rb | 18 ++++++++++++-
app/views/graph_form/index.rhtml | 36 +++++++++++++++++++++++++-
test/fixtures/inputs.yml | 18 +++++++------
test/fixtures/outputs.yml | 17 +++++++-----
test/functional/graph_form_controller_test.rb | 9 ++++++
5 files changed, 83 insertions(+), 15 deletions(-)
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 22)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -20,6 +20,8 @@
assert_not_nil assigns(:project)
assert_not_nil assigns(:bench_name)
+ assert_not_nil assigns(:output_arg_num)
+ assert_not_nil assigns(:inputs)
assert !assigns(:draw_on)
assert_kind_of Hash, assigns(:revision)
assert assigns(:revision)[:start] < assigns(:revision)[:stop]
@@ -37,6 +39,8 @@
assert_not_nil assigns(:project)
assert_not_nil assigns(:bench_name)
+ assert_not_nil assigns(:output_arg_num)
+ assert_not_nil assigns(:inputs)
assert_kind_of Hash, assigns(:revision)
assert_equal 2, assigns(:revision)[:start]
assert_equal 8, assigns(:revision)[:stop]
@@ -54,6 +58,8 @@
assert_not_nil assigns(:project)
assert_not_nil assigns(:bench_name)
+ assert_not_nil assigns(:output_arg_num)
+ assert_not_nil assigns(:inputs)
assert_kind_of Hash, assigns(:revision)
assert_equal 1, assigns(:revision)[:start]
assert_equal assigns(:project).head_revision, assigns(:revision)[:stop]
@@ -72,6 +78,8 @@
assert_equal 1, assigns(:project).id
assert_equal 'determinize', assigns(:bench_name)
assert flash.has_key? :error
+ assert_not_nil assigns(:output_arg_num)
+ assert_not_nil assigns(:inputs)
end
def test_draw_output_arg_num
@@ -88,6 +96,7 @@
assert_equal 'determinize', assigns(:bench_name)
assert_equal 0, assigns(:output_arg_num)
assert_equal 3, assigns(:output_arg_nb)
+ assert_not_nil assigns(:inputs)
end
end
Index: web/ranch/test/fixtures/inputs.yml
--- web/ranch/test/fixtures/inputs.yml (revision 22)
+++ web/ranch/test/fixtures/inputs.yml (working copy)
@@ -1,5 +1,10 @@
<% id = 0 %>
+<% (1..10).each do |rev| %>
+
+<% val = 2
+ while val <= 256 do %>
+
<% arg_num = 0
{
'nb_states' => '',
@@ -7,17 +12,16 @@
'foo' => 'unit_foo'
}.each do |name, unit| %>
-<% val = 2
- arg_num += 1
- (1..10).each do |rev| %>
-
-<%= "determinize_r#{rev}_#{name}:" %>
+<%= "determinize_r#{rev}_#{name}_#{val}:" %>
id: <%= id += 1 %>
name: <%= name %>
- value: <%= val *= 2 %>
unit: <%= unit.inspect %>
+ value: <%= val %>
bench_id: <%= rev %>
- arg_num: <%= arg_num %>
+ arg_num: <%= arg_num += 1 %>
+
+<% end
+ val *= 2 %>
<% end %>
<% end %>
Index: web/ranch/test/fixtures/outputs.yml
--- web/ranch/test/fixtures/outputs.yml (revision 22)
+++ web/ranch/test/fixtures/outputs.yml (working copy)
@@ -1,5 +1,11 @@
<% id = 0 %>
+<% val = 5
+ (1..10).each do |rev| %>
+
+<% input = 2
+ while input <= 256 do %>
+
<% arg_num = 0
{
'utime' => 'sec',
@@ -7,17 +13,16 @@
'nb_states' => ''
}.each do |name, unit| %>
-<% val = 5
- arg_num += 1
- (1..10).each do |rev| %>
-
<%= "determinize_r#{rev}_#{name}:" %>
id: <%= id += 1 %>
name: <%= name %>
- value: <%= val += rev + name.size %>
unit: <%= unit.inspect %>
+ value: <%= val += input + rev + name.size %>
bench_id: <%= rev %>
- arg_num: <%= arg_num %>
+ arg_num: <%= arg_num += 1 %>
+
+<% end
+ input *= 2 %>
<% end %>
<% end %>
Index: web/ranch/app/controllers/graph_form_controller.rb
--- web/ranch/app/controllers/graph_form_controller.rb (revision 22)
+++ web/ranch/app/controllers/graph_form_controller.rb (working copy)
@@ -8,6 +8,7 @@
def index
@bench_name = params[:bench_name]
@project = Project.find params[:project_id]
+ select_inputs
@output_arg_num = 0
@draw_on = false
@revision = {}
@@ -19,6 +20,8 @@
def draw
@bench_name = params[:bench_name]
@project = Project.find params[:project_id]
+ @draw_on = true
+ select_inputs
@output_arg_num = params[:output_arg_num].to_i
if @output_arg_num.zero?
@output_arg_nb = Output.find_by_sql "SELECT outputs.arg_num " +
@@ -30,7 +33,7 @@
"ORDER BY outputs.arg_num "
@output_arg_nb = @output_arg_nb.size
end
- @draw_on = true
+
@revision = params[:revision]
head_rev = @project.head_revision
@revision[:stop] = @revision[:stop].to_i
@@ -48,4 +51,17 @@
:bench_name => @bench_name)
end
end
+
+ protected
+
+ def select_inputs
+ @inputs = Input.find_by_sql "SELECT inputs.name, inputs.unit, " +
+ "inputs.value, inputs.arg_num " +
+ "FROM inputs, benches " +
+ "WHERE benches.id = #{(a)project.id} " +
+ "AND benches.name = '#@bench_name' " +
+ "AND benches.id = inputs.bench_id " +
+ "ORDER BY inputs.arg_num"
+ end
+
end
Index: web/ranch/app/views/graph_form/index.rhtml
--- web/ranch/app/views/graph_form/index.rhtml (revision 22)
+++ web/ranch/app/views/graph_form/index.rhtml (working copy)
@@ -4,24 +4,58 @@
<%= start_form_tag :action => "draw",
:project_id => @project.id,
:bench_name => @bench_name %>
-<%= content_tag "p", "Choose a range of revision:" %>
</div>
<p>
<center>
<p>
+<p>
<table>
<tr>
+ <td></td>
<td>Start</td>
<td>Stop</td>
</tr>
<tr>
+ <td>Revision:</td>
<td><%= text_field "revision", "start", "size" => 8,
"value" => @revision[:start] %></td>
<td><%= text_field "revision", "stop", "size" => 8,
"value" => @revision[:stop] %></td>
+ </tr>
+</table>
+</p><p>
+<table>
+ <tr>
+ <td>Output:</td>
<td><%= outputs_tag "output_arg_num", @bench_name, @output_arg_num %></td>
</tr>
</table>
+</p><p>
+<table>
+ <tr>
+ <td>Inputs</td>
+ <td>Value</td>
+ </tr>
+ <% arg_num = 1
+ i = 0
+ while i < @inputs.size do %>
+ <tr>
+ <%= content_tag "td", "#{@inputs[i].name}(#{@inputs[i].unit})" %>
+ <td>
+ <select id="#{(a)inputs[i].name}" name="#{(a)inputs[i].name}">
+ <% while i < @inputs.size and arg_num == @inputs[i].arg_num do %>
+ <%= content_tag "option", @inputs[i].value.to_s,
+ :value => @inputs[i].value.to_s %>
+
+ <% i += 1
+ end
+ arg_num += 1 %>
+ </select>
+ </td>
+ </tr>
+ <% end %>
+</table>
+</p>
</p>
<p style="color: red;"><%= flash[:error] %></p>
<p><%= submit_tag "Draw" %></p>
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Add the inputs table.
* web/ranch/test/unit/input_test.rb: New.
* web/ranch/test/fixtures/inputs.yml: New.
* web/ranch/app/models/input.rb: New.
* web/ranch/db/schema.rb: Update.
app/models/input.rb | 5 +++++
db/schema.rb | 16 ++++++++++++----
test/fixtures/inputs.yml | 23 +++++++++++++++++++++++
test/unit/input_test.rb | 10 ++++++++++
4 files changed, 50 insertions(+), 4 deletions(-)
Index: web/ranch/test/unit/input_test.rb
--- web/ranch/test/unit/input_test.rb (revision 0)
+++ web/ranch/test/unit/input_test.rb (revision 0)
@@ -0,0 +1,10 @@
+require File.dirname(__FILE__) + '/../test_helper'
+
+class InputTest < Test::Unit::TestCase
+ fixtures :inputs
+
+ # Replace this with your real tests.
+ def test_truth
+ assert_kind_of Input, inputs(:first)
+ end
+end
Index: web/ranch/test/fixtures/inputs.yml
--- web/ranch/test/fixtures/inputs.yml (revision 0)
+++ web/ranch/test/fixtures/inputs.yml (revision 0)
@@ -0,0 +1,23 @@
+<% id = 0 %>
+
+<% arg_num = 0
+ {
+ 'nb_states' => '',
+ 'nb_transition' => '',
+ 'foo' => 'unit_foo'
+ }.each do |name, unit| %>
+
+<% val = 2
+ arg_num += 1
+ (1..10).each do |rev| %>
+
+<%= "determinize_r#{rev}_#{name}:" %>
+ id: <%= id += 1 %>
+ name: <%= name %>
+ value: <%= val *= 2 %>
+ unit: <%= unit.inspect %>
+ bench_id: <%= rev %>
+ arg_num: <%= arg_num %>
+<% end %>
+<% end %>
+
Index: web/ranch/app/models/input.rb
--- web/ranch/app/models/input.rb (revision 0)
+++ web/ranch/app/models/input.rb (revision 0)
@@ -0,0 +1,5 @@
+class Input < ActiveRecord::Base
+
+ belongs_to :bench
+
+end
Index: web/ranch/db/schema.rb
--- web/ranch/db/schema.rb (revision 21)
+++ web/ranch/db/schema.rb (working copy)
@@ -6,17 +6,25 @@
create_table "benches", :force => true do |t|
t.column "name", :string, :limit => 128, :default => "noname", :null => false
- t.column "project_id", :integer, :limit => 10, :default => 0, :null => false
- t.column "revision", :integer, :limit => 10, :default => 0, :null => false
+ t.column "project_id", :integer, :default => 0, :null => false
+ t.column "revision", :integer, :default => 0, :null => false
end
add_index "benches", ["project_id"], :name => "project_id"
+ create_table "inputs", :force => true do |t|
+ t.column "name", :string, :limit => 128, :default => "noname", :null => false
+ t.column "unit", :string, :limit => 128, :default => "nounit", :null => false
+ t.column "value", :float, :default => 0.0, :null => false
+ t.column "bench_id", :integer, :default => 0, :null => false
+ t.column "arg_num", :integer, :limit => 8, :default => 0, :null => false
+ end
+
create_table "outputs", :force => true do |t|
t.column "name", :string, :limit => 128, :default => "noname", :null => false
t.column "value", :float, :default => 0.0, :null => false
t.column "unit", :string, :limit => 128, :default => "nounit", :null => false
- t.column "bench_id", :integer, :limit => 10, :default => 0, :null => false
+ t.column "bench_id", :integer, :default => 0, :null => false
t.column "arg_num", :integer, :limit => 8, :default => 1, :null => false
end
@@ -24,7 +32,7 @@
create_table "projects", :force => true do |t|
t.column "name", :string, :default => "noname", :null => false
- t.column "head_revision", :integer, :limit => 10, :default => 0, :null => false
+ t.column "head_revision", :integer, :default => 0, :null => false
end
end
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Add the default index request.
* web/ranch/app/controllers/benches_controller.rb: Add the default
index request which do the same job as the list one.
benches_controller.rb | 5 +++++
1 files changed, 5 insertions(+)
Index: web/ranch/app/controllers/benches_controller.rb
--- web/ranch/app/controllers/benches_controller.rb (revision 20)
+++ web/ranch/app/controllers/benches_controller.rb (working copy)
@@ -2,6 +2,11 @@
layout 'ranch'
+ def index
+ list
+ render :action => 'list'
+ end
+
def list
@project = Project.find_by_id(@params[:project_id])
@benches = Bench.find_by_sql "SELECT name " +
1
0
https://svn.lrde.epita.fr/svn/ranch/trunk
Index: ChangeLog
from Nicolas Despr�s <nicolas.despres(a)gmail.com>
Draw all outputs in one page.
* web/ranch/test/functional/graph_form_controller_test.rb: Test it.
* web/ranch/app/controllers/graph_form_controller.rb: Request the
number of output of the selected bench.
* web/ranch/app/views/graph_form/index.rhtml: Draw the regression
graph for each output of the bench.
app/controllers/graph_form_controller.rb | 10 ++++++++++
app/views/graph_form/index.rhtml | 9 +++++++++
test/functional/graph_form_controller_test.rb | 3 ++-
3 files changed, 21 insertions(+), 1 deletion(-)
Index: web/ranch/test/functional/graph_form_controller_test.rb
--- web/ranch/test/functional/graph_form_controller_test.rb (revision 19)
+++ web/ranch/test/functional/graph_form_controller_test.rb (working copy)
@@ -5,7 +5,7 @@
class GraphFormController; def rescue_action(e) raise e end; end
class GraphFormControllerTest < Test::Unit::TestCase
- fixtures :projects, :benches
+ fixtures :projects, :benches, :outputs
def setup
@controller = GraphFormController.new
@@ -87,6 +87,7 @@
assert_equal 1, assigns(:project).id
assert_equal 'determinize', assigns(:bench_name)
assert_equal 0, assigns(:output_arg_num)
+ assert_equal 3, assigns(:output_arg_nb)
end
end
Index: web/ranch/app/controllers/graph_form_controller.rb
--- web/ranch/app/controllers/graph_form_controller.rb (revision 19)
+++ web/ranch/app/controllers/graph_form_controller.rb (working copy)
@@ -20,6 +20,16 @@
@bench_name = params[:bench_name]
@project = Project.find params[:project_id]
@output_arg_num = params[:output_arg_num].to_i
+ if @output_arg_num.zero?
+ @output_arg_nb = Output.find_by_sql "SELECT outputs.arg_num " +
+ "FROM outputs, benches " +
+ "WHERE benches.project_id = #{(a)project.id} " +
+ "AND benches.name = '#@bench_name' " +
+ "AND outputs.bench_id = benches.id " +
+ "GROUP BY outputs.arg_num " +
+ "ORDER BY outputs.arg_num "
+ @output_arg_nb = @output_arg_nb.size
+ end
@draw_on = true
@revision = params[:revision]
head_rev = @project.head_revision
Index: web/ranch/app/views/graph_form/index.rhtml
--- web/ranch/app/views/graph_form/index.rhtml (revision 19)
+++ web/ranch/app/views/graph_form/index.rhtml (working copy)
@@ -29,8 +29,17 @@
<%= end_form_tag %>
<% if @draw_on %>
+ <% if @output_arg_num.zero? %>
+ <% 1.upto(@output_arg_nb) do |i| %>
+ <p>
+ <%= graph_reg_tag @project.id, @bench_name,
+ @revision[:start], @revision[:stop], i %>
+ </p>
+ <% end %>
+ <% else %>
<%= graph_reg_tag @project.id, @bench_name,
@revision[:start], @revision[:stop], @output_arg_num %>
+ <% end %>
<% else %>
<%= content_tag "p", "No chart to display - click on Draw" %>
<% end %>
1
0