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);
std::string toString() const override
void setMaxUpdates(unsigned int maxUpdates)
std::string toCSV() const
void operator=(std::string sth)
void resetValue() override
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()
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 void setName(std::string name)
unsigned int expectedSize_
void resetValue() override
void resetValue() override
std::string toString() const override
JsonMonPtr(JsonMonitorable *ptr)
std::string toString() const override
void operator=(double sth)
virtual void resetValue()=0
std::string toString() const override
HistoJ(int expectedUpdates=1, unsigned int maxUpdates=0)
void resetValue() override
JsonMonitorable * operator->()
unsigned int getMaxUpdates()
array value (ordered list)
void operator=(JsonMonitorable *ptr)