*/
static bool less(Info *stat1, Info *stat2);
};
+struct StorageParams;
template <class Stat, class Base>
-class InfoWrap : public Base
+class InfoProxy : public Base
{
protected:
Stat &s;
public:
- InfoWrap(Stat &stat) : s(stat) {}
+ InfoProxy(Stat &stat) : s(stat) {}
bool check() const { return s.check(); }
void prepare() { s.prepare(); }
bool zero() const { return s.zero(); }
};
-class ScalarInfoBase : public Info
+class ScalarInfo : public Info
{
public:
virtual Counter value() const = 0;
};
template <class Stat>
-class ScalarInfo : public InfoWrap<Stat, ScalarInfoBase>
+class ScalarInfoProxy : public InfoProxy<Stat, ScalarInfo>
{
public:
- ScalarInfo(Stat &stat) : InfoWrap<Stat, ScalarInfoBase>(stat) {}
+ ScalarInfoProxy(Stat &stat) : InfoProxy<Stat, ScalarInfo>(stat) {}
Counter value() const { return this->s.value(); }
Result result() const { return this->s.result(); }
Result total() const { return this->s.total(); }
};
-class VectorInfoBase : public Info
+class VectorInfo : public Info
{
public:
/** Names and descriptions of subfields. */
};
template <class Stat>
-class VectorInfo : public InfoWrap<Stat, VectorInfoBase>
+class VectorInfoProxy : public InfoProxy<Stat, VectorInfo>
{
protected:
mutable VCounter cvec;
mutable VResult rvec;
public:
- VectorInfo(Stat &stat) : InfoWrap<Stat, VectorInfoBase>(stat) {}
+ VectorInfoProxy(Stat &stat) : InfoProxy<Stat, VectorInfo>(stat) {}
size_type size() const { return this->s.size(); }
Counter samples;
};
-class DistInfoBase : public Info
+class DistInfo : public Info
{
public:
/** Local storage for the entry values, used for printing. */
};
template <class Stat>
-class DistInfo : public InfoWrap<Stat, DistInfoBase>
+class DistInfoProxy : public InfoProxy<Stat, DistInfo>
{
public:
- DistInfo(Stat &stat) : InfoWrap<Stat, DistInfoBase>(stat) {}
+ DistInfoProxy(Stat &stat) : InfoProxy<Stat, DistInfo>(stat) {}
};
-class VectorDistInfoBase : public Info
+class VectorDistInfo : public Info
{
public:
std::vector<DistData> data;
};
template <class Stat>
-class VectorDistInfo : public InfoWrap<Stat, VectorDistInfoBase>
+class VectorDistInfoProxy : public InfoProxy<Stat, VectorDistInfo>
{
public:
- VectorDistInfo(Stat &stat) : InfoWrap<Stat, VectorDistInfoBase>(stat) {}
+ VectorDistInfoProxy(Stat &stat) : InfoProxy<Stat, VectorDistInfo>(stat) {}
size_type size() const { return this->s.size(); }
};
-class Vector2dInfoBase : public Info
+class Vector2dInfo : public Info
{
public:
/** Names and descriptions of subfields. */
};
template <class Stat>
-class Vector2dInfo : public InfoWrap<Stat, Vector2dInfoBase>
+class Vector2dInfoProxy : public InfoProxy<Stat, Vector2dInfo>
{
public:
- Vector2dInfo(Stat &stat) : InfoWrap<Stat, Vector2dInfoBase>(stat) {}
+ Vector2dInfoProxy(Stat &stat) : InfoProxy<Stat, Vector2dInfo>(stat) {}
};
class InfoAccess
bool check() const { return true; }
};
-template <class Derived, template <class> class InfoType>
+template <class Derived, template <class> class InfoProxyType>
class DataWrap : public InfoAccess
{
public:
- typedef InfoType<Derived> Info;
+ typedef InfoProxyType<Derived> Info;
protected:
Derived &self() { return *static_cast<Derived *>(this); }
}
};
-template <class Derived, template <class> class InfoType>
-class DataWrapVec : public DataWrap<Derived, InfoType>
+template <class Derived, template <class> class InfoProxyType>
+class DataWrapVec : public DataWrap<Derived, InfoProxyType>
{
public:
- typedef InfoType<Derived> Info;
+ typedef InfoProxyType<Derived> Info;
// The following functions are specific to vectors. If you use them
// in a non vector context, you will get a nice compiler error!
}
};
-template <class Derived, template <class> class InfoType>
-class DataWrapVec2d : public DataWrapVec<Derived, InfoType>
+template <class Derived, template <class> class InfoProxyType>
+class DataWrapVec2d : public DataWrapVec<Derived, InfoProxyType>
{
public:
- typedef InfoType<Derived> Info;
+ typedef InfoProxyType<Derived> Info;
/**
* @warning This makes the assumption that if you're gonna subnames a 2d
* Storage template.
*/
template <class Derived, class Stor>
-class ScalarBase : public DataWrap<Derived, ScalarInfo>
+class ScalarBase : public DataWrap<Derived, ScalarInfoProxy>
{
public:
typedef Stor Storage;
void prepare() { data()->prepare(this->info()); }
};
-class ProxyInfo : public ScalarInfoBase
+class ProxyInfo : public ScalarInfo
{
public:
std::string str() const { return to_string(value()); }
};
template <class Derived>
-class ValueBase : public DataWrap<Derived, ScalarInfo>
+class ValueBase : public DataWrap<Derived, ScalarInfoProxy>
{
private:
ProxyInfo *proxy;
* Storage class. @sa ScalarBase
*/
template <class Derived, class Stor>
-class VectorBase : public DataWrapVec<Derived, VectorInfo>
+class VectorBase : public DataWrapVec<Derived, VectorInfoProxy>
{
public:
typedef Stor Storage;
/** Proxy type */
typedef ScalarProxy<Derived> Proxy;
friend class ScalarProxy<Derived>;
- friend class DataWrapVec<Derived, VectorInfo>;
+ friend class DataWrapVec<Derived, VectorInfoProxy>;
protected:
/** The storage of this stat. */
};
template <class Derived, class Stor>
-class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfo>
+class Vector2dBase : public DataWrapVec2d<Derived, Vector2dInfoProxy>
{
public:
- typedef Vector2dInfo<Derived> Info;
+ typedef Vector2dInfoProxy<Derived> Info;
typedef Stor Storage;
typedef typename Stor::Params Params;
typedef VectorProxy<Derived> Proxy;
friend class ScalarProxy<Derived>;
friend class VectorProxy<Derived>;
- friend class DataWrapVec<Derived, Vector2dInfo>;
- friend class DataWrapVec2d<Derived, Vector2dInfo>;
+ friend class DataWrapVec<Derived, Vector2dInfoProxy>;
+ friend class DataWrapVec2d<Derived, Vector2dInfoProxy>;
protected:
size_type x;
* determined by the Storage template. @sa ScalarBase
*/
template <class Derived, class Stor>
-class DistBase : public DataWrap<Derived, DistInfo>
+class DistBase : public DataWrap<Derived, DistInfoProxy>
{
public:
- typedef DistInfo<Derived> Info;
+ typedef DistInfoProxy<Derived> Info;
typedef Stor Storage;
typedef typename Stor::Params Params;
class DistProxy;
template <class Derived, class Stor>
-class VectorDistBase : public DataWrapVec<Derived, VectorDistInfo>
+class VectorDistBase : public DataWrapVec<Derived, VectorDistInfoProxy>
{
public:
- typedef VectorDistInfo<Derived> Info;
+ typedef VectorDistInfoProxy<Derived> Info;
typedef Stor Storage;
typedef typename Stor::Params Params;
typedef DistProxy<Derived> Proxy;
friend class DistProxy<Derived>;
- friend class DataWrapVec<Derived, VectorDistInfo>;
+ friend class DataWrapVec<Derived, VectorDistInfoProxy>;
protected:
Storage *storage;
class ScalarStatNode : public Node
{
private:
- const ScalarInfoBase *data;
+ const ScalarInfo *data;
mutable VResult vresult;
public:
- ScalarStatNode(const ScalarInfoBase *d) : data(d), vresult(1) {}
+ ScalarStatNode(const ScalarInfo *d) : data(d), vresult(1) {}
const VResult &
result() const
class VectorStatNode : public Node
{
private:
- const VectorInfoBase *data;
+ const VectorInfo *data;
public:
- VectorStatNode(const VectorInfoBase *d) : data(d) { }
+ VectorStatNode(const VectorInfo *d) : data(d) { }
const VResult &result() const { return data->result(); }
Result total() const { return data->total(); };
}
};
-class FormulaInfoBase : public VectorInfoBase
+class FormulaInfo : public VectorInfo
{
public:
virtual std::string str() const = 0;
};
template <class Stat>
-class FormulaInfo : public InfoWrap<Stat, FormulaInfoBase>
+class FormulaInfoProxy : public InfoProxy<Stat, FormulaInfo>
{
protected:
mutable VResult vec;
mutable VCounter cvec;
public:
- FormulaInfo(Stat &stat) : InfoWrap<Stat, FormulaInfoBase>(stat) {}
+ FormulaInfoProxy(Stat &stat) : InfoProxy<Stat, FormulaInfo>(stat) {}
size_type size() const { return this->s.size(); }
* stored as a tree of Nodes that represent the equation to calculate.
* @sa Stat, ScalarStat, VectorStat, Node, Temp
*/
-class Formula : public DataWrapVec<Formula, FormulaInfo>
+class Formula : public DataWrapVec<Formula, FormulaInfoProxy>
{
protected:
/** The root of the tree which represents the Formula */
}
void
-MySql::configure(const ScalarInfoBase &info)
+MySql::configure(const ScalarInfo &info)
{
if (!configure(info, "SCALAR"))
return;
}
void
-MySql::configure(const VectorInfoBase &info)
+MySql::configure(const VectorInfo &info)
{
if (!configure(info, "VECTOR"))
return;
}
void
-MySql::configure(const DistInfoBase &info)
+MySql::configure(const DistInfo &info)
{
if (!configure(info, "DIST"))
return;
}
void
-MySql::configure(const VectorDistInfoBase &info)
+MySql::configure(const VectorDistInfo &info)
{
if (!configure(info, "VECTORDIST"))
return;
}
void
-MySql::configure(const Vector2dInfoBase &info)
+MySql::configure(const Vector2dInfo &info)
{
if (!configure(info, "VECTOR2D"))
return;
}
void
-MySql::configure(const FormulaInfoBase &info)
+MySql::configure(const FormulaInfo &info)
{
MySQL::Connection &mysql = run->conn();
assert(mysql.connected());
}
void
-MySql::output(const ScalarInfoBase &info)
+MySql::output(const ScalarInfo &info)
{
if (!(info.flags & print))
return;
}
void
-MySql::output(const VectorInfoBase &info)
+MySql::output(const VectorInfo &info)
{
if (!(info.flags & print))
return;
}
void
-MySql::output(const DistInfoBase &info)
+MySql::output(const DistInfo &info)
{
if (!(info.flags & print))
return;
}
void
-MySql::output(const VectorDistInfoBase &info)
+MySql::output(const VectorDistInfo &info)
{
if (!(info.flags & print))
return;
}
void
-MySql::output(const Vector2dInfoBase &info)
+MySql::output(const Vector2dInfo &info)
{
if (!(info.flags & print))
return;
}
void
-MySql::output(const FormulaInfoBase &info)
+MySql::output(const FormulaInfo &info)
{
}
* Implement the visitor
*/
void
-MySql::visit(const ScalarInfoBase &info)
+MySql::visit(const ScalarInfo &info)
{
if (!configured)
configure(info);
}
void
-MySql::visit(const VectorInfoBase &info)
+MySql::visit(const VectorInfo &info)
{
if (!configured)
configure(info);
}
void
-MySql::visit(const DistInfoBase &info)
+MySql::visit(const DistInfo &info)
{
return;
if (!configured)
}
void
-MySql::visit(const VectorDistInfoBase &info)
+MySql::visit(const VectorDistInfo &info)
{
return;
if (!configured)
}
void
-MySql::visit(const Vector2dInfoBase &info)
+MySql::visit(const Vector2dInfo &info)
{
return;
if (!configured)
}
void
-MySql::visit(const FormulaInfoBase &info)
+MySql::visit(const FormulaInfo &info)
{
if (!configured)
configure(info);
namespace MySQL { class Connection; }
namespace Stats {
-class DistInfoBase;
+class DistInfo;
class MySqlRun;
struct SetupStat
SetupStat stat;
InsertData newdata;
InsertEvent newevent;
- std::list<FormulaInfoBase *> formulas;
+ std::list<FormulaInfo *> formulas;
bool configured;
protected:
public:
// Implement Visit
- virtual void visit(const ScalarInfoBase &info);
- virtual void visit(const VectorInfoBase &info);
- virtual void visit(const DistInfoBase &info);
- virtual void visit(const VectorDistInfoBase &info);
- virtual void visit(const Vector2dInfoBase &info);
- virtual void visit(const FormulaInfoBase &info);
+ virtual void visit(const ScalarInfo &info);
+ virtual void visit(const VectorInfo &info);
+ virtual void visit(const DistInfo &info);
+ virtual void visit(const VectorDistInfo &info);
+ virtual void visit(const Vector2dInfo &info);
+ virtual void visit(const FormulaInfo &info);
// Implement Output
virtual bool valid() const;
protected:
// Output helper
- void output(const ScalarInfoBase &info);
- void output(const VectorInfoBase &info);
- void output(const DistInfoBase &info);
- void output(const VectorDistInfoBase &info);
- void output(const Vector2dInfoBase &info);
- void output(const FormulaInfoBase &info);
+ void output(const ScalarInfo &info);
+ void output(const VectorInfo &info);
+ void output(const DistInfo &info);
+ void output(const VectorDistInfo &info);
+ void output(const Vector2dInfo &info);
+ void output(const FormulaInfo &info);
void output(const DistData &data, const DistParams *params);
void configure();
bool configure(const Info &info, std::string type);
- void configure(const ScalarInfoBase &info);
- void configure(const VectorInfoBase &info);
- void configure(const DistInfoBase &info);
- void configure(const VectorDistInfoBase &info);
- void configure(const Vector2dInfoBase &info);
- void configure(const FormulaInfoBase &info);
+ void configure(const ScalarInfo &info);
+ void configure(const VectorInfo &info);
+ void configure(const DistInfo &info);
+ void configure(const VectorDistInfo &info);
+ void configure(const Vector2dInfo &info);
+ void configure(const FormulaInfo &info);
};
bool initMySQL(std::string host, std::string database, std::string user,