8 #ifndef JSON_MONITORABLE_H 9 #define JSON_MONITORABLE_H 88 long&
value() {
return theVar_; }
114 std::stringstream
ss;
162 theVar_ +=
"," + added;
178 HistoJ(
int expectedUpdates = 1,
unsigned int maxUpdates = 0) {
179 expectedSize_ = expectedUpdates;
181 maxUpdates_ = maxUpdates;
182 if (maxUpdates_ && maxUpdates_ < expectedSize_)
183 expectedSize_ = maxUpdates_;
184 histo_.reserve(expectedSize_);
189 std::stringstream
ss;
192 if (
i != histo_.size() - 1)
199 std::stringstream
ss;
202 for (
unsigned int i = 0;
i < histo_.size();
i++) {
204 if (
i < histo_.size() - 1)
212 for (
unsigned int i = 0;
i < histo_.size();
i++) {
219 histo_.reserve(expectedSize_);
224 std::vector<T>&
value() {
return histo_; }
231 maxUpdates_ = maxUpdates;
234 if (expectedSize_ > maxUpdates_)
235 expectedSize_ = maxUpdates_;
237 if (maxUpdates_ && histo_.size() > maxUpdates_) {
238 histo_.resize(maxUpdates_);
240 histo_.reserve(expectedSize_);
243 unsigned int getSize() {
return histo_.size(); }
246 if (maxUpdates_ &&
updates_ >= maxUpdates_)
248 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)