8 #ifndef JSON_MONITORABLE_H 9 #define JSON_MONITORABLE_H 125 std::stringstream ss;
196 HistoJ(
int expectedUpdates = 1 ,
unsigned int maxUpdates = 0 ){
197 expectedSize_=expectedUpdates;
199 maxUpdates_ = maxUpdates;
200 if (maxUpdates_ && maxUpdates_<expectedSize_) expectedSize_=maxUpdates_;
201 histo_.reserve(expectedSize_);
206 std::stringstream ss;
209 if (
i!=histo_.size()-1) ss<<
",";
215 std::stringstream ss;
218 for (
unsigned int i = 0;
i < histo_.size();
i++) {
220 if (
i<histo_.size()-1) ss <<
",";
227 for (
unsigned int i = 0;
i < histo_.size();
i++) {
234 histo_.reserve(expectedSize_);
246 return expectedSize_;
254 maxUpdates_=maxUpdates;
255 if (!maxUpdates_)
return;
256 if (expectedSize_>maxUpdates_) expectedSize_=maxUpdates_;
258 if (maxUpdates_ && histo_.size()>maxUpdates_) {
259 histo_.resize(maxUpdates_);
261 else histo_.reserve(expectedSize_);
265 return histo_.size();
269 if (maxUpdates_ &&
updates_>=maxUpdates_)
return;
270 histo_.push_back(val);
void setMaxUpdates(unsigned int maxUpdates)
std::string toCSV() const
void operator=(std::string sth)
virtual void resetValue()
virtual std::string & getName()
virtual ~JsonMonitorable()
Value & append(const Value &value)
Append value to array at the end.
void update(std::string const &newStr)
unsigned int getUpdates()
virtual std::string toString() const
unsigned int getExpectedSize()
virtual Json::Value toJsonValue() const
void operator=(std::vector< T > &sth)
std::vector< T > & value()
virtual std::string toString() const =0
void concatenate(std::string const &added)
virtual std::string toString() const
virtual void setName(std::string name)
unsigned int expectedSize_
virtual std::string toString() const
JsonMonPtr(JsonMonitorable *ptr)
void operator=(double sth)
virtual void resetValue()=0
virtual void resetValue()
virtual void resetValue()
virtual std::string toString() const
HistoJ(int expectedUpdates=1, unsigned int maxUpdates=0)
JsonMonitorable * operator->()
virtual void resetValue()
unsigned int getMaxUpdates()
array value (ordered list)
void operator=(JsonMonitorable *ptr)