00001 #ifndef OPENGM_VERBOSE_VISITOR_HXX
00002 #define OPENGM_VERBOSE_VISITOR_HXX
00003
00004 #include <string>
00005 #include <vector>
00006 #include <map>
00007 #include <iostream>
00008 #include <iomanip>
00009
00010 #include <opengm/opengm.hxx>
00011 #include <opengm/utilities/timer.hxx>
00012 #include <opengm/inference/visitors/visitorspecializations.hxx>
00013
00014 namespace opengm {
00015
00017 namespace detail_visitor{
00018
00019 struct VerboseVisitor{};
00020 struct TimingVisitor{};
00021 struct EmptyVisitor{};
00022
00023 template<size_t STATE,size_t FORMAT>
00024 class Print{
00025 static const size_t stepSpace_=8;
00026 static const size_t valueSpace_=9;
00027 static const size_t boundSpace_=9;
00028 static const size_t extraNumber1Space_=9;
00029 static const size_t extraNumber2Space_=9;
00030 private:
00031 typedef opengm::meta::And<
00032 opengm::meta::EqualNumber<FORMAT,0>::value,
00033 opengm::meta::EqualNumber<STATE,1>::value
00034 > SameLineAtBegin;
00035 typedef opengm::meta::Or<
00036 opengm::meta::EqualNumber<FORMAT,1>::value ,
00037 opengm::meta::Not<
00038 opengm::meta::EqualNumber<STATE,1>::value
00039 >::value
00040 > NewLineAtEnd;
00041 typedef opengm::meta::And<
00042 opengm::meta::EqualNumber<FORMAT,0>::value,
00043 opengm::meta::EqualNumber<STATE,2>::value
00044 > NewLineAtBeginEnd;
00045 public:
00046 template<class S,class V,class B>
00047 static void print(const S ,const V ,const B );
00048 template<class S,class V,class B,class E1>
00049 static void print(const S ,const V ,const B ,const std::string & ,const E1 );
00050 template<class S,class V,class B,class E1,class E2>
00051 static void print(const S ,const V ,const B ,const std::string & ,const E1 ,const std::string & ,const E2 );
00052
00053 };
00054
00055 template<bool MULTI_LINE>
00056 class PrintFormated{
00057 public:
00058 template<class S,class V,class B>
00059 static void printAtBegin(const S ,const V ,const B bound);
00060 template<class S,class V,class B>
00061 static void printAtVisit(const S ,const V ,const B bound);
00062 template<class S,class V,class B>
00063 static void printAtEnd(const S ,const V ,const B bound);
00064
00065 template<class S,class V,class B,class E1>
00066 static void printAtBegin(const S ,const V ,const B ,const std::string & ,const E1 );
00067 template<class S,class V,class B,class E1>
00068 static void printAtVisit(const S ,const V ,const B ,const std::string & ,const E1 );
00069 template<class S,class V,class B,class E1>
00070 static void printAtEnd(const S ,const V ,const B ,const std::string & ,const E1 );
00071
00072 template<class S,class V,class B,class E1,class E2>
00073 static void printAtBegin(const S ,const V ,const B ,const std::string & ,const E1 ,const std::string & ,const E2 );
00074 template<class S,class V,class B,class E1,class E2>
00075 static void printAtVisit(const S ,const V ,const B ,const std::string & ,const E1 ,const std::string & ,const E2 );
00076 template<class S,class V,class B,class E1,class E2>
00077 static void printAtEnd(const S ,const V ,const B ,const std::string & ,const E1 ,const std::string & ,const E2 );
00078 };
00079
00080 template<class INFERENCE_TYPE,class VISITOR_TYPE>
00081 struct VisitorImplementation;
00083 template<class INFERENCE_TYPE>
00084 class VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>{
00085 public:
00086 VisitorImplementation();
00087
00088 void visit(const INFERENCE_TYPE &)const;
00089 void beginVisit(const INFERENCE_TYPE &)const;
00090 void endVisit(const INFERENCE_TYPE &)const;
00091
00092 template<class E1>
00093 void visit(const INFERENCE_TYPE &,const std::string &,const E1)const;
00094 template<class E1>
00095 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1)const;
00096 template<class E1>
00097 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1)const;
00098
00099 template<class E1,class E2>
00100 void visit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2)const;
00101 template<class E1,class E2>
00102 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2)const;
00103 template<class E1,class E2>
00104 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2)const;
00105
00106 template<class E1,class E2,class E3>
00107 void visit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3)const;
00108 template<class E1,class E2,class E3>
00109 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3)const;
00110 template<class E1,class E2,class E3>
00111 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3)const;
00112
00113
00114
00115 template<class T1,class T2>
00116 void visit(T1 a1 ,T2 a2) const;
00117 template<class T1,class T2,class E1>
00118 void visit(T1 a1 ,T2 a2,const std::string &,const E1) const;
00119 template<class T1,class T2,class E1,class E2>
00120 void visit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) const;
00121 template<class T1,class T2,class E1,class E2,class E3>
00122 void visit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) const;
00123
00124
00125 template<class T1,class T2>
00126 void beginVisit(T1 a1 ,T2 a2) const;
00127 template<class T1,class T2,class E1>
00128 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1) const;
00129 template<class T1,class T2,class E1,class E2>
00130 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) const;
00131 template<class T1,class T2,class E1,class E2,class E3>
00132 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) const;
00133
00134
00135 template<class T1,class T2>
00136 void endVisit(T1 a1 ,T2 a2) const;
00137 template<class T1,class T2,class E1>
00138 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1) const;
00139 template<class T1,class T2,class E1,class E2>
00140 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) const;
00141 template<class T1,class T2,class E1,class E2,class E3>
00142 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) const;
00143 };
00145 template<class INFERENCE_TYPE>
00146 class VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>{
00147 public:
00148 VisitorImplementation(const size_t = 1,bool = true);
00149 void assign(const size_t = 1,bool = true);
00150
00151 void visit(const INFERENCE_TYPE &);
00152 void beginVisit(const INFERENCE_TYPE &);
00153 void endVisit(const INFERENCE_TYPE &);
00154
00155 template<class E1>
00156 void visit(const INFERENCE_TYPE &,const std::string &,const E1);
00157 template<class E1>
00158 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1);
00159 template<class E1>
00160 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1);
00161
00162 template<class E1,class E2>
00163 void visit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2);
00164 template<class E1,class E2>
00165 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2);
00166 template<class E1,class E2>
00167 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2);
00168
00169 template<class E1,class E2,class E3>
00170 void visit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3);
00171 template<class E1,class E2,class E3>
00172 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3);
00173 template<class E1,class E2,class E3>
00174 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3);
00175
00176 template<class T1,class T2>
00177 void visit(T1 a1 ,T2 a2) ;
00178 template<class T1,class T2,class E1>
00179 void visit(T1 a1 ,T2 a2,const std::string &,const E1) ;
00180 template<class T1,class T2,class E1,class E2>
00181 void visit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) ;
00182 template<class T1,class T2,class E1,class E2,class E3>
00183 void visit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) ;
00184
00185 template<class T1,class T2>
00186 void beginVisit(T1 a1 ,T2 a2) ;
00187 template<class T1,class T2,class E1>
00188 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1) ;
00189 template<class T1,class T2,class E1,class E2>
00190 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) ;
00191 template<class T1,class T2,class E1,class E2,class E3>
00192 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) ;
00193
00194 template<class T1,class T2>
00195 void endVisit(T1 a1 ,T2 a2) ;
00196 template<class T1,class T2,class E1>
00197 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1) ;
00198 template<class T1,class T2,class E1,class E2>
00199 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) ;
00200 template<class T1,class T2,class E1,class E2,class E3>
00201 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) ;
00202
00203 private:
00204 size_t visitNth_;
00205 size_t visitNumber_;
00206 bool multiline_;
00207 };
00209 template<class INFERENCE_TYPE>
00210 class VisitorImplementation<INFERENCE_TYPE,TimingVisitor>{
00211 public:
00212 typedef typename INFERENCE_TYPE::ValueType ValueType;
00213 typedef ValueType BoundType;
00214 typedef opengm::DefaultTimingType TimeType;
00215 typedef size_t IterationType;
00216
00217 VisitorImplementation(const size_t visitNth=1,const size_t = 0,bool = false,bool = false);
00218 void assign(const size_t visitNth=1,const size_t = 0,bool = false,bool = false);
00219
00220 const std::vector<TimeType > & getTimes() const;
00221 const std::vector<ValueType > & getValues() const;
00222 const std::vector<BoundType > & getBounds() const;
00223 const std::vector<IterationType> & getIterations() const;
00224
00225 void visit(const INFERENCE_TYPE &);
00226 void beginVisit(const INFERENCE_TYPE &);
00227 void endVisit(const INFERENCE_TYPE &);
00228
00229 template<class E1>
00230 void visit(const INFERENCE_TYPE &,const std::string &,const E1);
00231 template<class E1>
00232 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1);
00233 template<class E1>
00234 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1);
00235
00236 template<class E1,class E2>
00237 void visit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2);
00238 template<class E1,class E2>
00239 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2);
00240 template<class E1,class E2>
00241 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2);
00242
00243 template<class E1,class E2,class E3>
00244 void visit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3);
00245 template<class E1,class E2,class E3>
00246 void beginVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3);
00247 template<class E1,class E2,class E3>
00248 void endVisit(const INFERENCE_TYPE &,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3);
00249
00250 template<class T1,class T2>
00251 void visit(T1 a1 ,T2 a2) ;
00252 template<class T1,class T2,class E1>
00253 void visit(T1 a1 ,T2 a2,const std::string &,const E1) ;
00254 template<class T1,class T2,class E1,class E2>
00255 void visit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) ;
00256 template<class T1,class T2,class E1,class E2,class E3>
00257 void visit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) ;
00258
00259 template<class T1,class T2>
00260 void beginVisit(T1 a1 ,T2 a2) ;
00261 template<class T1,class T2,class E1>
00262 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1) ;
00263 template<class T1,class T2,class E1,class E2>
00264 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) ;
00265 template<class T1,class T2,class E1,class E2,class E3>
00266 void beginVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) ;
00267
00268 template<class T1,class T2>
00269 void endVisit(T1 a1 ,T2 a2) ;
00270 template<class T1,class T2,class E1>
00271 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1) ;
00272 template<class T1,class T2,class E1,class E2>
00273 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2) ;
00274 template<class T1,class T2,class E1,class E2,class E3>
00275 void endVisit(T1 a1 ,T2 a2,const std::string &,const E1,const std::string &,const E2,const std::string &,const E3) ;
00276
00277 public:
00278 typedef std::map<std::string, std::vector<double> > LogMapType;
00279
00280 void reserveMapVector(const std::string & name) {
00281 logs_[name].reserve(times_.capacity());
00282 }
00283 void pushBackStringLogData(const std::string & name,const double data) {
00284 logs_[name].push_back(data);
00285 }
00286 const LogMapType & getLogsMap()const{
00287 return logs_;
00288 }
00289
00290 private:
00291 LogMapType logs_;
00292 size_t visitNth_;
00293 size_t visitNumber_;
00294 std::vector<TimeType > times_;
00295 std::vector<ValueType > values_;
00296 std::vector<BoundType > bounds_;
00297
00298 std::vector<IterationType> iterations_;
00299 opengm::Timer timer_;
00300 bool verbose_;
00301 bool multiline_;
00302 };
00303
00305 template<class INFERENCE_TYPE,class VISITOR_TYPE>
00306 class Visitor
00307 : public VisitorImplementation<INFERENCE_TYPE,VISITOR_TYPE>{
00308 typedef INFERENCE_TYPE InferenceType;
00309 typedef typename InferenceType::AccumulationType AccumulationType;
00310 typedef typename InferenceType::GraphicalModelType GraphicalModelType;
00311 public:
00312 Visitor();
00313
00314 template<class T1,class T2,class E1>
00315 void operator() (const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1) {
00316 this->visit(inference,t1,t2,n1,e1);
00317 }
00318 template<class T1,class T2,class E1,class E2>
00319 void operator() (const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2) {
00320 this->visit(inference,t1,t2,n1,e1,n2,e2);
00321 }
00322 template<class T1,class T2,class E1,class E2,class E3>
00323 void operator() (const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2,const std::string & n3 ,const E2 e3) {
00324 this->visit(inference,t1,t2,n1,e1,n2,e2,n3,e3);
00325 }
00326
00327 template<class E1>
00328 void operator() (const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1) {
00329 this->visit(inference,n1,e1);
00330 }
00331 template<class E1,class E2>
00332 void operator() (const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2) {
00333 this->visit(inference,n1,e1,n2,e2);
00334 }
00335 template<class E1,class E2,class E3>
00336 void operator() (const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2,const std::string & n3 ,const E2 e3) {
00337 this->visit(inference,n1,e1,n2,e2,n3,e3);
00338 }
00339
00340
00341 void operator()();
00342 void operator() (const INFERENCE_TYPE & inference );
00343 template<class T1>
00344 void operator()(const INFERENCE_TYPE & ,const T1);
00345 template<class T1,class T2>
00346 void operator()(const INFERENCE_TYPE & ,const T1,const T2 );
00347 template<class T1,class T2,class T3>
00348 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 & );
00349 template<class T1,class T2,class T3,class T4>
00350 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 & );
00351 template<class T1,class T2,class T3,class T4,class T5>
00352 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &);
00353 template<class T1,class T2,class T3,class T4,class T5,class T6>
00354 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &);
00355 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
00356 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 & );
00357 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
00358 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 &,const T8 & );
00359 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
00360 void operator()(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 &,const T8 & ,const T9 &);
00361
00362 void begin();
00363
00364
00365
00366 template<class T1,class T2,class E1>
00367 void begin (const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1) {
00368 this->beginVisit(inference,t1,t2,n1,e1);
00369 }
00370 template<class T1,class T2,class E1,class E2>
00371 void begin(const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2) {
00372 this->beginVisit(inference,t1,t2,n1,e1,n2,e2);
00373 }
00374 template<class T1,class T2,class E1,class E2,class E3>
00375 void begin(const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2,const std::string & n3 ,const E2 e3) {
00376 this->beginVisit(inference,t1,t2,n1,e1,n2,e2,n3,e3);
00377 }
00378
00379 template<class E1>
00380 void begin(const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1) {
00381 this->beginVisit(inference,n1,e1);
00382 }
00383 template<class E1,class E2>
00384 void begin(const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2) {
00385 this->beginVisit(inference,n1,e1,n2,e2);
00386 }
00387 template<class E1,class E2,class E3>
00388 void begin(const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2,const std::string & n3 ,const E2 e3) {
00389 this->beginVisit(inference,n1,e1,n2,e2,n3,e3);
00390 }
00391
00392
00393 void begin (const INFERENCE_TYPE & inference );
00394 template<class T1>
00395 void begin(const INFERENCE_TYPE & ,const T1);
00396 template<class T1,class T2>
00397 void begin(const INFERENCE_TYPE & ,const T1,const T2 );
00398 template<class T1,class T2,class T3>
00399 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &);
00400 template<class T1,class T2,class T3,class T4>
00401 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 & );
00402 template<class T1,class T2,class T3,class T4,class T5>
00403 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &);
00404 template<class T1,class T2,class T3,class T4,class T5,class T6>
00405 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &);
00406 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
00407 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 & );
00408 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
00409 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 &,const T8 & );
00410 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
00411 void begin(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 &,const T8 & ,const T9 &);
00412
00413 void end();
00414
00415 template<class T1,class T2,class E1>
00416 void end (const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1) {
00417 this->endVisit(inference,t1,t2,n1,e1);
00418 }
00419 template<class T1,class T2,class E1,class E2>
00420 void end(const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2) {
00421 this->endVisit(inference,t1,t2,n1,e1,n2,e2);
00422 }
00423 template<class T1,class T2,class E1,class E2,class E3>
00424 void end(const INFERENCE_TYPE & inference ,const T1 t1,const T2 t2,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2,const std::string & n3 ,const E2 e3) {
00425 this->endVisit(inference,t1,t2,n1,e1,n2,e2,n3,e3);
00426 }
00427
00428 template<class E1>
00429 void end(const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1) {
00430 this->endVisit(inference,n1,e1);
00431 }
00432 template<class E1,class E2>
00433 void end(const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2) {
00434 this->endVisit(inference,n1,e1,n2,e2);
00435 }
00436 template<class E1,class E2,class E3>
00437 void end(const INFERENCE_TYPE & inference ,const std::string & n1 ,const E1 e1,const std::string & n2 ,const E2 e2,const std::string & n3 ,const E2 e3) {
00438 this->endVisit(inference,n1,e1,n2,e2,n3,e3);
00439 }
00440
00441 void end (const INFERENCE_TYPE & inference );
00442 template<class T1>
00443 void end(const INFERENCE_TYPE & ,const T1);
00444 template<class T1,class T2>
00445 void end(const INFERENCE_TYPE & ,const T1,const T2 );
00446 template<class T1,class T2,class T3>
00447 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &);
00448 template<class T1,class T2,class T3,class T4>
00449 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 & );
00450 template<class T1,class T2,class T3,class T4,class T5>
00451 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &);
00452 template<class T1,class T2,class T3,class T4,class T5,class T6>
00453 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &);
00454 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
00455 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 & );
00456 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
00457 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 &,const T8 & );
00458 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
00459 void end(const INFERENCE_TYPE & ,const T1,const T2 ,const T3 &,const T4 &,const T5 &,const T6 &,const T7 &,const T8 & ,const T9 &);
00460 };
00461 }
00463
00465 template<class INFERENCE_TYPE>
00466 class EmptyVisitorBase
00467 : public detail_visitor::Visitor<INFERENCE_TYPE,detail_visitor::EmptyVisitor>{
00468 public:
00469 EmptyVisitorBase();
00470 };
00471
00473 template<class INFERENCE_TYPE>
00474 class VerboseVisitorBase
00475 : public detail_visitor::Visitor<INFERENCE_TYPE,detail_visitor::VerboseVisitor>{
00476 public:
00477 VerboseVisitorBase(const size_t =1,const bool=true);
00478 };
00479
00481 template<class INFERENCE_TYPE>
00482 class TimingVisitorBase
00483 : public detail_visitor::Visitor<INFERENCE_TYPE,detail_visitor::TimingVisitor>{
00484 public:
00485 TimingVisitorBase(const size_t = 1,size_t = 0,bool = false,bool = true);
00486 };
00487
00489 template<class INFERENCE_TYPE>
00490 class EmptyVisitor
00491 : public EmptyVisitorBase<INFERENCE_TYPE>{
00492 public:
00493 EmptyVisitor();
00494 };
00495
00497 template<class INFERENCE_TYPE>
00498 class VerboseVisitor
00499 : public VerboseVisitorBase<INFERENCE_TYPE>{
00500 public:
00501 VerboseVisitor(const size_t=1,bool=true);
00502 };
00503
00505 template<class INFERENCE_TYPE>
00506 class TimingVisitor
00507 : public TimingVisitorBase<INFERENCE_TYPE>{
00508 public:
00509 TimingVisitor(const size_t = 1,size_t = 0,bool = false,bool = true);
00510 };
00511
00512
00513 template<class INFERENCE_TYPE>
00514 EmptyVisitorBase<INFERENCE_TYPE>::EmptyVisitorBase()
00515 : detail_visitor::Visitor<INFERENCE_TYPE,detail_visitor::EmptyVisitor>() {
00516 }
00517
00521 template<class INFERENCE_TYPE>
00522 VerboseVisitorBase<INFERENCE_TYPE>::VerboseVisitorBase
00523 (
00524 const size_t visitNth,
00525 bool multilineCout
00526 )
00527 : detail_visitor::Visitor<INFERENCE_TYPE,detail_visitor::VerboseVisitor>() {
00528 this->assign(visitNth,multilineCout);
00529 }
00530
00536 template<class INFERENCE_TYPE>
00537 TimingVisitorBase<INFERENCE_TYPE>::TimingVisitorBase
00538 (
00539 const size_t visitNth,
00540 size_t reserve,
00541 bool verbose,
00542 bool multilineCout
00543 )
00544 : detail_visitor::Visitor<INFERENCE_TYPE,detail_visitor::TimingVisitor>() {
00545 this->assign(visitNth,reserve,verbose,multilineCout);
00546 }
00547
00549 template<class INFERENCE_TYPE>
00550 EmptyVisitor<INFERENCE_TYPE>::EmptyVisitor()
00551 : EmptyVisitorBase<INFERENCE_TYPE> () {
00552 }
00553
00557 template<class INFERENCE_TYPE>
00558 VerboseVisitor<INFERENCE_TYPE>::VerboseVisitor
00559 (
00560 const size_t visitNth,
00561 bool multilineCout
00562 )
00563 : VerboseVisitorBase<INFERENCE_TYPE>(visitNth,multilineCout) {
00564 }
00565
00571 template<class INFERENCE_TYPE>
00572 TimingVisitor<INFERENCE_TYPE>::TimingVisitor
00573 (
00574 const size_t visitNth,
00575 size_t reserve,
00576 bool verbose,
00577 bool multilineCout
00578 )
00579 : TimingVisitorBase<INFERENCE_TYPE>(visitNth,reserve,verbose,multilineCout) {
00580 }
00581
00582
00583
00585 namespace detail_visitor{
00586
00587 template<size_t STATE,size_t FORMAT>
00588 template<class S,class V,class B>
00589 inline void
00590 Print<STATE,FORMAT>::print
00591 (
00592 const S step,
00593 const V value,
00594 const B bound
00595 ) {
00596 std::cout<<((NewLineAtBeginEnd::value )? "\n" : "")
00597 <<((SameLineAtBegin::value )? "\r" : "")
00598 << (opengm::meta::EqualNumber<STATE,0>::value ? "Begin : " : (opengm::meta::EqualNumber<STATE,1>::value ? "Step : " : "End : "))
00599 << std::scientific<<std::setw(Print::stepSpace_)
00600 << (opengm::meta::EqualNumber<STATE,1>::value ? step : step)
00601 << " Value : " <<std::scientific<<std::setw(Print::valueSpace_)<<value
00602 << " Bound : " <<std::scientific<<std::setw(Print::boundSpace_)<<bound
00603 << ((NewLineAtEnd::value )? "\n":"")<<std::flush;
00604 }
00605
00606 template<size_t STATE,size_t FORMAT>
00607 template<class S,class V,class B,class E1>
00608 inline void
00609 Print<STATE,FORMAT>::print
00610 (
00611 const S step,
00612 const V value,
00613 const B bound,
00614 const std::string & extraName1,
00615 const E1 extra1
00616 ) {
00617 std::cout<<((NewLineAtBeginEnd::value )? "\n" : "")
00618 <<((SameLineAtBegin::value )? "\r" : "")
00619 << (opengm::meta::EqualNumber<STATE,0>::value ? "Begin : " : (opengm::meta::EqualNumber<STATE,1>::value ? "Step : " : "End : "))
00620 << std::scientific<<std::setw(Print::stepSpace_)
00621 << (opengm::meta::EqualNumber<STATE,1>::value ? step : step)
00622 << " Value : " <<std::scientific<<std::setw(Print::valueSpace_)<<value
00623 << " Bound : " <<std::scientific<<std::setw(Print::boundSpace_)<<bound
00624 << " "<<extraName1<<" : " <<std::scientific<<std::setw(Print::extraNumber1Space_)<<extra1
00625 << ((NewLineAtEnd::value )? "\n":"")<<std::flush;
00626 }
00627
00628 template<size_t STATE,size_t FORMAT>
00629 template<class S,class V,class B,class E1,class E2>
00630 inline void
00631 Print<STATE,FORMAT>::print
00632 (
00633 const S step,
00634 const V value,
00635 const B bound,
00636 const std::string & extraName1,
00637 const E1 extra1,
00638 const std::string & extraName2,
00639 const E2 extra2
00640 ) {
00641 std::cout<<((NewLineAtBeginEnd::value )? "\n" : "")
00642 <<((SameLineAtBegin::value )? "\r" : "")
00643 << (opengm::meta::EqualNumber<STATE,0>::value ? "Begin : " : (opengm::meta::EqualNumber<STATE,1>::value ? "Step : " : "End : "))
00644 << std::scientific<<std::setw(Print::stepSpace_)
00645 << (opengm::meta::EqualNumber<STATE,1>::value ? step : step)
00646 << " Value : " <<std::scientific<<std::setw(Print::valueSpace_)<<value
00647 << " Bound : " <<std::scientific<<std::setw(Print::boundSpace_)<<bound
00648 << " "<<extraName1<<" : " <<std::scientific<<std::setw(Print::extraNumber1Space_)<<extra1
00649 << " "<<extraName2<<" : " <<std::scientific<<std::setw(Print::extraNumber2Space_)<<extra2
00650 << ((NewLineAtEnd::value )? "\n":"")<<std::flush;
00651 }
00652
00653 template<bool MULTI_LINE>
00654 template<class S,class V,class B>
00655 inline void
00656 PrintFormated<MULTI_LINE>::printAtBegin
00657 (
00658 const S step,
00659 const V value,
00660 const B bound
00661 ) {
00662 Print<0,MULTI_LINE>::print(step,value,bound);
00663 }
00664
00665 template<bool MULTI_LINE>
00666 template<class S,class V,class B>
00667 inline void
00668 PrintFormated<MULTI_LINE>::printAtVisit
00669 (
00670 const S step,
00671 const V value,
00672 const B bound
00673 ) {
00674 Print<1,MULTI_LINE>::print(step,value,bound);
00675 }
00676
00677 template<bool MULTI_LINE>
00678 template<class S,class V,class B>
00679 inline void
00680 PrintFormated<MULTI_LINE>::printAtEnd
00681 (
00682 const S step,
00683 const V value,
00684 const B bound
00685 ) {
00686 Print<2,MULTI_LINE>::print(step,value,bound);
00687 }
00688
00689 template<bool MULTI_LINE>
00690 template<class S,class V,class B,class E1>
00691 inline void
00692 PrintFormated<MULTI_LINE>::printAtBegin
00693 (
00694 const S step,
00695 const V value,
00696 const B bound,
00697 const std::string & extraName1,
00698 const E1 extra1
00699 ) {
00700 Print<0,MULTI_LINE>::print(step,value,bound,extraName1,extra1);
00701 }
00702
00703 template<bool MULTI_LINE>
00704 template<class S,class V,class B,class E1>
00705 inline void
00706 PrintFormated<MULTI_LINE>::printAtVisit
00707 (
00708 const S step,
00709 const V value,
00710 const B bound,
00711 const std::string & extraName1,
00712 const E1 extra1
00713 ) {
00714 Print<1,MULTI_LINE>::print(step,value,bound,extraName1,extra1);
00715 }
00716
00717 template<bool MULTI_LINE>
00718 template<class S,class V,class B,class E1>
00719 inline void
00720 PrintFormated<MULTI_LINE>::printAtEnd
00721 (
00722 const S step,
00723 const V value,
00724 const B bound,
00725 const std::string & extraName1,
00726 const E1 extra1
00727 ) {
00728 Print<2,MULTI_LINE>::print(step,value,bound,extraName1,extra1);
00729 }
00730
00731 template<bool MULTI_LINE>
00732 template<class S,class V,class B,class E1,class E2>
00733 inline void
00734 PrintFormated<MULTI_LINE>::printAtBegin
00735 (
00736 const S step,
00737 const V value,
00738 const B bound,
00739 const std::string & extraName1,
00740 const E1 extra1,
00741 const std::string & extraName2,
00742 const E2 extra2
00743 ) {
00744 Print<0,MULTI_LINE>::print(step,value,bound,extraName1,extra1,extraName2,extra2);
00745 }
00746
00747 template<bool MULTI_LINE>
00748 template<class S,class V,class B,class E1,class E2>
00749 inline void
00750 PrintFormated<MULTI_LINE>::printAtVisit
00751 (
00752 const S step,
00753 const V value,
00754 const B bound,
00755 const std::string & extraName1,
00756 const E1 extra1,
00757 const std::string & extraName2,
00758 const E2 extra2
00759 ) {
00760 Print<1,MULTI_LINE>::print(step,value,bound,extraName1,extra1,extraName2,extra2);
00761 }
00762
00763 template<bool MULTI_LINE>
00764 template<class S,class V,class B,class E1,class E2>
00765 inline void
00766 PrintFormated<MULTI_LINE>::printAtEnd
00767 (
00768 const S step,
00769 const V value,
00770 const B bound,
00771 const std::string & extraName1,
00772 const E1 extra1,
00773 const std::string & extraName2,
00774 const E2 extra2
00775 ) {
00776 Print<2,MULTI_LINE>::print(step,value,bound,extraName1,extra1,extraName2,extra2);
00777 }
00778
00779
00780 template<class INFERENCE_TYPE>
00781 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::VisitorImplementation() {
00782 }
00783
00784
00785 template<class INFERENCE_TYPE>
00786 inline void
00787 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit
00788 (
00789 const INFERENCE_TYPE & inf
00790 )const{
00791 }
00792
00793 template<class INFERENCE_TYPE>
00794 inline void
00795 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit
00796 (
00797 const INFERENCE_TYPE & inf
00798 )const{
00799 }
00800
00801 template<class INFERENCE_TYPE>
00802 inline void
00803 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit
00804 (
00805 const INFERENCE_TYPE & inf
00806 )const{
00807 }
00808
00809 template<class INFERENCE_TYPE>
00810 template<class E1>
00811 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1)const{
00812
00813 }
00814
00815 template<class INFERENCE_TYPE>
00816 template<class E1>
00817 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1)const{
00818
00819 }
00820
00821 template<class INFERENCE_TYPE>
00822 template<class E1>
00823 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1)const{
00824
00825 }
00826
00827
00828 template<class INFERENCE_TYPE>
00829 template<class E1,class E2>
00830 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2)const{
00831
00832 }
00833
00834 template<class INFERENCE_TYPE>
00835 template<class E1,class E2>
00836 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2)const{
00837
00838 }
00839
00840 template<class INFERENCE_TYPE>
00841 template<class E1,class E2>
00842 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2)const{
00843
00844 }
00845
00846
00847 template<class INFERENCE_TYPE>
00848 template<class E1,class E2,class E3>
00849 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3)const{
00850
00851 }
00852
00853 template<class INFERENCE_TYPE>
00854 template<class E1,class E2,class E3>
00855 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3)const{
00856
00857 }
00858
00859 template<class INFERENCE_TYPE>
00860 template<class E1,class E2,class E3>
00861 inline void VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3)const{
00862
00863 }
00864
00865 template<class INFERENCE_TYPE>
00866 template<class T1,class T2>
00867 inline void
00868 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit
00869 (
00870 T1 a1 ,
00871 T2 a2
00872 )const{
00873 }
00874
00875 template<class INFERENCE_TYPE>
00876 template<class T1,class T2,class E1>
00877 inline void
00878 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit
00879 (
00880 T1 a1 ,
00881 T2 a2 ,
00882 const std::string & name1,
00883 const E1 e1
00884 )const{
00885 }
00886
00887 template<class INFERENCE_TYPE>
00888 template<class T1,class T2,class E1,class E2>
00889 inline void
00890 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::visit
00891 (
00892 T1 a1 ,
00893 T2 a2 ,
00894 const std::string & name1,
00895 const E1 e1,
00896 const std::string & name21,
00897 const E2 e2
00898 )const{
00899 }
00900
00901 template<class INFERENCE_TYPE>
00902 template<class T1,class T2>
00903 inline void
00904 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit
00905 (
00906 T1 a1 ,
00907 T2 a2
00908 )const{
00909 }
00910
00911 template<class INFERENCE_TYPE>
00912 template<class T1,class T2,class E1>
00913 inline void
00914 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit
00915 (
00916 T1 a1 ,
00917 T2 a2 ,
00918 const std::string & name1,
00919 const E1 e1
00920 )const{
00921 }
00922
00923 template<class INFERENCE_TYPE>
00924 template<class T1,class T2,class E1,class E2>
00925 inline void
00926 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::beginVisit
00927 (
00928 T1 a1 ,
00929 T2 a2 ,
00930 const std::string & name1,
00931 const E1 e1,
00932 const std::string & name21,
00933 const E2 e2
00934 )const{
00935 }
00936
00937
00938 template<class INFERENCE_TYPE>
00939 template<class T1,class T2>
00940 inline void
00941 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit
00942 (
00943 T1 a1 ,
00944 T2 a2
00945 )const{
00946 }
00947
00948 template<class INFERENCE_TYPE>
00949 template<class T1,class T2,class E1>
00950 inline void
00951 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit
00952 (
00953 T1 a1 ,
00954 T2 a2 ,
00955 const std::string & name1,
00956 const E1 e1
00957 )const{
00958 }
00959
00960 template<class INFERENCE_TYPE>
00961 template<class T1,class T2,class E1,class E2>
00962 inline void
00963 VisitorImplementation<INFERENCE_TYPE,EmptyVisitor>::endVisit
00964 (
00965 T1 a1 ,
00966 T2 a2 ,
00967 const std::string & name1,
00968 const E1 e1,
00969 const std::string & name2,
00970 const E2 e2
00971 )const{
00972 }
00973
00974
00975 template<class INFERENCE_TYPE>
00976 inline
00977 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::VisitorImplementation
00978 (
00979 const size_t visitNth,
00980 bool multiline
00981 )
00982 : visitNth_(visitNth),
00983 visitNumber_(0),
00984 multiline_(multiline) {
00985 }
00986
00987 template<class INFERENCE_TYPE>
00988 inline void
00989 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::assign
00990 (
00991 const size_t visitNth,
00992 bool multiline
00993 ) {
00994 visitNth_=visitNth;
00995 visitNumber_=0;
00996 multiline_=multiline;
00997 }
00998
00999 template<class INFERENCE_TYPE>
01000 inline void
01001 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit
01002 (
01003 const INFERENCE_TYPE & inf
01004 ) {
01005 if(visitNumber_ % visitNth_ == 0) {
01006 if(multiline_)
01007 PrintFormated<true>::printAtVisit(visitNumber_,inf.value(),inf.bound());
01008 else
01009 PrintFormated<false>::printAtVisit(visitNumber_, inf.value(), inf.bound());
01010 }
01011 ++visitNumber_;
01012 }
01013
01014 template<class INFERENCE_TYPE>
01015 inline void
01016 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit
01017 (
01018 const INFERENCE_TYPE & inf
01019 ) {
01020 if(multiline_)
01021 PrintFormated<true>::printAtBegin(visitNumber_,inf.value(),inf.bound());
01022 else
01023 PrintFormated<false>::printAtBegin(visitNumber_, inf.value(), inf.bound());
01024 }
01025
01026 template<class INFERENCE_TYPE>
01027 inline void
01028 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit
01029 (
01030 const INFERENCE_TYPE & inf
01031 ) {
01032 if(multiline_)
01033 PrintFormated<true>::printAtEnd(visitNumber_,inf.value(),inf.bound());
01034 else
01035 PrintFormated<false>::printAtEnd(visitNumber_, inf.value(), inf.bound());
01036 }
01037
01038 template<class INFERENCE_TYPE>
01039 template<class E1>
01040 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1) {
01041 if(visitNumber_ % visitNth_ == 0) {
01042 if(multiline_)
01043 PrintFormated<true>::printAtVisit(visitNumber_,inf.value(),inf.bound(),n1,e1);
01044 else
01045 PrintFormated<false>::printAtVisit(visitNumber_, inf.value(), inf.bound(),n1,e1);
01046 }
01047 ++visitNumber_;
01048 }
01049
01050 template<class INFERENCE_TYPE>
01051 template<class E1>
01052 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1) {
01053 if(multiline_)
01054 PrintFormated<true>::printAtBegin(visitNumber_,inf.value(),inf.bound(),n1,e1);
01055 else
01056 PrintFormated<false>::printAtBegin(visitNumber_, inf.value(), inf.bound(),n1,e1);
01057 }
01058
01059 template<class INFERENCE_TYPE>
01060 template<class E1>
01061 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1) {
01062 if(multiline_)
01063 PrintFormated<true>::printAtEnd(visitNumber_,inf.value(),inf.bound(),n1,e1);
01064 else
01065 PrintFormated<false>::printAtEnd(visitNumber_, inf.value(), inf.bound(),n1,e1);
01066 }
01067
01068
01069 template<class INFERENCE_TYPE>
01070 template<class E1,class E2>
01071 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2) {
01072 if(visitNumber_ % visitNth_ == 0) {
01073 if(multiline_)
01074 PrintFormated<true>::printAtVisit(visitNumber_,inf.value(),inf.bound(),n1,e1,n2,e2);
01075 else
01076 PrintFormated<false>::printAtVisit(visitNumber_, inf.value(), inf.bound(),n1,e1.n2,e2);
01077 }
01078 ++visitNumber_;
01079 }
01080
01081 template<class INFERENCE_TYPE>
01082 template<class E1,class E2>
01083 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2) {
01084 if(multiline_)
01085 PrintFormated<true>::printAtBegin(visitNumber_,inf.value(),inf.bound(),n1,e1,n2,e2);
01086 else
01087 PrintFormated<false>::printAtBegin(visitNumber_, inf.value(), inf.bound(),n1,e1,n2,e2);
01088 }
01089
01090 template<class INFERENCE_TYPE>
01091 template<class E1,class E2>
01092 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2) {
01093 if(multiline_)
01094 PrintFormated<true>::printAtEnd(visitNumber_,inf.value(),inf.bound(),n1,e1,n2,e2);
01095 else
01096 PrintFormated<false>::printAtEnd(visitNumber_, inf.value(), inf.bound(),n1,e1,n2,e2);
01097 }
01098
01099
01100 template<class INFERENCE_TYPE>
01101 template<class E1,class E2,class E3>
01102 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3) {
01103 if(visitNumber_ % visitNth_ == 0) {
01104 if(multiline_)
01105 PrintFormated<true>::printAtVisit(visitNumber_,inf.value(),inf.bound(),n1,e1,n2,e2,n3,e3);
01106 else
01107 PrintFormated<false>::printAtVisit(visitNumber_, inf.value(), inf.bound(),n1,e1.n2,e2,n3,e3);
01108 }
01109 ++visitNumber_;
01110 }
01111
01112 template<class INFERENCE_TYPE>
01113 template<class E1,class E2,class E3>
01114 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3) {
01115 if(multiline_)
01116 PrintFormated<true>::printAtBegin(visitNumber_,inf.value(),inf.bound(),n1,e1,n2,e2,n3,e3);
01117 else
01118 PrintFormated<false>::printAtBegin(visitNumber_, inf.value(), inf.bound(),n1,e1,n2,e2,n3,e3);
01119 }
01120
01121 template<class INFERENCE_TYPE>
01122 template<class E1,class E2,class E3>
01123 inline void VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3) {
01124 if(multiline_)
01125 PrintFormated<true>::printAtEnd(visitNumber_,inf.value(),inf.bound(),n1,e1,n2,e2,n3,e3);
01126 else
01127 PrintFormated<false>::printAtEnd(visitNumber_, inf.value(), inf.bound(),n1,e1,n2,e2.n3,e3);
01128 }
01129
01130
01131 template<class INFERENCE_TYPE>
01132 template<class T1,class T2>
01133 inline void
01134 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit
01135 (
01136 T1 value ,
01137 T2 bound
01138 ) {
01139 if(visitNumber_ % visitNth_ == 0) {
01140 if(multiline_)
01141 PrintFormated<true>::printAtVisit(visitNumber_,value,bound);
01142 else
01143 PrintFormated<false>::printAtVisit(visitNumber_, value, bound);
01144 }
01145 ++visitNumber_;
01146 }
01147
01148 template<class INFERENCE_TYPE>
01149 template<class T1,class T2,class E1>
01150 inline void
01151 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit
01152 (
01153 T1 value ,
01154 T2 bound ,
01155 const std::string & name1,
01156 const E1 e1
01157 ) {
01158 if(visitNumber_ % visitNth_ == 0) {
01159 if(multiline_)
01160 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,name1,e1);
01161 else
01162 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,name1,e1);
01163 }
01164 ++visitNumber_;
01165 }
01166
01167 template<class INFERENCE_TYPE>
01168 template<class T1,class T2,class E1,class E2>
01169 inline void
01170 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::visit
01171 (
01172 T1 value ,
01173 T2 bound ,
01174 const std::string & name1,
01175 const E1 e1,
01176 const std::string & name2,
01177 const E2 e2
01178 ) {
01179 if(visitNumber_ % visitNth_ == 0) {
01180 if(multiline_)
01181 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,name1,e1,name2,e2);
01182 else
01183 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,name1,e1,name2,e2);
01184 }
01185 ++visitNumber_;
01186 }
01187
01188 template<class INFERENCE_TYPE>
01189 template<class T1,class T2>
01190 inline void
01191 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit
01192 (
01193 T1 value ,
01194 T2 bound
01195 ) {
01196 if(multiline_)
01197 PrintFormated<true>::printAtBegin(visitNumber_,value,bound);
01198 else
01199 PrintFormated<false>::printAtBegin(visitNumber_, value, bound);
01200 }
01201
01202 template<class INFERENCE_TYPE>
01203 template<class T1,class T2,class E1>
01204 inline void
01205 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit
01206 (
01207 T1 value ,
01208 T2 bound ,
01209 const std::string & name1,
01210 const E1 e1
01211 ) {
01212 if(visitNumber_ % visitNth_ == 0) {
01213 if(multiline_)
01214 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,name1,e1);
01215 else
01216 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,name1,e1);
01217 }
01218 ++visitNumber_;
01219 }
01220
01221 template<class INFERENCE_TYPE>
01222 template<class T1,class T2,class E1,class E2>
01223 inline void
01224 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::beginVisit
01225 (
01226 T1 value ,
01227 T2 bound ,
01228 const std::string & name1,
01229 const E1 e1,
01230 const std::string & name2,
01231 const E2 e2
01232 ) {
01233 if(visitNumber_ % visitNth_ == 0) {
01234 if(multiline_)
01235 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,name1,e1,name2,e2);
01236 else
01237 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,name1,e1,name2,e2);
01238 }
01239 ++visitNumber_;
01240 }
01241
01242 template<class INFERENCE_TYPE>
01243 template<class T1,class T2>
01244 inline void
01245 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit
01246 (
01247 T1 value ,
01248 T2 bound
01249 ) {
01250 if(multiline_)
01251 PrintFormated<true>::printAtEnd(visitNumber_,value,bound);
01252 else
01253 PrintFormated<false>::printAtEnd(visitNumber_, value, bound);
01254 }
01255
01256 template<class INFERENCE_TYPE>
01257 template<class T1,class T2,class E1>
01258 inline void
01259 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit
01260 (
01261 T1 value ,
01262 T2 bound ,
01263 const std::string & name1,
01264 const E1 e1
01265 ) {
01266 if(multiline_)
01267 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,name1,e1);
01268 else
01269 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,name1,e1);
01270 }
01271
01272 template<class INFERENCE_TYPE>
01273 template<class T1,class T2,class E1,class E2>
01274 inline void
01275 VisitorImplementation<INFERENCE_TYPE,VerboseVisitor>::endVisit
01276 (
01277 T1 value ,
01278 T2 bound ,
01279 const std::string & name1,
01280 const E1 e1,
01281 const std::string & name2,
01282 const E2 e2
01283 ) {
01284 if(multiline_)
01285 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,name1,e1,name2,e2);
01286 else
01287 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,name1,e1,name2,e2);
01288 }
01289
01290
01291 template<class INFERENCE_TYPE>
01292 inline const std::vector<typename VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::TimeType > &
01293 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::getTimes() const{
01294 return times_;
01295 }
01296
01297 template<class INFERENCE_TYPE>
01298 inline const std::vector<typename VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::ValueType > &
01299 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::getValues() const{
01300 return values_;
01301 }
01302
01303 template<class INFERENCE_TYPE>
01304 inline const std::vector<typename VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::BoundType > &
01305 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::getBounds() const{
01306 return bounds_;
01307 }
01308
01309 template<class INFERENCE_TYPE>
01310 inline const std::vector<typename VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::IterationType> &
01311 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::getIterations() const{
01312 return iterations_;
01313 }
01314
01315 template<class INFERENCE_TYPE>
01316 inline
01317 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::VisitorImplementation
01318 (
01319 const size_t visitNth,
01320 const size_t reserve,
01321 bool verbose,
01322 bool multiline
01323 )
01324 : visitNth_(visitNth),
01325 visitNumber_(0),
01326 verbose_(verbose),
01327 multiline_(multiline) {
01328 if(reserve!=0) {
01329 times_.reserve(reserve);
01330 values_.reserve(reserve);
01331 bounds_.reserve(reserve);
01332 iterations_.reserve(reserve);
01333 }
01334 }
01335
01336 template<class INFERENCE_TYPE>
01337 inline void
01338 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::assign
01339 (
01340 const size_t visitNth,
01341 const size_t reserve,
01342 bool verbose,
01343 bool multiline
01344 ) {
01345 visitNth_=visitNth;
01346 visitNumber_=0;
01347 verbose_=verbose;
01348 multiline_=multiline;
01349 if(reserve!=0) {
01350 times_.reserve(reserve);
01351 values_.reserve(reserve);
01352 bounds_.reserve(reserve);
01353 iterations_.reserve(reserve);;
01354 }
01355 }
01356
01357 template<class INFERENCE_TYPE>
01358 inline void
01359 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit
01360 (
01361 const INFERENCE_TYPE & inf
01362 ) {
01363 if(visitNumber_ % visitNth_ == 0) {
01364 timer_.toc();
01365 times_.push_back(timer_.elapsedTime());
01366 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01367 values_.push_back(value);
01368 bounds_.push_back(bound);
01369 iterations_.push_back(visitNumber_);
01370 timer_.reset();
01371 if(verbose_) {
01372 if(multiline_)
01373 PrintFormated<true>::printAtVisit(visitNumber_,value,bound);
01374 else
01375 PrintFormated<false>::printAtVisit(visitNumber_, value, bound);
01376 }
01377 timer_.tic();
01378 }
01379 ++visitNumber_;
01380 }
01381
01382 template<class INFERENCE_TYPE>
01383 inline void
01384 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit
01385 (
01386 const INFERENCE_TYPE & inf
01387 ) {
01388 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01389 if(verbose_) {
01390 if(multiline_)
01391 PrintFormated<true>::printAtBegin(visitNumber_,value,bound);
01392 else
01393 PrintFormated<false>::printAtBegin(visitNumber_, value, bound);
01394 }
01395
01396 times_.push_back(0.0);
01397 values_.push_back(value);
01398 bounds_.push_back(bound);
01399 iterations_.push_back(IterationType(0));
01400 timer_.tic();
01401 }
01402
01403 template<class INFERENCE_TYPE>
01404 inline void
01405 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit
01406 (
01407 const INFERENCE_TYPE & inf
01408 ) {
01409 timer_.toc();
01410 times_.push_back(timer_.elapsedTime());
01411 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01412 values_.push_back(value);
01413 bounds_.push_back(bound);
01414 iterations_.push_back(visitNumber_);
01415 timer_.reset();
01416 if(verbose_) {
01417 if(multiline_)
01418 PrintFormated<true>::printAtEnd(visitNumber_,value,bound);
01419 else
01420 PrintFormated<false>::printAtEnd(visitNumber_, value, bound);
01421 };
01422 }
01423
01424 template<class INFERENCE_TYPE>
01425 template<class E1>
01426 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1) {
01427 if(visitNumber_ % visitNth_ == 0) {
01428 timer_.toc();
01429 times_.push_back(timer_.elapsedTime());
01430 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01431 values_.push_back(value);
01432 bounds_.push_back(bound);
01433 this->pushBackStringLogData(n1,e1);
01434 iterations_.push_back(visitNumber_);
01435 timer_.reset();
01436 if(verbose_) {
01437 if(multiline_)
01438 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,n1,e1);
01439 else
01440 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,n1,e1);
01441 }
01442 timer_.tic();
01443 }
01444 ++visitNumber_;
01445 }
01446
01447 template<class INFERENCE_TYPE>
01448 template<class E1>
01449 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1) {
01450 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01451 if(verbose_) {
01452 if(multiline_)
01453 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,n1,e1);
01454 else
01455 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,n1,e1);
01456 }
01457 times_.push_back(0);
01458 values_.push_back(value);
01459 bounds_.push_back(bound);
01460 this->reserveMapVector(n1);
01461 this->pushBackStringLogData(n1,e1);
01462 iterations_.push_back(IterationType(0));
01463 timer_.tic();
01464 }
01465
01466 template<class INFERENCE_TYPE>
01467 template<class E1>
01468 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1) {
01469 timer_.toc();
01470 times_.push_back(timer_.elapsedTime());
01471 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01472 values_.push_back(value);
01473 bounds_.push_back(bound);
01474 this->pushBackStringLogData(n1,e1);
01475 iterations_.push_back(visitNumber_);
01476 timer_.reset();
01477 if(verbose_) {
01478 if(multiline_)
01479 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,n1,e1);
01480 else
01481 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,n1,e1);
01482 };
01483 }
01484
01485
01486 template<class INFERENCE_TYPE>
01487 template<class E1,class E2>
01488 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2) {
01489 if(visitNumber_ % visitNth_ == 0) {
01490 timer_.toc();
01491 times_.push_back(timer_.elapsedTime());
01492 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01493 values_.push_back(value);
01494 bounds_.push_back(bound);
01495 this->pushBackStringLogData(n1,e1);
01496 this->pushBackStringLogData(n2,e2);
01497 iterations_.push_back(visitNumber_);
01498 timer_.reset();
01499 if(verbose_) {
01500 if(multiline_)
01501 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,n1,e1,n2,e2);
01502 else
01503 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,n1,e1,n2,e2);
01504 }
01505 timer_.tic();
01506 }
01507 ++visitNumber_;
01508 }
01509
01510 template<class INFERENCE_TYPE>
01511 template<class E1,class E2>
01512 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2) {
01513 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01514 if(verbose_) {
01515 if(multiline_)
01516 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,n1,e1,n2,e2);
01517 else
01518 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,n1,e1,n2,e2);
01519 }
01520 times_.push_back(0);
01521 values_.push_back(value);
01522 bounds_.push_back(bound);
01523 this->reserveMapVector(n1);
01524 this->pushBackStringLogData(n1,e1);
01525 this->reserveMapVector(n2);
01526 this->pushBackStringLogData(n2,e2);
01527 iterations_.push_back(IterationType(0));
01528 timer_.tic();
01529 }
01530
01531 template<class INFERENCE_TYPE>
01532 template<class E1,class E2>
01533 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2) {
01534 timer_.toc();;
01535 times_.push_back(timer_.elapsedTime());
01536 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01537 values_.push_back(value);
01538 bounds_.push_back(bound);
01539 this->pushBackStringLogData(n1,e1);
01540 this->pushBackStringLogData(n2,e2);
01541 iterations_.push_back(visitNumber_);
01542 timer_.reset();
01543 if(verbose_) {
01544 if(multiline_)
01545 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,n1,e1,n2,e2);
01546 else
01547 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,n1,e1,n2,e2);
01548 };
01549 }
01550
01551
01552 template<class INFERENCE_TYPE>
01553 template<class E1,class E2,class E3>
01554 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3) {
01555 if(visitNumber_ % visitNth_ == 0) {
01556 timer_.toc();
01557 times_.push_back(timer_.elapsedTime());
01558 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01559 values_.push_back(value);
01560 bounds_.push_back(bound);
01561 this->pushBackStringLogData(n1,e1);
01562 this->pushBackStringLogData(n2,e2);
01563 this->pushBackStringLogData(n3,e3);
01564 iterations_.push_back(visitNumber_);
01565 timer_.reset();
01566 if(verbose_) {
01567 if(multiline_)
01568 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,n1,e1,n2,e2,n3,e3);
01569 else
01570 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,n1,e1,n2,e2,n3,e3);
01571 }
01572 timer_.tic();
01573 }
01574 ++visitNumber_;
01575 }
01576
01577 template<class INFERENCE_TYPE>
01578 template<class E1,class E2,class E3>
01579 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3) {
01580 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01581 if(verbose_) {
01582 if(multiline_)
01583 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,n1,e1,n2,e2,n3,e3);
01584 else
01585 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,n1,e1,n2,e2,n3,e3);
01586 }
01587 times_.push_back(0);
01588 values_.push_back(value);
01589 bounds_.push_back(bound);
01590 this->reserveMapVector(n1);
01591 this->pushBackStringLogData(n1,e1);
01592 this->reserveMapVector(n2);
01593 this->pushBackStringLogData(n2,e2);
01594 this->reserveMapVector(n3);
01595 this->pushBackStringLogData(n3, e3);
01596 iterations_.push_back(IterationType(0));
01597 timer_.tic();
01598 }
01599
01600 template<class INFERENCE_TYPE>
01601 template<class E1,class E2,class E3>
01602 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit(const INFERENCE_TYPE & inf,const std::string & n1,const E1 e1,const std::string & n2,const E2 e2,const std::string & n3,const E3 e3) {
01603 timer_.toc();;
01604 times_.push_back(timer_.elapsedTime());
01605 const typename INFERENCE_TYPE::ValueType value=inf.value(),bound=inf.bound();
01606 values_.push_back(value);
01607 bounds_.push_back(bound);
01608 this->pushBackStringLogData(n1,e1);
01609 this->pushBackStringLogData(n2,e2);
01610 this->pushBackStringLogData(n3,e3);
01611 iterations_.push_back(visitNumber_);
01612 timer_.reset();
01613 if(verbose_) {
01614 if(multiline_)
01615 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,n1,e1,n2,e2,n3,e3);
01616 else
01617 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,n1,e1,n2,e2,n3,e3);
01618 };
01619 }
01620
01621
01622
01623
01624
01625
01626 template<class INFERENCE_TYPE>
01627 template<class T1,class T2>
01628 inline void
01629 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit
01630 (
01631 T1 value ,
01632 T2 bound
01633 ) {
01634 if(visitNumber_ % visitNth_ == 0) {
01635 timer_.toc();
01636 times_.push_back(timer_.elapsedTime());
01637 values_.push_back(value);
01638 bounds_.push_back(bound);
01639 iterations_.push_back(visitNumber_);
01640 timer_.reset();
01641 if(verbose_) {
01642 if(multiline_)
01643 PrintFormated<true>::printAtVisit(visitNumber_,value,bound);
01644 else
01645 PrintFormated<false>::printAtVisit(visitNumber_, value, bound);
01646 }
01647 timer_.tic();
01648 }
01649 ++visitNumber_;
01650 }
01651
01652 template<class INFERENCE_TYPE>
01653 template<class T1,class T2,class E1>
01654 inline void
01655 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit
01656 (
01657 T1 value ,
01658 T2 bound ,
01659 const std::string & name1,
01660 const E1 e1
01661 ) {
01662 if(visitNumber_ % visitNth_ == 0) {
01663 timer_.toc();
01664 times_.push_back(timer_.elapsedTime());
01665 values_.push_back(value);
01666 bounds_.push_back(bound);
01667 this->pushBackStringLogData(name1,e1);
01668 iterations_.push_back(visitNumber_);
01669 timer_.reset();
01670 if(verbose_) {
01671 if(multiline_)
01672 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,name1,e1);
01673 else
01674 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,name1,e1);
01675 }
01676 timer_.tic();
01677 }
01678 ++visitNumber_;
01679 }
01680
01681 template<class INFERENCE_TYPE>
01682 template<class T1,class T2,class E1,class E2>
01683 inline void
01684 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::visit
01685 (
01686 T1 value ,
01687 T2 bound ,
01688 const std::string & name1,
01689 const E1 e1,
01690 const std::string & name2,
01691 const E2 e2
01692 ) {
01693 if(visitNumber_ % visitNth_ == 0) {
01694 timer_.toc();
01695 times_.push_back(timer_.elapsedTime());
01696 values_.push_back(value);
01697 bounds_.push_back(bound);
01698 this->pushBackStringLogData(name1,e1);
01699 this->pushBackStringLogData(name2,e2);
01700 iterations_.push_back(visitNumber_);
01701 timer_.reset();
01702 if(verbose_) {
01703 if(multiline_)
01704 PrintFormated<true>::printAtVisit(visitNumber_,value,bound,name1,e1,name2,e2);
01705 else
01706 PrintFormated<false>::printAtVisit(visitNumber_, value, bound,name1,e1,name2,e2);
01707 }
01708 timer_.tic();
01709 }
01710 ++visitNumber_;
01711 }
01712
01713
01714 template<class INFERENCE_TYPE>
01715 template<class T1,class T2>
01716 inline void VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit
01717 (
01718 T1 value ,
01719 T2 bound
01720 ) {
01721 if(verbose_) {
01722 if(multiline_)
01723 PrintFormated<true>::printAtBegin(visitNumber_,value,bound);
01724 else
01725 PrintFormated<false>::printAtBegin(visitNumber_, value, bound);
01726 }
01727
01728 times_.push_back(0);
01729 values_.push_back(value);
01730 bounds_.push_back(bound);
01731 iterations_.push_back(IterationType(0));
01732 timer_.tic();
01733 }
01734
01735 template<class INFERENCE_TYPE>
01736 template<class T1,class T2,class E1>
01737 inline void
01738 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit
01739 (
01740 T1 value ,
01741 T2 bound ,
01742 const std::string & name1,
01743 const E1 e1
01744 ) {
01745 if(verbose_) {
01746 if(multiline_)
01747 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,name1,e1);
01748 else
01749 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,name1,e1);
01750 }
01751 times_.push_back(0);
01752 values_.push_back(value);
01753 bounds_.push_back(bound);
01754 this->reserveMapVector(name1);
01755 this->pushBackStringLogData(name1,e1);
01756 iterations_.push_back(IterationType(0));
01757 timer_.tic();
01758 }
01759
01760 template<class INFERENCE_TYPE>
01761 template<class T1,class T2,class E1,class E2>
01762 inline void
01763 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::beginVisit
01764 (
01765 T1 value ,
01766 T2 bound ,
01767 const std::string & name1,
01768 const E1 e1,
01769 const std::string & name2,
01770 const E2 e2
01771 ) {
01772 if(verbose_) {
01773 if(multiline_)
01774 PrintFormated<true>::printAtBegin(visitNumber_,value,bound,name1,e1);
01775 else
01776 PrintFormated<false>::printAtBegin(visitNumber_, value, bound,name1,e1);
01777 }
01778 times_.push_back(0);
01779 values_.push_back(value);
01780 bounds_.push_back(bound);
01781 this->reserveMapVector(name1);
01782 this->pushBackStringLogData(name1,e1);
01783 this->reserveMapVector(name2);
01784 this->pushBackStringLogData(name2,e2);
01785 iterations_.push_back(IterationType(0));
01786 timer_.tic();
01787 }
01788
01789 template<class INFERENCE_TYPE>
01790 template<class T1,class T2>
01791 inline void
01792 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit
01793 (
01794 T1 value ,
01795 T2 bound
01796 ) {
01797 timer_.toc();
01798 times_.push_back(timer_.elapsedTime());
01799 values_.push_back(value);
01800 bounds_.push_back(bound);
01801 iterations_.push_back(visitNumber_);
01802 timer_.reset();
01803 if(verbose_) {
01804 if(multiline_)
01805 PrintFormated<true>::printAtEnd(visitNumber_,value,bound);
01806 else
01807 PrintFormated<false>::printAtEnd(visitNumber_, value, bound);
01808 };
01809 }
01810
01811 template<class INFERENCE_TYPE>
01812 template<class T1,class T2,class E1>
01813 inline void
01814 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit
01815 (
01816 T1 value ,
01817 T2 bound ,
01818 const std::string & name1,
01819 const E1 e1
01820 ) {
01821 timer_.toc();
01822 times_.push_back(timer_.elapsedTime());
01823 values_.push_back(value);
01824 bounds_.push_back(bound);
01825 this->pushBackStringLogData(name1,e1);
01826 iterations_.push_back(visitNumber_);
01827 timer_.reset();
01828 if(verbose_) {
01829 if(multiline_)
01830 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,name1,e1);
01831 else
01832 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,name1,e1);
01833 };
01834 }
01835
01836 template<class INFERENCE_TYPE>
01837 template<class T1,class T2,class E1,class E2>
01838 inline void
01839 VisitorImplementation<INFERENCE_TYPE,TimingVisitor>::endVisit
01840 (
01841 T1 value ,
01842 T2 bound ,
01843 const std::string & name1,
01844 const E1 e1,
01845 const std::string & name2,
01846 const E2 e2
01847 ) {
01848 timer_.toc();
01849 times_.push_back(timer_.elapsedTime());
01850 values_.push_back(value);
01851 bounds_.push_back(bound);
01852 this->pushBackStringLogData(name1,e1);
01853 this->pushBackStringLogData(name2,e2);
01854 iterations_.push_back(visitNumber_);
01855 timer_.reset();
01856 if(verbose_) {
01857 if(multiline_)
01858 PrintFormated<true>::printAtEnd(visitNumber_,value,bound,name1,e1,name2,e2);
01859 else
01860 PrintFormated<false>::printAtEnd(visitNumber_, value, bound,name1,e1,name2,e2);
01861 };
01862 }
01863
01864 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01865 Visitor<INFERENCE_TYPE,VISITOR_TYPE>::Visitor()
01866 : VisitorImplementation<INFERENCE_TYPE,VISITOR_TYPE>() {
01867 }
01868
01869 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01870 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()() {
01871 const typename INFERENCE_TYPE::ValueType n= INFERENCE_TYPE::AccumulationType:: template neutral<typename INFERENCE_TYPE::ValueType>();
01872 const typename INFERENCE_TYPE::ValueType in= INFERENCE_TYPE::AccumulationType:: template ineutral<typename INFERENCE_TYPE::ValueType>();
01873 this->visit(n,in);
01874 }
01875
01876 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01877 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01878 (
01879 const INFERENCE_TYPE & inference
01880 ) {
01881 this->visit(inference);
01882 }
01883
01884 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01885 template<class T1>
01886 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01887 (
01888 const INFERENCE_TYPE & inference,
01889 const T1 value
01890 ) {
01891 const typename INFERENCE_TYPE::ValueType in= INFERENCE_TYPE::AccumulationType:: template ineutral<typename INFERENCE_TYPE::ValueType>();
01892 this->visit(value,in);
01893 }
01894
01895 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01896 template<class T1,class T2>
01897 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01898 (
01899 const INFERENCE_TYPE & inference,
01900 const T1 value,
01901 const T2 bound
01902 ) {
01903 this->visit(value,bound);
01904 }
01905
01906 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01907 template<class T1,class T2,class T3>
01908 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01909 (
01910 const INFERENCE_TYPE & inference,
01911 const T1 value,
01912 const T2 bound,
01913 const T3 & a3
01914 ) {
01915 this->visit(value,bound);
01916 }
01917
01918 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01919 template<class T1,class T2,class T3,class T4>
01920 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01921 (
01922 const INFERENCE_TYPE & inference,
01923 const T1 value,
01924 const T2 bound,
01925 const T3 & a3,
01926 const T4 & a4
01927 ) {
01928 this->visit(value,bound);
01929 }
01930
01931 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01932 template<class T1,class T2,class T3,class T4,class T5>
01933 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01934 (
01935 const INFERENCE_TYPE & inference,
01936 const T1 value,
01937 const T2 bound,
01938 const T3 & a3,
01939 const T4 & a4,
01940 const T5 & a5
01941 ) {
01942 this->visit(value,bound);
01943 }
01944
01945 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01946 template<class T1,class T2,class T3,class T4,class T5,class T6>
01947 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01948 (
01949 const INFERENCE_TYPE & inference,
01950 const T1 value,
01951 const T2 bound,
01952 const T3 & a3,
01953 const T4 & a4,
01954 const T5 & a5,
01955 const T6 & a6
01956 ) {
01957 this->visit(value,bound);
01958 }
01959
01960 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01961 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
01962 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01963 (
01964 const INFERENCE_TYPE & inference,
01965 const T1 value,
01966 const T2 bound,
01967 const T3 & a3,
01968 const T4 & a4,
01969 const T5 & a5,
01970 const T6 & a6,
01971 const T7 & a7
01972 ) {
01973 this->visit(value,bound);
01974 }
01975
01976 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01977 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
01978 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01979 (
01980 const INFERENCE_TYPE & inference,
01981 const T1 value,
01982 const T2 bound,
01983 const T3 & a3,
01984 const T4 & a4,
01985 const T5 & a5,
01986 const T6 & a6,
01987 const T7 & a7,
01988 const T8 & a8
01989 ) {
01990 this->visit(value,bound);
01991 }
01992
01993 template<class INFERENCE_TYPE,class VISITOR_TYPE>
01994 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
01995 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::operator()
01996 (
01997 const INFERENCE_TYPE & inference,
01998 const T1 value,
01999 const T2 bound,
02000 const T3 & a3,
02001 const T4 & a4,
02002 const T5 & a5,
02003 const T6 & a6,
02004 const T7 & a7,
02005 const T8 & a8,
02006 const T9 & a9
02007 ) {
02008 this->visit(value,bound);
02009 }
02010
02011 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02012 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin() {
02013 const typename INFERENCE_TYPE::ValueType n= INFERENCE_TYPE::AccumulationType:: template neutral<typename INFERENCE_TYPE::ValueType>();
02014 const typename INFERENCE_TYPE::ValueType in= INFERENCE_TYPE::AccumulationType:: template ineutral<typename INFERENCE_TYPE::ValueType>();
02015 this->beginVisit(n,in);
02016 }
02017
02018 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02019 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02020 (
02021 const INFERENCE_TYPE & inference
02022 ) {
02023 this->beginVisit(inference);
02024 }
02025
02026 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02027 template<class T1>
02028 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02029 (
02030 const INFERENCE_TYPE & inference,
02031 const T1 value
02032 ) {
02033 const typename INFERENCE_TYPE::ValueType in= INFERENCE_TYPE::AccumulationType:: template ineutral<typename INFERENCE_TYPE::ValueType>();
02034 this->begin(value,in);
02035 }
02036
02037
02038 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02039 template<class T1,class T2>
02040 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02041 (
02042 const INFERENCE_TYPE & inference,
02043 const T1 value,
02044 const T2 bound
02045 ) {
02046 this->beginVisit(value,bound);
02047 }
02048
02049
02050 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02051 template<class T1,class T2,class T3>
02052 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02053 (
02054 const INFERENCE_TYPE & inference,
02055 const T1 value,
02056 const T2 bound,
02057 const T3 & a3
02058 ) {
02059 this->beginVisit(value,bound);
02060 }
02061
02062
02063 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02064 template<class T1,class T2,class T3,class T4>
02065 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02066 (
02067 const INFERENCE_TYPE & inference,
02068 const T1 value,
02069 const T2 bound,
02070 const T3 & a3,
02071 const T4 & a4
02072 ) {
02073 this->beginVisit(value,bound);
02074 }
02075
02076
02077 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02078 template<class T1,class T2,class T3,class T4,class T5>
02079 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02080 (
02081 const INFERENCE_TYPE & inference,
02082 const T1 value,
02083 const T2 bound,
02084 const T3 & a3,
02085 const T4 & a4,
02086 const T5 & a5
02087 ) {
02088 this->beginVisit(value,bound);
02089 }
02090
02091
02092 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02093 template<class T1,class T2,class T3,class T4,class T5,class T6>
02094 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02095 (
02096 const INFERENCE_TYPE & inference,
02097 const T1 value,
02098 const T2 bound,
02099 const T3 & a3,
02100 const T4 & a4,
02101 const T5 & a5,
02102 const T6 & a6
02103 ) {
02104 this->beginVisit(value,bound);
02105 }
02106
02107
02108 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02109 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
02110 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02111 (
02112 const INFERENCE_TYPE & inference,
02113 const T1 value,
02114 const T2 bound,
02115 const T3 & a3,
02116 const T4 & a4,
02117 const T5 & a5,
02118 const T6 & a6,
02119 const T7 & a7
02120 ) {
02121 this->beginVisit(value,bound);
02122 }
02123
02124
02125 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02126 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
02127 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02128 (
02129 const INFERENCE_TYPE & inference,
02130 const T1 value,
02131 const T2 bound,
02132 const T3 & a3,
02133 const T4 & a4,
02134 const T5 & a5,
02135 const T6 & a6,
02136 const T7 & a7,
02137 const T8 & a8
02138 ) {
02139 this->beginVisit(value,bound);
02140 }
02141
02142 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02143 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
02144 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::begin
02145 (
02146 const INFERENCE_TYPE & inference,
02147 const T1 value,
02148 const T2 bound,
02149 const T3 & a3,
02150 const T4 & a4,
02151 const T5 & a5,
02152 const T6 & a6,
02153 const T7 & a7,
02154 const T8 & a8,
02155 const T9 & a9
02156 ) {
02157 this->beginVisit(value,bound);
02158 }
02159
02160 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02161 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end() {
02162 const typename INFERENCE_TYPE::ValueType n= INFERENCE_TYPE::AccumulationType:: template neutral<typename INFERENCE_TYPE::ValueType>();
02163 const typename INFERENCE_TYPE::ValueType in= INFERENCE_TYPE::AccumulationType:: template ineutral<typename INFERENCE_TYPE::ValueType>();
02164 this->endVisit(n,in);
02165 }
02166
02167
02168 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02169 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02170 (
02171 const INFERENCE_TYPE & inference
02172 ) {
02173
02174 this->endVisit(inference);
02175 }
02176
02177 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02178 template<class T1>
02179 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02180 (
02181 const INFERENCE_TYPE & inference,
02182 const T1 value
02183 ) {
02184 const typename INFERENCE_TYPE::ValueType in= INFERENCE_TYPE::AccumulationType:: template ineutral<typename INFERENCE_TYPE::ValueType>();
02185 this->endVisit(value,in);
02186 }
02187
02188 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02189 template<class T1,class T2>
02190 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02191 (
02192 const INFERENCE_TYPE & inference,
02193 const T1 value,
02194 const T2 bound
02195 ) {
02196 this->endVisit(value,bound);
02197 }
02198
02199 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02200 template<class T1,class T2,class T3>
02201 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02202 (
02203 const INFERENCE_TYPE & inference,
02204 const T1 value,
02205 const T2 bound,
02206 const T3 & a3
02207 ) {
02208 this->endVisit(value,bound);
02209 }
02210
02211 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02212 template<class T1,class T2,class T3,class T4>
02213 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02214 (
02215 const INFERENCE_TYPE & inference,
02216 const T1 value,
02217 const T2 bound,
02218 const T3 & a3,
02219 const T4 & a4
02220 ) {
02221 this->endVisit(value,bound);
02222 }
02223
02224 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02225 template<class T1,class T2,class T3,class T4,class T5>
02226 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02227 (
02228 const INFERENCE_TYPE & inference,
02229 const T1 value,
02230 const T2 bound,
02231 const T3 & a3,
02232 const T4 & a4,
02233 const T5 & a5
02234 ) {
02235 this->endVisit(value,bound);
02236 }
02237
02238 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02239 template<class T1,class T2,class T3,class T4,class T5,class T6>
02240 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02241 (
02242 const INFERENCE_TYPE & inference,
02243 const T1 value,
02244 const T2 bound,
02245 const T3 & a3,
02246 const T4 & a4,
02247 const T5 & a5,
02248 const T6 & a6
02249 ) {
02250 this->endVisit(value,bound);
02251 }
02252
02253 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02254 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7>
02255 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02256 (
02257 const INFERENCE_TYPE & inference,
02258 const T1 value,
02259 const T2 bound,
02260 const T3 & a3,
02261 const T4 & a4,
02262 const T5 & a5,
02263 const T6 & a6,
02264 const T7 & a7
02265 ) {
02266 this->endVisit(value,bound);
02267 }
02268
02269 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02270 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8>
02271 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02272 (
02273 const INFERENCE_TYPE & inference,
02274 const T1 value,
02275 const T2 bound,
02276 const T3 & a3,
02277 const T4 & a4,
02278 const T5 & a5,
02279 const T6 & a6,
02280 const T7 & a7,
02281 const T8 & a8
02282 ) {
02283 this->endVisit(value,bound);
02284 }
02285
02286 template<class INFERENCE_TYPE,class VISITOR_TYPE>
02287 template<class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9>
02288 inline void Visitor<INFERENCE_TYPE,VISITOR_TYPE>::end
02289 (
02290 const INFERENCE_TYPE & inference,
02291 const T1 value,
02292 const T2 bound,
02293 const T3 & a3,
02294 const T4 & a4,
02295 const T5 & a5,
02296 const T6 & a6,
02297 const T7 & a7,
02298 const T8 & a8,
02299 const T9 & a9
02300 ) {
02301 this->endVisit(value,bound);
02302 }
02303
02304 }
02305
02307
02308 }
02309
02310 #endif