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

DataSource Class Reference

#include <DataSource.h>

Inheritance diagram for DataSource:

Inheritance graph
[legend]
Collaboration diagram for DataSource:

Collaboration graph
[legend]
List of all members.

Detailed Description

Base class for DataSource.

A data source is a class which is able to supply one or more arrays of data. Access to the arrays can be by name, called a label, or by an index. It provides translation of label to index and vice versa. It also provides a name by which it can be uniquely identified in a client application and a title for the data set. These attributes have concrete implementations in this base class.

All member functions that access the data are pure virtual functions in this class and thus must be implemented in derived classes. This class does not provide the interface for creating or modifying the data.

A DataSource can also have a shape, meaning that a single array can be seen as a multi-dimension array with different sizes of each dimension.

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

Definition at line 47 of file DataSource.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

void addObserver (hippodraw::Observer *)
 Adds an Observer to the Observer list.
virtual void addRow (const std::vector< double > &row)=0
 Adds a row to the ntuple and returns the index to the added row.
virtual void clear ()=0
 Clears the data source.
unsigned int columns () const
 Returns the number of columns or data arrays available from this DataSource.
virtual bool empty () const =0
 Returns true, if DataSource is empty, i.e.
virtual bool fillRange (unsigned int column, Range &) const
 Fills the Range object from data indexed by column.
virtual const std::vector<
double > & 
getColumn (unsigned int column) const
 Returns the data in the column with index column.
virtual const std::vector<
double > & 
getColumn (const std::string &name) const
 Returns the data in the column with label name.
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.
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 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 void notifyObservers () const
 Notifies Observer objects of a change.
virtual double operator[] (std::vector< unsigned int > &indices) const =0
void removeObserver (hippodraw::Observer *)
 Removes an Observer from the Observer list.
virtual void reserve (unsigned int count)=0
 For each column, reserves enough space for the NTuple to grow to count rows.
virtual unsigned int rows () const =0
 Returns the number of rows.
virtual bool setLabelAt (const std::string &s, unsigned int index)
 Changes the label of a data column to s.
virtual void setLabels (const std::vector< std::string > &v)
 Assigns the label to each column from the vector of strings @ v.
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 =0
 Returns the value in the table in position given by the row and column indexes.
virtual ~DataSource ()
 The destructor.

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.
 DataSource ()
 The default constructor creating an ntuple with 0 columns.
 DataSource (bool dummy)
 A constructor for creating a null object.
 DataSource (const DataSource &nt)
 The copy constructor creates an ntuple that is a copy of an existing one.
 DataSource (const char *name)
 Constructs an DataSource object with name name.
 DataSource (const std::string &name)
 Constructs an DataSource object with name name.
 DataSource (const std::vector< std::string > &labels)
 A constructor taking list of array labels as argument.
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 Attributes

std::string m_ds_name
 The name of the data source .
bool m_is_null
 A flag to indicate the object is null.
std::vector< std::stringm_labels
 The labels of the vectors of the data.
std::string m_title
 The title.


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

DataSource::DataSource const std::vector< std::string > &  labels  )  [protected]
 

A constructor taking list of array labels as argument.

Definition at line 81 of file DataSource.cxx.

DataSource::DataSource const std::string name  )  [protected]
 

Constructs an DataSource object with name name.

Definition at line 55 of file DataSource.cxx.

DataSource::DataSource const char *  name  )  [protected]
 

Constructs an DataSource object with name name.

Note:
This constructor differs from one with std::string because that wouldn't be use by conversion of char *.

Definition at line 63 of file DataSource.cxx.

DataSource::DataSource const DataSource nt  )  [protected]
 

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

Definition at line 71 of file DataSource.cxx.

DataSource::DataSource bool  dummy  )  [protected]
 

A constructor for creating a null object.

A null DataSource is one that is a place holder for one that got deleted while other objects were referencing it. This can happen, for example, if a user deletes an DataSource before deleting other objects that use it. Classes that reference DataSource objects can be Observer of then in order to receive the Observer::willDelete signal. When received they can replace the referenced DataSource with a null one. They can then continue to function until a valid ntuple is given to them. The parameter dummy is not used.

Definition at line 96 of file DataSource.cxx.

DataSource::DataSource  )  [protected]
 

The default constructor creating an ntuple with 0 columns.

Definition at line 88 of file DataSource.cxx.

DataSource::~DataSource  )  [virtual]
 

The destructor.

Definition at line 103 of file DataSource.cxx.

References Observable::notifyObservers(), and hippodraw::Observer::willDelete().


Member Function Documentation

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

Adds a new label for a column.

Definition at line 150 of file DataSource.cxx.

References 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().

virtual void DataSource::addRow const std::vector< double > &  row  )  [pure virtual]
 

Adds a row to the ntuple and returns the index to the added row.

Todo:
Could implement something here so derived classes don't have to implement default behavior.

Implemented in CircularBuffer, NTuple, RTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

virtual void DataSource::clear  )  [pure virtual]
 

Clears the data source.

Implemented in CircularBuffer, NTuple, RTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Referenced by PyDataSource::clear(), and hippodraw::Python::export_DataSource().

unsigned int DataSource::columns  )  const [inline]
 

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 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(), fillRange(), NTuple::getColumn(), NTupleProjector::getNTupleAfterCuts(), NumArrayTuple::getNumArray(), NTupleProjector::getPos(), NTupleProjector::getPosWithError(), NTuple::getRow(), indexOfMaxElement(), indexOfMinElement(), isValidColumn(), RTuple::operator[](), NumArrayTuple::replaceColumn(), NTuple::replaceColumn(), ListTuple::replaceColumn(), RootNTuple::replaceColumn(), FitsNTuple::replaceColumn(), NTuple::setLabels(), sum(), and throwIfInvalidRowSize().

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

Copies the contents of the other DataSource.

For use by derived classes only.

Definition at line 110 of file DataSource.cxx.

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

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

virtual bool DataSource::empty  )  const [pure virtual]
 

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

, has no data.

Implemented in NTuple, RTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

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

Fills the Range object from data indexed by column.

Returns true if all the data in the column was valid, otherwise returns false. Invalid data is +/- HUGE_VAL or NAN. Invalid data is not used in setting the range.

Reimplemented in NTuple, and FitsNTuple.

Definition at line 323 of file DataSource.cxx.

References columns(), std::max(), std::min(), rows(), Range::setRange(), num_util::size(), and valueAt().

const vector< double > & DataSource::getColumn unsigned int  column  )  const [virtual]
 

Returns the data in the column with index column.

Reimplemented in NTuple, RootNTuple, QtRootNTuple, and RootNTuple.

Definition at line 221 of file DataSource.cxx.

References isValidColumn(), m_array, rows(), num_util::size(), and valueAt().

const vector< double > & DataSource::getColumn const std::string name  )  const [virtual]
 

Returns the data in the column with label name.

Reimplemented in NTuple, RootNTuple, QtRootNTuple, and RootNTuple.

Definition at line 236 of file DataSource.cxx.

References indexOf().

Referenced by PyDataSource::columnAsNumArray(), NTupleXML::createChildren2D(), hippodraw::Python::export_DataSource(), and PyDataSource::getColumn().

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

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 isNull(), m_labels, and 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]
 

Returns the list of available labels.

Reimplemented in QtRootNTuple.

Definition at line 168 of file DataSource.cxx.

References 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
 

Returns the name of the ntuple.

See also:
m_ds_name.

Definition at line 132 of file DataSource.cxx.

References 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
 

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 m_shape.

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

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

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

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

const vector< unsigned int > & DataSource::getShape  )  const
 

Returns the shape of the data elements.

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

Definition at line 310 of file DataSource.cxx.

References m_shape.

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

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 m_labels.

Referenced by NumArrayTuple::addColumn(), NTuple::addColumn(), ListTuple::addColumn(), RootNTuple::addColumn(), FitsNTuple::addColumn(), NTuple::getColumn(), RootNTuple::getColumn(), 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 DataSource::indexOfMaxElement unsigned int  index  )  const [virtual]
 

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

Reimplemented in NTuple.

Definition at line 377 of file DataSource.cxx.

References columns(), rows(), num_util::size(), and valueAt().

unsigned int DataSource::indexOfMinElement unsigned int  index  )  const [virtual]
 

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

Reimplemented in NTuple.

Definition at line 398 of file DataSource.cxx.

References columns(), rows(), num_util::size(), and valueAt().

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

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
 

Returns true if the receiving objects is a null object.

See also:
DataSource( bool ).

Definition at line 121 of file DataSource.cxx.

References m_is_null.

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

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

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

Definition at line 208 of file DataSource.cxx.

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

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

bool DataSource::isValidLabel const std::string label  )  const
 

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 m_labels.

Referenced by throwIfInvalidLabel().

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 Observable::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 in NTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Definition at line 90 of file Observable.cxx.

References hippodraw::Observer::update().

Referenced by XyPlotter::addDataRep(), XyPlotter::addDataRepStacked(), FunctionController::addFunctionRep(), RTuple::addRow(), StHist2DProjector::addValues(), StHist1DProjector::addValues(), XyPlotter::autoScale(), Inspector::contourLevelsTextBox_returnPressed(), Inspector::contourSlider_valueChanged(), Inspector::contourTextBox_returnPressed(), FunctionRep::fitFunction(), NumArrayTuple::notifyObservers(), NTuple::notifyObservers(), ListTuple::notifyObservers(), RootNTuple::notifyObservers(), FitsNTuple::notifyObservers(), XyPlotter::removeDataRep(), FunctionRep::restoreParameters(), CutPlotter::setActive(), XyPlotter::setAutoRanging(), QtDisplay::setContourLevels(), CutPlotter::setCutColor(), XyPlotter::setCutEnabled(), XyPlotter::setCutInverted(), XyPlotter::setCutRangeAt(), ProjectorBase::setDirty(), DataRep::setErrorDisplay(), XyPlotter::setHighRange(), XyPlotter::setLabel(), PlotterBase::setLabel(), setLabelAt(), setLabels(), XyPlotter::setLowRange(), setName(), DisplayController::setNTuple(), FunctionRep::setParameters(), DataRep::setRepColor(), DyHistogram::setRepresentation(), DataRep::setRepresentation(), DataRep::setRepSize(), DataRep::setRepStyle(), XyPlotter::setScaling(), PlotterBase::setTitle(), setTitle(), XyPlotter::setTransform(), XyPlotter::setValueRep(), PlotterBase::update(), NTupleProjector::update(), DataRep::update(), CutPlotter::update(), BinningProjector::update(), CutPlotter::updateTargets(), DataRep::~DataRep(), ~DataSource(), NTuple::~NTuple(), and RTuple::~RTuple().

virtual double DataSource::operator[] std::vector< unsigned int > &  indices  )  const [pure virtual]
 

Implemented in NTuple, RTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

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().

virtual void DataSource::reserve unsigned int  count  )  [pure virtual]
 

For each column, reserves enough space for the NTuple to grow to count rows.

Implemented in CircularBuffer, NTuple, RTuple, FitsNTuple, NumArrayTuple, and ListTuple.

virtual unsigned int DataSource::rows  )  const [pure virtual]
 

Returns the number of rows.

Implemented in NTuple, RTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Referenced by RTuple::copy(), NTuple::copy(), NTupleXML::createChildren2D(), Map1Projector::dataRangeOn(), hippodraw::Python::export_DataSource(), fillRange(), getColumn(), NTupleProjector::getNTupleAfterCuts(), NTupleProjector::getNumberOfEntries(), indexOfMaxElement(), indexOfMinElement(), PyDataSource::rows(), MapMatrixProjector::setNTuple(), sum(), and NTupleController::writeNTupleToFile().

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

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 m_labels, and Observable::notifyObservers().

void DataSource::setLabels const std::vector< std::string > &  v  )  [virtual]
 

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

Reimplemented in NTuple.

Definition at line 289 of file DataSource.cxx.

References m_labels, and Observable::notifyObservers().

Referenced by hippodraw::Python::export_ListTuple(), hippodraw::Python::export_NumArrayTuple(), RTuple::RTuple(), and NTuple::setLabels().

void DataSource::setName const std::string name  ) 
 

Sets the name of the ntuple.

See also:
m_ds_name.

Definition at line 126 of file DataSource.cxx.

References 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]
 

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]
 

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 m_shape, and num_util::size().

void DataSource::setTitle const std::string title  ) 
 

Sets the title of the ntuple to title.

Definition at line 142 of file DataSource.cxx.

References m_title, and Observable::notifyObservers().

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

double DataSource::sum unsigned int  column  )  const [virtual]
 

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

Reimplemented in NTuple.

Definition at line 419 of file DataSource.cxx.

References columns(), rows(), num_util::size(), and valueAt().

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

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 isValidLabel().

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

void DataSource::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.

Definition at line 277 of file DataSource.cxx.

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

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

const string & DataSource::title  )  const
 

Returns a const reference to the title of the ntuple.

Definition at line 137 of file DataSource.cxx.

References m_title.

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

virtual double DataSource::valueAt unsigned int  row,
unsigned int  column
const [pure virtual]
 

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

Implemented in NTuple, RTuple, FitsNTuple, RootNTuple, NumArrayTuple, ListTuple, and RootNTuple.

Referenced by fillRange(), getColumn(), indexOfMaxElement(), indexOfMinElement(), and sum().


Member Data Documentation

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

A temporary array that can be returned by const reference.

Definition at line 81 of file DataSource.h.

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

std::string DataSource::m_ds_name [private]
 

The name of the data source .

Although the use of this data member is optional, the suggested use within an application is as follows.

  • If the ntuple is associated with a file, then it is the file name.
  • If the ntuple was created in memory by an application, then it is some unique string created by the application.

Definition at line 59 of file DataSource.h.

Referenced by copyPrivate(), getName(), and setName().

bool DataSource::m_is_null [private]
 

A flag to indicate the object is null.

A null object is a place holder so that classes that use this class can continue to function after their valid object has been deleted. This can happen, for example, if the user deletes his ntuple without first deleting objects that use it.

Definition at line 75 of file DataSource.h.

Referenced by copyPrivate(), and isNull().

std::vector<std::string> DataSource::m_labels [private]
 

The labels of the vectors of the data.

Definition at line 67 of file DataSource.h.

Referenced by addLabel(), columns(), copyPrivate(), getLabelAt(), getLabels(), indexOf(), isValidLabel(), setLabelAt(), and setLabels().

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

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 copyPrivate(), NumArrayTuple::getRank(), ListTuple::getRank(), RootNTuple::getRank(), FitsNTuple::getRank(), getRank(), NumArrayTuple::getShape(), ListTuple::getShape(), RootNTuple::getShape(), FitsNTuple::getShape(), getShape(), RTuple::operator[](), NTuple::operator[](), NumArrayTuple::setShape(), ListTuple::setShape(), RootNTuple::setShape(), FitsNTuple::setShape(), and setShape().

std::string DataSource::m_title [private]
 

The title.

The title is descriptive of the data source.

Definition at line 63 of file DataSource.h.

Referenced by copyPrivate(), setTitle(), and title().


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