test
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 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 192 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 195 of file JsonMonitorable.h.

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

Definition at line 202 of file JsonMonitorable.h.

202 {}

Member Function Documentation

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

Definition at line 237 of file JsonMonitorable.h.

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

Definition at line 241 of file JsonMonitorable.h.

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

Definition at line 256 of file JsonMonitorable.h.

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

Definition at line 229 of file JsonMonitorable.h.

229  {
230  histo_ = sth;
231  }
std::vector< T > histo_
template<class T>
virtual void jsoncollector::HistoJ< T >::resetValue ( )
inlinevirtual

Implements jsoncollector::JsonMonitorable.

Definition at line 224 of file JsonMonitorable.h.

224  {
225  histo_.clear();
226  histo_.reserve(expectedSize_);
227  updates_=0;
228  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
void jsoncollector::HistoJ< T >::setMaxUpdates ( unsigned int  maxUpdates)
inline

Definition at line 245 of file JsonMonitorable.h.

245  {
246  maxUpdates_=maxUpdates;
247  if (!maxUpdates_) return;
249  //truncate what is over the limit
250  if (maxUpdates_ && histo_.size()>maxUpdates_) {
251  histo_.resize(maxUpdates_);
252  }
253  else histo_.reserve(expectedSize_);
254  }
unsigned int expectedSize_
std::vector< T > histo_
template<class T>
std::string jsoncollector::HistoJ< T >::toCSV ( ) const
inline

Definition at line 204 of file JsonMonitorable.h.

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

Implements jsoncollector::JsonMonitorable.

Definition at line 213 of file JsonMonitorable.h.

Referenced by TriggerJSONMonitoring::globalEndLuminosityBlockSummary().

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

Definition at line 260 of file JsonMonitorable.h.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.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(), relval_steps.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().

260  {
261  if (maxUpdates_ && updates_>=maxUpdates_) return;
262  histo_.push_back(val);
263  updates_++;
264  }
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