CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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)
 
virtual void resetValue ()
 
void setMaxUpdates (unsigned int maxUpdates)
 
std::string toCSV () const
 
virtual Json::Value toJsonValue () const
 
virtual std::string toString () const
 
void update (T val)
 
std::vector< T > & value ()
 
virtual ~HistoJ ()
 
- 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 193 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 196 of file JsonMonitorable.h.

196  {
197  expectedSize_=expectedUpdates;
198  updates_ = 0;
199  maxUpdates_ = maxUpdates;
201  histo_.reserve(expectedSize_);
202  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
virtual jsoncollector::HistoJ< T >::~HistoJ ( )
inlinevirtual

Definition at line 203 of file JsonMonitorable.h.

203 {}

Member Function Documentation

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

Definition at line 245 of file JsonMonitorable.h.

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

Definition at line 249 of file JsonMonitorable.h.

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

Definition at line 264 of file JsonMonitorable.h.

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

Definition at line 237 of file JsonMonitorable.h.

237  {
238  histo_ = sth;
239  }
std::vector< T > histo_
template<class T>
virtual void jsoncollector::HistoJ< T >::resetValue ( )
inlinevirtual

Implements jsoncollector::JsonMonitorable.

Definition at line 232 of file JsonMonitorable.h.

232  {
233  histo_.clear();
234  histo_.reserve(expectedSize_);
235  updates_=0;
236  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::setMaxUpdates ( unsigned int  maxUpdates)
inline

Definition at line 253 of file JsonMonitorable.h.

253  {
254  maxUpdates_=maxUpdates;
255  if (!maxUpdates_) return;
257  //truncate what is over the limit
258  if (maxUpdates_ && histo_.size()>maxUpdates_) {
259  histo_.resize(maxUpdates_);
260  }
261  else histo_.reserve(expectedSize_);
262  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
std::string jsoncollector::HistoJ< T >::toCSV ( ) const
inline

Definition at line 205 of file JsonMonitorable.h.

205  {
206  std::stringstream ss;
207  for (unsigned int i=0;i<updates_;i++) {
208  ss << histo_[i];
209  if (i!=histo_.size()-1) ss<<",";
210  }
211  return ss.str();
212  }
int i
Definition: DBlmapReader.cc:9
std::vector< T > histo_
template<class T>
virtual Json::Value jsoncollector::HistoJ< T >::toJsonValue ( ) const
inlinevirtual

Definition at line 225 of file JsonMonitorable.h.

Referenced by TriggerJSONMonitoring::globalEndLuminosityBlockSummary().

225  { //TODO
226  Json::Value jsonValue(Json::arrayValue);
227  for (unsigned int i = 0; i < histo_.size(); i++) {
228  jsonValue.append(histo_[i]);
229  }
230  return jsonValue;
231  }
int i
Definition: DBlmapReader.cc:9
Represents a JSON value.
Definition: value.h:111
std::vector< T > histo_
array value (ordered list)
Definition: value.h:31
template<class T>
virtual std::string jsoncollector::HistoJ< T >::toString ( ) const
inlinevirtual

Implements jsoncollector::JsonMonitorable.

Definition at line 214 of file JsonMonitorable.h.

214  {
215  std::stringstream ss;
216  ss << "[";
217  if (histo_.size())
218  for (unsigned int i = 0; i < histo_.size(); i++) {
219  ss << histo_[i];
220  if (i<histo_.size()-1) ss << ",";
221  }
222  ss << "]";
223  return ss.str();
224  }
int i
Definition: DBlmapReader.cc:9
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::update ( T  val)
inline

Definition at line 268 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(), TriggerJSONMonitoring::endLuminosityBlockSummary(), progressbar.ProgressBar::finish(), 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().

268  {
269  if (maxUpdates_ && updates_>=maxUpdates_) return;
270  histo_.push_back(val);
271  updates_++;
272  }
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
template<class T>
std::vector<T> jsoncollector::HistoJ< T >::histo_
private
template<class T>
unsigned int jsoncollector::HistoJ< T >::maxUpdates_
private