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

PyDataSource Class Reference

#include <PyDataSource.h>

Collaboration diagram for PyDataSource:

Collaboration graph
[legend]
List of all members.

Detailed Description

This class is the public interface to a DataSource object that the user sees as the DataArray object from Python.

Author:
J. Chiang <jchiang@slac.stanford.edu>

Definition at line 35 of file PyDataSource.h.

Public Member Functions

int addColumn (const std::string &label, boost::python::numeric::array array)
 Add a column to a NumArrayTuple.
int addColumn (const std::string &label, const std::vector< double > &col)
 Add a column to an NTuple or ListTuple.
void clear ()
 Clear the data elements of the DataSource.
boost::python::numeric::array columnAsNumArray (unsigned int index) const
 Return a column from the ntuple as a numarray object, indexing by column number.
boost::python::numeric::array columnAsNumArray (const std::string &label) const
 Return a column from the ntuple as a numarray object, indexing by column label.
unsigned int columns () const
const DataSourcedataSource () const
 Return a reference to the underlying DataSource.
const std::vector< double > & getColumn (unsigned int index) const
 Get a column as a tuple of floats by column index.
const std::vector< double > & getColumn (const std::string &name) const
 Get a column as a tuple of floats by column name.
const std::vector< std::string > & getLabels () const
 Get the column names.
const std::stringgetTitle () const
 The title of the DataSource.
bool hasColumn (const std::string &colname) const
 Return true if column with label colname exists in ntuple.
 PyDataSource (const std::string &name, DataSource *source)
 Constructor taking an existing DataSource and its name as an argument.
 PyDataSource (const std::string &dataSource)
 Constructor taking the kind of DataSource as an argument.
 PyDataSource ()
 Default constructor wraps an ordinary NTuple.
void registerNTuple (const std::string &name)
 Register this ntuple by a chosen name.
std::string registerNTuple ()
 Register this ntuple, returning a unique name.
void replaceColumn (unsigned int index, boost::python::numeric::array array)
 Replace a column by its index.
void replaceColumn (const std::string &, boost::python::numeric::array array)
 Replace a column by its label.
void replaceColumn (unsigned int index, const std::vector< double > &col)
 Replace a column by its index.
void replaceColumn (const std::string &, const std::vector< double > &col)
 Replace a column by its label.
unsigned int rows () const
void saveColumnFromNumArray (unsigned int index, boost::python::numeric::array array)
 Replace or add a column from a numarray object, indexing by column label.
void saveColumnFromNumArray (const std::string &label, boost::python::numeric::array array)
 Replace or add a column from a numarray object, indexing by column label.
void setName (const std::string &name)
 Set the name of the ntuple.
void setTitle (const std::string &title)
 ~PyDataSource ()

Private Attributes

DataSourcem_dataSource
 The actual DataSource object.
std::string m_type
 The type of data source.

Classes

class  StopIteration


Constructor & Destructor Documentation

PyDataSource::PyDataSource  ) 
 

Default constructor wraps an ordinary NTuple.

Definition at line 258 of file PyDataSource.cxx.

References m_dataSource, and m_type.

PyDataSource::PyDataSource const std::string dataSource  ) 
 

Constructor taking the kind of DataSource as an argument.

Definition at line 271 of file PyDataSource.cxx.

References m_dataSource.

PyDataSource::PyDataSource const std::string name,
DataSource source
 

Constructor taking an existing DataSource and its name as an argument.

Definition at line 264 of file PyDataSource.cxx.

PyDataSource::~PyDataSource  ) 
 

Definition at line 285 of file PyDataSource.cxx.

References m_dataSource.


Member Function Documentation

int PyDataSource::addColumn const std::string label,
boost::python::numeric::array  array
 

Add a column to a NumArrayTuple.

Definition at line 402 of file PyDataSource.cxx.

References NumArrayTuple::addColumn(), m_dataSource, and m_type.

int PyDataSource::addColumn const std::string label,
const std::vector< double > &  col
 

Add a column to an NTuple or ListTuple.

Definition at line 385 of file PyDataSource.cxx.

References ListTuple::addColumn(), NTuple::addColumn(), DataSource::columns(), m_dataSource, and m_type.

Referenced by hippodraw::Python::export_DataArray(), and saveColumnFromNumArray().

void PyDataSource::clear  ) 
 

Clear the data elements of the DataSource.

Definition at line 413 of file PyDataSource.cxx.

References DataSource::clear(), and m_dataSource.

boost::python::numeric::array PyDataSource::columnAsNumArray unsigned int  index  )  const
 

Return a column from the ntuple as a numarray object, indexing by column number.

Definition at line 450 of file PyDataSource.cxx.

References columns(), DataSource::getColumn(), NumArrayTuple::getNumArray(), m_dataSource, m_type, num_util::makeNum(), and num_util::shape().

boost::python::numeric::array PyDataSource::columnAsNumArray const std::string label  )  const
 

Return a column from the ntuple as a numarray object, indexing by column label.

Definition at line 436 of file PyDataSource.cxx.

References DataSource::getColumn(), NumArrayTuple::getNumArray(), m_dataSource, m_type, num_util::makeNum(), and num_util::shape().

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

unsigned int PyDataSource::columns  )  const
 

Definition at line 290 of file PyDataSource.cxx.

References DataSource::columns(), and m_dataSource.

Referenced by columnAsNumArray(), hippodraw::Python::export_DataArray(), and saveColumnFromNumArray().

const DataSource& PyDataSource::dataSource  )  const [inline]
 

Return a reference to the underlying DataSource.

Definition at line 53 of file PyDataSource.h.

References m_dataSource.

Referenced by hippodraw::Python::export_DataArray(), PyDataRep::PyDataRep(), QtCut::QtCut(), and QtDisplay::QtDisplay().

const std::vector< double > & PyDataSource::getColumn unsigned int  index  )  const
 

Get a column as a tuple of floats by column index.

Definition at line 320 of file PyDataSource.cxx.

References DataSource::getColumn(), and m_dataSource.

const std::vector< double > & PyDataSource::getColumn const std::string name  )  const
 

Get a column as a tuple of floats by column name.

Definition at line 315 of file PyDataSource.cxx.

References DataSource::getColumn(), and m_dataSource.

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

const std::vector< std::string > & PyDataSource::getLabels  )  const
 

Get the column names.

Definition at line 310 of file PyDataSource.cxx.

References DataSource::getLabels(), and m_dataSource.

Referenced by hippodraw::Python::export_DataArray(), and hasColumn().

const std::string & PyDataSource::getTitle  )  const
 

The title of the DataSource.

Definition at line 298 of file PyDataSource.cxx.

References m_dataSource, and DataSource::title().

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

bool PyDataSource::hasColumn const std::string colname  )  const
 

Return true if column with label colname exists in ntuple.

Definition at line 417 of file PyDataSource.cxx.

References std::find(), and getLabels().

Referenced by hippodraw::Python::export_DataArray(), and saveColumnFromNumArray().

void PyDataSource::registerNTuple const std::string name  ) 
 

Register this ntuple by a chosen name.

Definition at line 422 of file PyDataSource.cxx.

References DataSourceController::instance(), m_dataSource, DataSourceController::registerNTuple(), and DataSource::setName().

std::string PyDataSource::registerNTuple  ) 
 

Register this ntuple, returning a unique name.

Definition at line 428 of file PyDataSource.cxx.

References DataSourceController::instance(), m_dataSource, and DataSourceController::registerNTuple().

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

void PyDataSource::replaceColumn unsigned int  index,
boost::python::numeric::array  array
 

Replace a column by its index.

Definition at line 373 of file PyDataSource.cxx.

References m_dataSource, m_type, and NumArrayTuple::replaceColumn().

void PyDataSource::replaceColumn const std::string ,
boost::python::numeric::array  array
 

Replace a column by its label.

Definition at line 360 of file PyDataSource.cxx.

References m_dataSource, m_type, and NumArrayTuple::replaceColumn().

void PyDataSource::replaceColumn unsigned int  index,
const std::vector< double > &  col
 

Replace a column by its index.

Definition at line 344 of file PyDataSource.cxx.

References DataSource::getLabels(), m_dataSource, and replaceColumn().

void PyDataSource::replaceColumn const std::string ,
const std::vector< double > &  col
 

Replace a column by its label.

Definition at line 326 of file PyDataSource.cxx.

References m_dataSource, m_type, ListTuple::replaceColumn(), and NTuple::replaceColumn().

Referenced by hippodraw::Python::export_DataArray(), replaceColumn(), and saveColumnFromNumArray().

unsigned int PyDataSource::rows  )  const
 

Definition at line 294 of file PyDataSource.cxx.

References m_dataSource, and DataSource::rows().

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

void PyDataSource::saveColumnFromNumArray unsigned int  index,
boost::python::numeric::array  array
 

Replace or add a column from a numarray object, indexing by column label.

Definition at line 546 of file PyDataSource.cxx.

References columns(), extractVector(), m_dataSource, m_type, ListTuple::replaceColumn(), NTuple::replaceColumn(), and replaceColumn().

void PyDataSource::saveColumnFromNumArray const std::string label,
boost::python::numeric::array  array
 

Replace or add a column from a numarray object, indexing by column label.

Definition at line 483 of file PyDataSource.cxx.

References NTuple::addColumn(), ListTuple::addColumn(), addColumn(), extractVector(), hasColumn(), m_dataSource, m_type, NTuple::replaceColumn(), ListTuple::replaceColumn(), and replaceColumn().

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

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

Set the name of the ntuple.

Definition at line 306 of file PyDataSource.cxx.

References m_dataSource, and DataSource::setName().

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

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

Definition at line 302 of file PyDataSource.cxx.

References m_dataSource, and DataSource::setTitle().

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


Member Data Documentation

DataSource* PyDataSource::m_dataSource [private]
 

The actual DataSource object.

Definition at line 161 of file PyDataSource.h.

Referenced by addColumn(), clear(), columnAsNumArray(), columns(), dataSource(), getColumn(), getLabels(), getTitle(), PyDataSource(), registerNTuple(), replaceColumn(), rows(), saveColumnFromNumArray(), setName(), setTitle(), and ~PyDataSource().

std::string PyDataSource::m_type [private]
 

The type of data source.

Definition at line 158 of file PyDataSource.h.

Referenced by addColumn(), columnAsNumArray(), PyDataSource(), replaceColumn(), and saveColumnFromNumArray().


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