namespace Stats {
+std::string Info::separatorString = "::";
typedef map<const void *, Info *> MapType;
// We wrap these in a function to make sure they're built in time.
}
const std::string &name() const { return this->info()->name; }
+ /**
+ * Set the character(s) used between the name and vector number
+ * on vectors, dist, etc.
+ * @param _sep The new separator string
+ * @return A reference to this stat.
+ */
+ Derived &
+ setSeparator(const std::string &_sep)
+ {
+ this->info()->setSeparator(_sep);
+ return this->self();
+ }
+ const std::string &setSeparator() const
+ {
+ return this->info()->separatorString;
+ }
+
/**
* Set the description and marks this stat to print at the end of
* simulation.
public:
/** The name of the stat. */
std::string name;
+ /** The separator string used for vectors, dist, etc. */
+ static std::string separatorString;
/** The description of the stat. */
std::string desc;
/** The formatting flags. */
/** Set the name of this statistic */
void setName(const std::string &name);
+ void setSeparator(std::string _sep) { separatorString = _sep;}
/**
* Check that this stat has been set up properly and is ready for
struct VectorPrint
{
string name;
+ string separatorString;
string desc;
vector<string> subnames;
vector<string> subdescs;
}
}
- string base = name + "::";
+ string base = name + separatorString;
ScalarPrint print;
print.name = name;
struct DistPrint
{
string name;
+ string separatorString;
string desc;
Flags flags;
bool descriptions;
DistPrint::init(const Text *text, const Info &info)
{
name = info.name;
+ separatorString = info.separatorString;
desc = info.desc;
flags = info.flags;
precision = info.precision;
void
DistPrint::operator()(ostream &stream) const
{
- string base = name + "::";
+ string base = name + separatorString;
ScalarPrint print;
print.precision = precision;
VectorPrint print;
print.name = info.name;
+ print.separatorString = info.separatorString;
print.desc = info.desc;
print.flags = info.flags;
print.descriptions = descriptions;
print.subnames = info.y_subnames;
print.flags = info.flags;
+ print.separatorString = info.separatorString;
print.descriptions = descriptions;
print.precision = info.precision;