CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
jsoncollector::HistoJ< T > Class Template Reference

#include <JsonMonitorable.h>

Inheritance diagram for jsoncollector::HistoJ< T >:
jsoncollector::JsonMonitorable

Public Member Functions

unsigned int getExpectedSize ()
 
unsigned int getMaxUpdates ()
 
unsigned int getSize ()
 
 HistoJ (int expectedUpdates=1, unsigned int maxUpdates=0)
 
void operator= (std::vector< T > &sth)
 
void resetValue () override
 
void setMaxUpdates (unsigned int maxUpdates)
 
std::string toCSV () const
 
virtual Json::Value toJsonValue () const
 
std::string toString () const override
 
void update (T val)
 
std::vector< T > & value ()
 
 ~HistoJ () override
 
- Public Member Functions inherited from jsoncollector::JsonMonitorable
virtual std::string & getName ()
 
bool getNotSame ()
 
unsigned int getUpdates ()
 
 JsonMonitorable ()
 
virtual void setName (std::string name)
 
virtual ~JsonMonitorable ()
 

Private Attributes

unsigned int expectedSize_
 
std::vector< Thisto_
 
unsigned int maxUpdates_
 

Additional Inherited Members

- Protected Attributes inherited from jsoncollector::JsonMonitorable
std::string name_
 
bool notSame_
 
unsigned int updates_
 

Detailed Description

template<class T>
class jsoncollector::HistoJ< T >

Definition at line 176 of file JsonMonitorable.h.

Constructor & Destructor Documentation

template<class T>
jsoncollector::HistoJ< T >::HistoJ ( int  expectedUpdates = 1,
unsigned int  maxUpdates = 0 
)
inline

Definition at line 178 of file JsonMonitorable.h.

178  {
179  expectedSize_ = expectedUpdates;
180  updates_ = 0;
181  maxUpdates_ = maxUpdates;
184  histo_.reserve(expectedSize_);
185  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
jsoncollector::HistoJ< T >::~HistoJ ( )
inlineoverride

Definition at line 186 of file JsonMonitorable.h.

186 {}

Member Function Documentation

template<class T>
unsigned int jsoncollector::HistoJ< T >::getExpectedSize ( )
inline

Definition at line 226 of file JsonMonitorable.h.

226 { return expectedSize_; }
unsigned int expectedSize_
template<class T>
unsigned int jsoncollector::HistoJ< T >::getMaxUpdates ( )
inline

Definition at line 228 of file JsonMonitorable.h.

228 { return maxUpdates_; }
template<class T>
unsigned int jsoncollector::HistoJ< T >::getSize ( )
inline

Definition at line 243 of file JsonMonitorable.h.

243 { return histo_.size(); }
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::operator= ( std::vector< T > &  sth)
inline

Definition at line 222 of file JsonMonitorable.h.

222 { histo_ = sth; }
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::resetValue ( )
inlineoverridevirtual

Implements jsoncollector::JsonMonitorable.

Definition at line 217 of file JsonMonitorable.h.

217  {
218  histo_.clear();
219  histo_.reserve(expectedSize_);
220  updates_ = 0;
221  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::setMaxUpdates ( unsigned int  maxUpdates)
inline

Definition at line 230 of file JsonMonitorable.h.

230  {
231  maxUpdates_ = maxUpdates;
232  if (!maxUpdates_)
233  return;
236  //truncate what is over the limit
237  if (maxUpdates_ && histo_.size() > maxUpdates_) {
238  histo_.resize(maxUpdates_);
239  } else
240  histo_.reserve(expectedSize_);
241  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
std::string jsoncollector::HistoJ< T >::toCSV ( ) const
inline

Definition at line 188 of file JsonMonitorable.h.

188  {
189  std::stringstream ss;
190  for (unsigned int i = 0; i < updates_; i++) {
191  ss << histo_[i];
192  if (i != histo_.size() - 1)
193  ss << ",";
194  }
195  return ss.str();
196  }
std::vector< T > histo_
template<class T>
virtual Json::Value jsoncollector::HistoJ< T >::toJsonValue ( ) const
inlinevirtual

Definition at line 210 of file JsonMonitorable.h.

Referenced by HLTriggerJSONMonitoring::globalEndLuminosityBlockSummary(), and L1TriggerJSONMonitoring::globalEndLuminosityBlockSummary().

210  { //TODO
211  Json::Value jsonValue(Json::arrayValue);
212  for (unsigned int i = 0; i < histo_.size(); i++) {
213  jsonValue.append(histo_[i]);
214  }
215  return jsonValue;
216  }
Represents a JSON value.
Definition: value.h:99
std::vector< T > histo_
array value (ordered list)
Definition: value.h:30
template<class T>
std::string jsoncollector::HistoJ< T >::toString ( ) const
inlineoverridevirtual

Implements jsoncollector::JsonMonitorable.

Definition at line 198 of file JsonMonitorable.h.

198  {
199  std::stringstream ss;
200  ss << "[";
201  if (!histo_.empty())
202  for (unsigned int i = 0; i < histo_.size(); i++) {
203  ss << histo_[i];
204  if (i < histo_.size() - 1)
205  ss << ",";
206  }
207  ss << "]";
208  return ss.str();
209  }
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::update ( T  val)
inline

Definition at line 245 of file JsonMonitorable.h.

Referenced by progressbar.ProgressBar::__next__(), MatrixUtil.Matrix::__setitem__(), MatrixUtil.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), L1TriggerJSONMonitoring::globalEndLuminosityBlockSummary(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), MatrixUtil.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), jsoncollector::DataPoint::snap(), jsoncollector::DataPoint::snapStreamAtomic(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

245  {
246  if (maxUpdates_ && updates_ >= maxUpdates_)
247  return;
248  histo_.push_back(val);
249  updates_++;
250  }
std::vector< T > histo_
template<class T>
std::vector<T>& jsoncollector::HistoJ< T >::value ( )
inline

Member Data Documentation

template<class T>
unsigned int jsoncollector::HistoJ< T >::expectedSize_
private

Definition at line 254 of file JsonMonitorable.h.

template<class T>
std::vector<T> jsoncollector::HistoJ< T >::histo_
private

Definition at line 253 of file JsonMonitorable.h.

template<class T>
unsigned int jsoncollector::HistoJ< T >::maxUpdates_
private

Definition at line 255 of file JsonMonitorable.h.