Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CircularBuffer Class Reference

#include <CircularBuffer.h>

Inheritance diagram for CircularBuffer:

Inheritance graph
[legend]
Collaboration diagram for CircularBuffer:

Collaboration graph
[legend]
List of all members.

Detailed Description

CircularBuffer manager.

The is an NTuple that acts as a circular buffer. That is, it fills rows to its maximum capacity, then start replacing rows from the first row to the end. It repeats this behavior continuously.

Author:
Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 26 of file CircularBuffer.h.

Public Types

typedef void(hippodraw::Observer::* Action )(const Observable *)
 The member function of the Observer that is called.
typedef std::list< hippodraw::Observer * > ObserverList_t
 The type of STL container to maintain list of Observer objects.

Public Member Functions

int addColumn (const std::string &, const std::vector< double > &column)
 Adds a column to the end of the ntuple and returns the index to the added column.
void addObserver (hippodraw::Observer *)
 Adds an Observer to the Observer list.
virtual void addRow (const std::vector< double > &v)
 Adds a row to the buffer.
 CircularBuffer ()
 The default constructor creating an circular buffer with 0 columns.
 CircularBuffer (unsigned int n)
 The constructor creates an circular buffer with `n' columns.
 CircularBuffer (const CircularBuffer &nt)
 The copy constructor creates an circular buffer that is a copy of an existing one.
 CircularBuffer (const std::vector< std::string > &labels)
 Constructor taking a vector of column labels as argument.
 CircularBuffer (const std::string &name)
 Constructs an CircularBuffer object with name name.
virtual void clear ()
 Clears the contents without changing the capacity.
double columnMax (const std::string &name) const
 Returns minimum element in a column whose label is given by name.
double columnMin (const std::string &name) const
 Returns minimum element in a column whose label is given by name.
unsigned int columns () const
 Returns the number of columns or data arrays available from this DataSource.
virtual void copy (const DataSource &rhs)
 Copies rhs data.
virtual bool empty () const
 Returns true, if NTuple is empty, i.e.
virtual void eraseRow (unsigned int index)
 Erases a row from the NTuple.
virtual bool fillRange (unsigned int column, Range &) const
 Returns the Range of data in the column via the argument.
const std::vector< double > & getColumn (const std::string &label) const
 Returns the data in the column with label name.
virtual std::vector< double > & getColumn (unsigned int index)
 Returns a non-const reference to column at the index index.
virtual const std::vector<
double > & 
getColumn (unsigned int index) const
 Returns the data in the column with index column.
unsigned int getIntervalCount () const
 Returns the current interval count.
virtual const std::stringgetLabelAt (unsigned int index) const
 Returns the label for the column at index index.
virtual const std::vector<
std::string > & 
getLabels () const
 Returns the list of available labels.
const std::stringgetName () const
 Returns the name of the ntuple.
const ObserverList_tgetObservers () const
 Returns the list of observers.
unsigned int getRank () const
 Returns the rank of the data source.
virtual const std::vector<
double > & 
getRow (unsigned int) const =0
 Returns a const reference to slice along the axis known as a row.
virtual const std::vector<
double > & 
getRow (unsigned int index) const
 Returns a temporary vector of data elements in one row.
const std::vector< unsigned
int > & 
getShape () const
 Returns the shape of the data elements.
virtual int indexOf (const std::string &label) const
 Returns the index of the column whose label is label.
virtual unsigned int indexOfMaxElement (unsigned int index) const
 Returns row index of the maximum element in a column for the given column.
virtual unsigned int indexOfMinElement (unsigned int index) const
 Returns row index of the minimum element in a column for the given column.
virtual void insertRow (unsigned int index, const std::vector< double > &v)
 Inserts a Row.
bool isIntervalEnabled () const
 Returns true if interval counting is enabled, otherwise returns false.
virtual bool isMultiDimensional (const std::string &column) const
 Answers if rows of column are composed of the multidimensional data.
bool isNull () const
 Returns true if the receiving objects is a null object.
bool isValidLabel (const std::string &label) const
 Returns true if label is a valid label for a column in the DataSource.
virtual double maxElement (unsigned int index) const
 Returns the value of the maximum element of column index.
virtual double minElement (unsigned int index) const
 Returns the value of the minimum element of column index.
virtual void notifyObservers () const
 Notifies Observer objects of a change.
virtual double operator[] (std::vector< unsigned int > &indices) const
void removeObserver (hippodraw::Observer *)
 Removes an Observer from the Observer list.
void replaceColumn (const std::string &label, const std::vector< double > &data)
 Replaces the column.
void replaceColumn (unsigned int index, const std::vector< double > &data)
 Replaces the data in column col.
void replaceRow (unsigned int i, const std::vector< double > &data)
 Replaces the data in the row i.
virtual void reserve (unsigned int count)
 Sets the size, in rows, of the circular buffer.
virtual unsigned int rows () const
 Returns the number of rows.
void setIntervalCount (int number)
 Sets the interval count.
void setIntervalEnabled (bool yes=true)
 Sets interval counting to be enabled.
virtual bool setLabelAt (const std::string &s, unsigned int index)
 Changes the label of a data column to s.
void setLabels (const std::vector< std::string > &v)
 Assigns the label to each column from the vector of strings.
void setName (const std::string &name)
 Sets the name of the ntuple.
virtual bool setReleventIndex (const std::string &column, const std::vector< unsigned int > &index)
 In case we are dealing with multidimensional data in rows of this column we would like to deal with on one entry of this multidimensional data.
virtual void setShape (std::vector< unsigned int > &shape)
 Sets the shape of the data elements.
void setTitle (const std::string &title)
 Sets the title of the ntuple to title.
virtual double sum (unsigned int column) const
 Returns the sum of all the elements in the sequence of column column.
virtual void throwIfInvalidLabel (const std::string &label) const
 Throws a DataSourceException object if label is not a valid label for this DataSource.
void throwIfInvalidRowSize (const std::vector< double > &row)
 Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing.
const std::stringtitle () const
 Returns a const reference to the title of the ntuple.
virtual double valueAt (unsigned int row, unsigned int column) const
 Returns the value in the table in position given by the row and column indexes.

Protected Member Functions

virtual void addLabel (const std::string &label)
 Adds a new label for a column.
virtual void copyPrivate (const DataSource &other)
 Copies the contents of the other DataSource.
bool isValidColumn (unsigned int index) const
 Returns true if index is valid, otherwise throws a DataSourceException.
void notifyObservers (Action action) const
 An internal method to iterate over all observers and to send the message action.

Protected Attributes

std::vector< double > m_array
 A temporary array that can be returned by const reference.
std::vector< unsigned int > m_shape
 The shape of the data.

Private Member Functions

void incrementRowIndex ()
 Increments the next row index.
CircularBufferoperator= (const CircularBuffer &rhs)
 The following assignment operator replicates the columns and the title to the left hand operand.

Private Attributes

unsigned int m_capacity
 The capacity.
bool m_has_filled
 A flog which when true, indicates the buffer has been filled to capacity.
unsigned int m_next_row
 The index to the next row to be added.


Member Typedef Documentation

typedef void( hippodraw::Observer::* Observable::Action)(const Observable *) [inherited]
 

The member function of the Observer that is called.

Definition at line 83 of file Observable.h.

typedef std::list< hippodraw::Observer * > Observable::ObserverList_t [inherited]
 

The type of STL container to maintain list of Observer objects.

Definition at line 46 of file Observable.h.


Constructor & Destructor Documentation

CircularBuffer::CircularBuffer const std::string name  ) 
 

Constructs an CircularBuffer object with name name.

Definition at line 18 of file CircularBuffer.cxx.

CircularBuffer::CircularBuffer const std::vector< std::string > &  labels  ) 
 

Constructor taking a vector of column labels as argument.

Definition at line 26 of file CircularBuffer.cxx.

CircularBuffer::CircularBuffer const CircularBuffer nt  ) 
 

The copy constructor creates an circular buffer that is a copy of an existing one.

Definition at line 34 of file CircularBuffer.cxx.

CircularBuffer::CircularBuffer unsigned int  n  ) 
 

The constructor creates an circular buffer with `n' columns.

Definition at line 42 of file CircularBuffer.cxx.

CircularBuffer::CircularBuffer  ) 
 

The default constructor creating an circular buffer with 0 columns.

Definition at line 50 of file CircularBuffer.cxx.


Member Function Documentation

int NTuple::addColumn const std::string ,
const std::vector< double > &  column
[inherited]
 

Adds a column to the end of the ntuple and returns the index to the added column.

If the size of the input vector is the same as the size of the existing columns adds a copy of the input vector to then end of the NTuple. Gives the column the label label. Returns the index of the newly created column. If the size of the input vector differs from the size of existing columns, then throws a DataSourceException object.

Definition at line 377 of file NTuple.cxx.

References DataSource::addLabel(), DataSource::indexOf(), NTuple::m_data, NTuple::rows(), and num_util::size().

Referenced by PyDataSource::addColumn(), hippodraw::Python::export_NTuple(), and PyDataSource::saveColumnFromNumArray().

void DataSource::addLabel const std::string label  )  [protected, virtual, inherited]
 

Adds a new label for a column.

Definition at line 150 of file DataSource.cxx.

References DataSource::m_labels.

Referenced by NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), RootNTuple::addColumn(), and FitsNTuple::addColumn().

void Observable::addObserver hippodraw::Observer  )  [inherited]
 

Adds an Observer to the Observer list.

Definition at line 49 of file Observable.cxx.

References Observable::m_list.

Referenced by CutPlotter::addCutTarget(), XyPlotter::addDataRep(), FunctionRep::FunctionRep(), BinningProjector::normalizeTo(), DataRepController::setAxisBindings(), DisplayController::setNTuple(), CutPlotter::setNTuple(), and TextPlotter::setParentDataRep().

void CircularBuffer::addRow const std::vector< double > &  v  )  [virtual]
 

Adds a row to the buffer.

The size of the input vector must be the same as the width of the ntuple or an DataSourceException is thrown. If the buffer has not yet been filled to capacity, add the row to the end of the buffer. If the buffer has been filled to capacity, replaces the oldest row.

Reimplemented from NTuple.

Definition at line 79 of file CircularBuffer.cxx.

References NTuple::addRow(), incrementRowIndex(), m_has_filled, m_next_row, and NTuple::replaceRow().

Referenced by hippodraw::Python::export_CircularBuffer().

void CircularBuffer::clear  )  [virtual]
 

Clears the contents without changing the capacity.

Reimplemented from NTuple.

Definition at line 58 of file CircularBuffer.cxx.

References NTuple::clear(), m_has_filled, and m_next_row.

Referenced by hippodraw::Python::export_CircularBuffer().

double NTuple::columnMax const std::string name  )  const [inherited]
 

Returns minimum element in a column whose label is given by name.

Definition at line 531 of file NTuple.cxx.

References NTuple::getColumn(), and std::max_element().

double NTuple::columnMin const std::string name  )  const [inherited]
 

Returns minimum element in a column whose label is given by name.

Definition at line 525 of file NTuple.cxx.

References NTuple::getColumn(), and std::min_element().

unsigned int DataSource::columns  )  const [inline, inherited]
 

Returns the number of columns or data arrays available from this DataSource.

Note:
This function was selected to be in line sine it contributes heavily in time for addRow member function.

Definition at line 332 of file DataSource.h.

References DataSource::m_labels.

Referenced by PyDataSource::addColumn(), ProfileProjector::changedNTuple(), Profile2DProjector::changedNTuple(), MapMatrixProjector::changedNTuple(), Map3Projector::changedNTuple(), Map2Projector::changedNTuple(), Map1Projector::changedNTuple(), DyHist2DProjector::changedNTuple(), DyHist1DProjector::changedNTuple(), QtRootNTuple::columns(), PyDataSource::columns(), NTupleSorter::columns(), NTuple::copy(), NTupleXML::createChildren(), NTupleProjector::dataRange(), NTupleProjector::dataRangeWithError(), hippodraw::Python::export_CircularBuffer(), hippodraw::Python::export_DataSource(), DataSource::fillRange(), NTuple::getColumn(), NTupleProjector::getNTupleAfterCuts(), NumArrayTuple::getNumArray(), NTupleProjector::getPos(), NTupleProjector::getPosWithError(), NTuple::getRow(), DataSource::indexOfMaxElement(), DataSource::indexOfMinElement(), DataSource::isValidColumn(), RTuple::operator[](), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), RootNTuple::replaceColumn(), FitsNTuple::replaceColumn(), NTuple::setLabels(), DataSource::sum(), and DataSource::throwIfInvalidRowSize().

void NTuple::copy const DataSource rhs  )  [virtual, inherited]
 

Copies rhs data.

Definition at line 151 of file NTuple.cxx.

References DataSource::columns(), DataSource::copyPrivate(), DataSource::getRow(), NTuple::m_data, NTuple::m_i_count, NTuple::m_i_current, NTuple::m_i_enabled, DataSource::rows(), and num_util::size().

Referenced by NTuple::NTuple().

void DataSource::copyPrivate const DataSource other  )  [protected, virtual, inherited]
 

Copies the contents of the other DataSource.

For use by derived classes only.

Definition at line 110 of file DataSource.cxx.

References DataSource::m_ds_name, DataSource::m_is_null, DataSource::m_labels, DataSource::m_shape, and DataSource::m_title.

Referenced by RTuple::copy(), and NTuple::copy().

bool NTuple::empty  )  const [virtual, inherited]
 

Returns true, if NTuple is empty, i.e.

has no rows.

Implements DataSource.

Definition at line 199 of file NTuple.cxx.

References NTuple::m_data.

Referenced by reserve(), and NTuple::rows().

void NTuple::eraseRow unsigned int  index  )  [virtual, inherited]
 

Erases a row from the NTuple.

Removes the row index from the NTuple. Rows beyond the removal point move forward to fill the space. If index is out of range, and exception is thrown.

Definition at line 282 of file NTuple.cxx.

References NTuple::m_data, NTuple::notifyObservers(), and NTuple::rows().

bool NTuple::fillRange unsigned int  column,
Range
const [virtual, inherited]
 

Returns the Range of data in the column via the argument.

Always returns true, i.e. does not check for valid data.

Reimplemented from DataSource.

Definition at line 579 of file NTuple.cxx.

References NTuple::m_data, and Range::setRange().

const vector< double > & NTuple::getColumn const std::string label  )  const [virtual, inherited]
 

Returns the data in the column with label name.

Reimplemented from DataSource.

Definition at line 475 of file NTuple.cxx.

References DataSource::indexOf(), NTuple::m_data, and DataSource::throwIfInvalidLabel().

vector< double > & NTuple::getColumn unsigned int  index  )  [virtual, inherited]
 

Returns a non-const reference to column at the index index.

index is in a valid range, returns a reference to the the column at index index. If index is not in a valid range, throws a DataSourceException object.

Definition at line 464 of file NTuple.cxx.

References DataSource::columns(), NTuple::m_data, and num_util::size().

const vector< double > & NTuple::getColumn unsigned int  index  )  const [virtual, inherited]
 

Returns the data in the column with index column.

Reimplemented from DataSource.

Definition at line 457 of file NTuple.cxx.

References DataSource::isValidColumn(), and NTuple::m_data.

Referenced by NTupleSorter::addRow(), NTuple::columnMax(), NTuple::columnMin(), NTuple::indexOfMaxElement(), and NTuple::indexOfMinElement().

unsigned int NTuple::getIntervalCount  )  const [inherited]
 

Returns the current interval count.

Definition at line 572 of file NTuple.cxx.

References NTuple::m_i_count.

Referenced by Inspector::updatePlotTab().

const string & DataSource::getLabelAt unsigned int  index  )  const [virtual, inherited]
 

Returns the label for the column at index index.

Returns the label for the column at index index, or throws a DataSourceException if index is out of range.

Definition at line 175 of file DataSource.cxx.

References DataSource::isNull(), DataSource::m_labels, and DataSource::title().

Referenced by NTupleXML::createChildren2D(), hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NTuple(), hippodraw::Python::export_NumArrayTuple(), NTupleProjector::getAxisBindings(), NTupleProjector::getXLabel(), NTupleProjector::getYLabel(), Map1Projector::getYLabel(), Profile2DProjector::getZLabel(), MapMatrixProjector::getZLabel(), and Map3Projector::getZLabel().

const vector< string > & DataSource::getLabels  )  const [virtual, inherited]
 

Returns the list of available labels.

Reimplemented in QtRootNTuple.

Definition at line 168 of file DataSource.cxx.

References DataSource::m_labels.

Referenced by Inspector::availPlotTypesActivated(), hippodraw::Python::export_DataSource(), DisplayController::getDataSourceLabels(), QtRootNTuple::getLabels(), PyDataSource::getLabels(), NTupleProjector::getNTupleAfterCuts(), PyDataSource::replaceColumn(), RootNTuple::smartExpandRootNTuple(), Inspector::updateCutVarGroupBox(), and NTupleController::writeNTupleToFile().

const string & DataSource::getName  )  const [inherited]
 

Returns the name of the ntuple.

See also:
m_ds_name.

Definition at line 132 of file DataSource.cxx.

References DataSource::m_ds_name.

Referenced by HiNTupleXML::createElement(), NTupleProjector::getNTupleName(), DataSourceController::registerNTuple(), NTupleController::saveNTuples(), and NTupleXML::setAttributes().

const Observable::ObserverList_t & Observable::getObservers  )  const [inherited]
 

Returns the list of observers.

Definition at line 57 of file Observable.cxx.

References Observable::m_list.

unsigned int DataSource::getRank  )  const [inherited]
 

Returns the rank of the data source.

Returns the number of axes of the data source, i.e the rank.

Reimplemented in FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Definition at line 316 of file DataSource.cxx.

References DataSource::m_shape.

Referenced by RTuple::operator[](), and NTuple::operator[]().

virtual const std::vector< double >& DataSource::getRow unsigned  int  )  const [pure virtual, inherited]
 

Returns a const reference to slice along the axis known as a row.

Referenced by RTuple::copy(), NTuple::copy(), and NTupleController::writeNTupleToFile().

const std::vector< double > & NTuple::getRow unsigned int  index  )  const [virtual, inherited]
 

Returns a temporary vector of data elements in one row.

Returns a temporary vector with data elements copied from the NTuple row indexed by index. If index is out of range, throws a DataSourceException object.

Definition at line 301 of file NTuple.cxx.

References DataSource::columns(), NTuple::m_data, NTuple::m_row, and NTuple::rows().

Referenced by hippodraw::Python::export_NTuple(), and NTupleSorter::getRow().

const vector< unsigned int > & DataSource::getShape  )  const [inherited]
 

Returns the shape of the data elements.

Reimplemented in FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Definition at line 310 of file DataSource.cxx.

References DataSource::m_shape.

void CircularBuffer::incrementRowIndex  )  [private]
 

Increments the next row index.

Increments the next row index. If it reaches the capacity, then reset it to the first row and set the flag indicating the buffer has reached its capacity.

Definition at line 68 of file CircularBuffer.cxx.

References m_capacity, m_has_filled, and m_next_row.

Referenced by addRow().

int DataSource::indexOf const std::string label  )  const [virtual, inherited]
 

Returns the index of the column whose label is label.

Returns the index of the data column whose label is label, or -1 if label does not exist.

Definition at line 189 of file DataSource.cxx.

References std::find(), and DataSource::m_labels.

Referenced by NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), RootNTuple::addColumn(), FitsNTuple::addColumn(), NTuple::getColumn(), RootNTuple::getColumn(), DataSource::getColumn(), NumArrayTuple::getNumArray(), RootNTuple::getTBranch(), NTupleProjector::indexOf(), RootNTuple::isMultiDimensional(), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), RootNTuple::replaceColumn(), FitsNTuple::replaceColumn(), RootNTuple::rowDataDimSize(), NTupleProjector::setAxisBinding(), RootNTuple::setReleventIndex(), RootNTuple::smartExpandRootNTuple(), and QtRootNTuple::valueAt().

unsigned int NTuple::indexOfMaxElement unsigned int  index  )  const [virtual, inherited]
 

Returns row index of the maximum element in a column for the given column.

Reimplemented from DataSource.

Definition at line 506 of file NTuple.cxx.

References NTuple::getColumn(), and std::max_element().

unsigned int NTuple::indexOfMinElement unsigned int  index  )  const [virtual, inherited]
 

Returns row index of the minimum element in a column for the given column.

Reimplemented from DataSource.

Definition at line 485 of file NTuple.cxx.

References NTuple::getColumn(), and std::min_element().

void NTuple::insertRow unsigned int  index,
const std::vector< double > &  v
[virtual, inherited]
 

Inserts a Row.

Adds a row before the existing row specified by index from the elements of v.

Definition at line 256 of file NTuple.cxx.

References NTuple::m_data, NTuple::notifyObservers(), and NTuple::rows().

Referenced by NTupleSorter::addRow().

bool NTuple::isIntervalEnabled  )  const [inherited]
 

Returns true if interval counting is enabled, otherwise returns false.

Definition at line 561 of file NTuple.cxx.

References NTuple::m_i_enabled.

bool DataSource::isMultiDimensional const std::string column  )  const [virtual, inherited]
 

Answers if rows of column are composed of the multidimensional data.

Reimplemented in RootNTuple, QtRootNTuple, and RootNTuple.

Definition at line 359 of file DataSource.cxx.

bool DataSource::isNull  )  const [inherited]
 

Returns true if the receiving objects is a null object.

See also:
DataSource( bool ).

Definition at line 121 of file DataSource.cxx.

References DataSource::m_is_null.

Referenced by ProfileProjector::execute(), Profile2DProjector::execute(), DataSource::getLabelAt(), NTupleProjector::NTupleProjector(), NTupleProjector::setNTuple(), and NTupleProjector::~NTupleProjector().

bool DataSource::isValidColumn unsigned int  index  )  const [protected, inherited]
 

Returns true if index is valid, otherwise throws a DataSourceException.

Definition at line 208 of file DataSource.cxx.

References DataSource::columns(), and num_util::size().

Referenced by NTuple::getColumn(), and DataSource::getColumn().

bool DataSource::isValidLabel const std::string label  )  const [inherited]
 

Returns true if label is a valid label for a column in the DataSource.

The search is case sensitive. If the label is not found, returns false.

Definition at line 250 of file DataSource.cxx.

References std::find(), and DataSource::m_labels.

Referenced by DataSource::throwIfInvalidLabel().

double NTuple::maxElement unsigned int  index  )  const [virtual, inherited]
 

Returns the value of the maximum element of column index.

Definition at line 518 of file NTuple.cxx.

References NTuple::m_data, and std::max_element().

double NTuple::minElement unsigned int  index  )  const [virtual, inherited]
 

Returns the value of the minimum element of column index.

Definition at line 497 of file NTuple.cxx.

References NTuple::m_data, and std::min_element().

void Observable::notifyObservers Action  action  )  const [protected, inherited]
 

An internal method to iterate over all observers and to send the message action.

Definition at line 69 of file Observable.cxx.

References std::bind2nd(), std::for_each(), Observable::m_list, and std::mem_fun().

void NTuple::notifyObservers  )  const [virtual, inherited]
 

Notifies Observer objects of a change.

If interval counting is disabled, then Observer::Update is sent immediately. If interval counting is enabled, then the current count is incremented. If the current count is equal to the interval count, then the Observer::update message is sent and the current count reset to 0.

Reimplemented from Observable.

Definition at line 538 of file NTuple.cxx.

References NTuple::m_i_count, NTuple::m_i_current, NTuple::m_i_enabled, and Observable::notifyObservers().

Referenced by NTuple::addRow(), NTuple::clear(), NTuple::eraseRow(), NTuple::insertRow(), NTuple::replaceColumn(), NTuple::replaceRow(), NTuple::setIntervalEnabled(), and NTupleSorter::sort().

CircularBuffer& CircularBuffer::operator= const CircularBuffer rhs  )  [private]
 

The following assignment operator replicates the columns and the title to the left hand operand.

double NTuple::operator[] std::vector< unsigned int > &  indices  )  const [virtual, inherited]
 

Implements DataSource.

Definition at line 320 of file NTuple.cxx.

References DataSource::getRank(), NTuple::m_data, DataSource::m_shape, num_util::rank(), and num_util::size().

Referenced by NTuple::valueAt().

void Observable::removeObserver hippodraw::Observer  )  [inherited]
 

Removes an Observer from the Observer list.

Definition at line 63 of file Observable.cxx.

References Observable::m_list.

Referenced by BinningProjector::normalizeTo(), CutPlotter::removeFromTarget(), DisplayController::removeTextObservers(), NTupleProjector::setNTuple(), FunctionRep::willDelete(), FunctionRep::~FunctionRep(), and NTupleProjector::~NTupleProjector().

void NTuple::replaceColumn const std::string label,
const std::vector< double > &  data
[inherited]
 

Replaces the column.

Replaces the column at the column with label label. This is a convenience member function for using indexOf() and replaceColumn ( unsigned int, const std::vector< double > & ).

Definition at line 431 of file NTuple.cxx.

References DataSource::indexOf(), and NTuple::replaceColumn().

void NTuple::replaceColumn unsigned int  index,
const std::vector< double > &  data
[inherited]
 

Replaces the data in column col.

If index is in a valid range and if the size of data is the same as the existing column, then replaces the elements of the specified column with a copy of @ data elements. If index is not a valid range or the sizes differ, then throws a DataSourceException object.

Definition at line 407 of file NTuple.cxx.

References DataSource::columns(), std::copy(), NTuple::m_data, NTuple::notifyObservers(), NTuple::rows(), and num_util::size().

Referenced by hippodraw::Python::export_NTuple(), PyDataSource::replaceColumn(), NTuple::replaceColumn(), and PyDataSource::saveColumnFromNumArray().

void NTuple::replaceRow unsigned int  i,
const std::vector< double > &  data
[inherited]
 

Replaces the data in the row i.

If index is in a valid range and if the size of data is the same as the existing column, then replaces the elements of the specified column with a copy of @ data elements. If index is not a valid range or the sizes differ, then throws a DataSourceException object

Definition at line 220 of file NTuple.cxx.

References NTuple::m_data, NTuple::notifyObservers(), NTuple::rows(), and DataSource::throwIfInvalidRowSize().

Referenced by addRow().

void CircularBuffer::reserve unsigned int  count  )  [virtual]
 

Sets the size, in rows, of the circular buffer.

Reimplemented from NTuple.

Definition at line 91 of file CircularBuffer.cxx.

References NTuple::empty(), m_capacity, and NTuple::reserve().

Referenced by hippodraw::Python::export_CircularBuffer().

unsigned int NTuple::rows  )  const [virtual, inherited]
 

Returns the number of rows.

Implements DataSource.

Definition at line 206 of file NTuple.cxx.

References std::count(), NTuple::empty(), NTuple::m_data, and num_util::size().

Referenced by NTuple::addColumn(), NTuple::eraseRow(), hippodraw::Python::export_CircularBuffer(), NTuple::getRow(), NTuple::insertRow(), NTuple::replaceColumn(), NTuple::replaceRow(), NTupleSorter::rows(), and NTuple::setLabels().

void NTuple::setIntervalCount int  number  )  [inherited]
 

Sets the interval count.

One needs to call setIntervalEnabled for this to have effect. When interval counting is enabled, then only each number notifyObsevers messages will trigger an Observer::update message to the list of Observer objects.

Definition at line 566 of file NTuple.cxx.

References NTuple::m_i_count, and NTuple::m_i_current.

Referenced by hippodraw::Python::export_NTuple(), and DisplayController::setIntervalCount().

void NTuple::setIntervalEnabled bool  yes = true  )  [inherited]
 

Sets interval counting to be enabled.

If yes is false, then a notifyObservers is immediately issued.

Definition at line 553 of file NTuple.cxx.

References NTuple::m_i_current, NTuple::m_i_enabled, and NTuple::notifyObservers().

Referenced by hippodraw::Python::export_NTuple(), DisplayController::setAllIntervalEnabled(), and DisplayController::setIntervalEnabled().

bool DataSource::setLabelAt const std::string s,
unsigned int  index
[virtual, inherited]
 

Changes the label of a data column to s.

Parameters:
s the new label.
index the column number starting at zero.
Returns:
true if index is less than the width of the ntuple; otherwise, it does nothing and returns false.

Definition at line 157 of file DataSource.cxx.

References DataSource::m_labels, and Observable::notifyObservers().

void NTuple::setLabels const std::vector< std::string > &  v  )  [virtual, inherited]
 

Assigns the label to each column from the vector of strings.

If the vector is the same size as the width of the ntuple, then it sets the label and returns true; otherwise, it throws a DataSourceException. If the NTuple is empty, i.e. has no rows, then changes the NTuple's number of columns to the size of the vector.

Reimplemented from DataSource.

Definition at line 441 of file NTuple.cxx.

References DataSource::columns(), NTuple::resizeColumns(), NTuple::rows(), and DataSource::setLabels().

Referenced by Map2Projector::createNTuple(), Map1Projector::createNTuple(), hippodraw::Python::export_NTuple(), NTupleProjector::getNTupleAfterCuts(), NTuple::NTuple(), Bins2DBase::prepareNTuple(), Bins1DBase::prepareNTuple(), and NTupleController::readAsciiNTuple().

void DataSource::setName const std::string name  )  [inherited]
 

Sets the name of the ntuple.

See also:
m_ds_name.

Definition at line 126 of file DataSource.cxx.

References DataSource::m_ds_name, and Observable::notifyObservers().

Referenced by NTupleController::createNTuple(), hippodraw::Python::export_DataSource(), PyDataSource::registerNTuple(), DataSourceController::registerNTuple(), and PyDataSource::setName().

bool DataSource::setReleventIndex const std::string column,
const std::vector< unsigned int > &  index
[virtual, inherited]
 

In case we are dealing with multidimensional data in rows of this column we would like to deal with on one entry of this multidimensional data.

So here we set index of this relevant entry.

Reimplemented in RootNTuple, and RootNTuple.

Definition at line 366 of file DataSource.cxx.

void DataSource::setShape std::vector< unsigned int > &  shape  )  [virtual, inherited]
 

Sets the shape of the data elements.

Sets the shape data elements from the vector shape. The rank is given by the size of the vector. A rank of 2 correspond to table. If the total number of elements in the DataSource is not equal to the product of the shape, then an assertion is raised.

Reimplemented in FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Definition at line 298 of file DataSource.cxx.

References DataSource::m_shape, and num_util::size().

void DataSource::setTitle const std::string title  )  [inherited]
 

Sets the title of the ntuple to title.

Definition at line 142 of file DataSource.cxx.

References DataSource::m_title, and Observable::notifyObservers().

Referenced by hippodraw::Python::export_DataSource(), NTupleController::readAsciiNTuple(), and PyDataSource::setTitle().

double NTuple::sum unsigned int  column  )  const [virtual, inherited]
 

Returns the sum of all the elements in the sequence of column column.

Reimplemented from DataSource.

Definition at line 590 of file NTuple.cxx.

References std::accumulate(), num_util::data(), and NTuple::m_data.

void DataSource::throwIfInvalidLabel const std::string label  )  const [virtual, inherited]
 

Throws a DataSourceException object if label is not a valid label for this DataSource.

The exception object contains a message that the label is invalid. Derived classes may over-ride this method with more information on why the label is invalid.

Definition at line 264 of file DataSource.cxx.

References DataSource::isValidLabel().

Referenced by NTuple::getColumn(), RootNTuple::getColumn(), and QtRootNTuple::valueAt().

void DataSource::throwIfInvalidRowSize const std::vector< double > &  row  )  [inherited]
 

Throws a DataSourceException if the size of the row is not equal to the number of columns, otherwise does nothing.

Definition at line 277 of file DataSource.cxx.

References DataSource::columns(), and num_util::size().

Referenced by RTuple::addRow(), NTuple::addRow(), and NTuple::replaceRow().

const string & DataSource::title  )  const [inherited]
 

Returns a const reference to the title of the ntuple.

Definition at line 137 of file DataSource.cxx.

References DataSource::m_title.

Referenced by hippodraw::Python::export_DataSource(), DataSource::getLabelAt(), PyDataSource::getTitle(), NTupleProjector::getTitle(), and NTupleController::writeNTupleToFile().

double NTuple::valueAt unsigned int  row,
unsigned int  column
const [virtual, inherited]
 

Returns the value in the table in position given by the row and column indexes.

Implements DataSource.

Definition at line 360 of file NTuple.cxx.

References NTuple::m_data, and NTuple::operator[]().


Member Data Documentation

std::vector< double > DataSource::m_array [mutable, protected, inherited]
 

A temporary array that can be returned by const reference.

Definition at line 81 of file DataSource.h.

Referenced by DataSource::getColumn(), RootNTuple::getRow(), and FitsNTuple::getRow().

unsigned int CircularBuffer::m_capacity [private]
 

The capacity.

The number of rows in the buffer.

Definition at line 33 of file CircularBuffer.h.

Referenced by incrementRowIndex(), and reserve().

bool CircularBuffer::m_has_filled [private]
 

A flog which when true, indicates the buffer has been filled to capacity.

Definition at line 42 of file CircularBuffer.h.

Referenced by addRow(), clear(), and incrementRowIndex().

unsigned int CircularBuffer::m_next_row [private]
 

The index to the next row to be added.

Definition at line 37 of file CircularBuffer.h.

Referenced by addRow(), clear(), and incrementRowIndex().

std::vector< unsigned int > DataSource::m_shape [protected, inherited]
 

The shape of the data.

The elements the DataSource can have an arbitrary number of dimensions, called rank. An ordinary table has rank of 2 and the shape is number of columns and number of rows. That is m_shape[0] is number of columns and m_share[1] is number of rows.

Definition at line 89 of file DataSource.h.

Referenced by DataSource::copyPrivate(), NumArrayTuple::getRank(), ListTuple::getRank(), RootNTuple::getRank(), FitsNTuple::getRank(), DataSource::getRank(), NumArrayTuple::getShape(), ListTuple::getShape(), RootNTuple::getShape(), FitsNTuple::getShape(), DataSource::getShape(), RTuple::operator[](), NTuple::operator[](), NumArrayTuple::setShape(), ListTuple::setShape(), RootNTuple::setShape(), FitsNTuple::setShape(), and DataSource::setShape().


The documentation for this class was generated from the following files:
Generated for HippoDraw-1.14.8.5 by doxygen 1.4.3