DataRepController Class Reference

#include <DataRepController.h>

Collaboration diagram for DataRepController:

Collaboration graph
[legend]

List of all members.


Detailed Description

A singleton class that is the interface between GUI and the DataRep.

It frequently implements the application logic which should neither be in the GUI nor in the display objects.

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

Definition at line 36 of file DataRepController.h.


Public Member Functions

const std::vector
< std::string > & 
bindingOptions (DataRep *rep)
 Returns the binding options, if any, for the DataRep.
const std::vector
< std::string > & 
bindingOptions (const std::string &name)
 Returns the binding options, if any, for the named DataRep.
void changeDataSource (DataRep *rep, const DataSource *tuple)
 Changes the DataSource.
DataRepcreateDataRep (const std::string &name, const DataSource *ntuple, const std::vector< std::string > &bindings) const
 Creates a new DataRep object of class name.
DataRepcreateDataRep (const std::string &name)
 Creates a new DataRep object of class name.
const std::vector
< std::string > & 
names () const
 Returns the names of the types of DataRep objects available.
void setAxisBindings (DataRep *rep, const DataSource *ntuple, const std::vector< std::string > &bindings) const
 Sets the axis binding of the DataRep object.
 ~DataRepController ()
 The destructor.

Static Public Member Functions

static
DataRepController
instance ()
 Returns the pointer to the singleton instance.

Protected Member Functions

 DataRepController ()
 A default constructor for avoiding creation except by itself or with derived classes.

Private Member Functions

bool checkBindings (const DataSource *tuple, const std::vector< std::string > &bindings) const
 Returns true if all the the string objects in the vector bindings are valid labels for the columns in DataSource tuple.
 DataRepController (const DataRepController &)
 A private copy constructor in order to avoid copying.

Private Attributes

std::vector
< std::string > 
m_null_vector
 A empty vector of strings.

Static Private Attributes

static
DataRepController
s_instance = 0
 The pointer to the singleton object.

Constructor & Destructor Documentation

DataRepController ( const DataRepController  )  [private]

A private copy constructor in order to avoid copying.

DataRepController (  )  [protected]

A default constructor for avoiding creation except by itself or with derived classes.

Definition at line 40 of file DataRepController.cxx.

Referenced by DataRepController::instance().

~DataRepController (  ) 

The destructor.

Definition at line 44 of file DataRepController.cxx.

References DataRepFactory::instance().


Member Function Documentation

const vector< string > & bindingOptions ( DataRep rep  ) 

Returns the binding options, if any, for the DataRep.

If no binding options are available, return an empty vector.

Definition at line 68 of file DataRepController.cxx.

References NTupleProjector::bindingOptions(), DataRep::getProjector(), and DataRepController::m_null_vector.

const vector< string > & bindingOptions ( const std::string &  name  ) 

Returns the binding options, if any, for the named DataRep.

If no binding options are available, return an empty vector.

Definition at line 59 of file DataRepController.cxx.

References DataRepFactory::instance(), and Factory::prototype().

Referenced by DisplayController::bindingOptions().

void changeDataSource ( DataRep rep,
const DataSource tuple 
)

Changes the DataSource.

Attempt to change the DataSource for the DataRep object while preserving the bindings. The object rep must be one that contains a NTupleProjector, otherwise an assertion is raised. If the ntuple doesn't have column labels required, then the old data source is restored and a DataSourceException is thrown.

Definition at line 173 of file DataRepController.cxx.

References DataRepController::setAxisBindings().

bool checkBindings ( const DataSource tuple,
const std::vector< std::string > &  bindings 
) const [private]

Returns true if all the the string objects in the vector bindings are valid labels for the columns in DataSource tuple.

Otherwise returns false.

Definition at line 81 of file DataRepController.cxx.

Referenced by DataRepController::createDataRep().

DataRep * createDataRep ( const std::string &  name,
const DataSource ntuple,
const std::vector< std::string > &  bindings 
) const

Creates a new DataRep object of class name.

Connects the newly created DataRep to ntuple and sets the bindings to bindings. Returns DataRep if successful, otherwise an DataRepException is thrown.

Definition at line 127 of file DataRepController.cxx.

References DataRepController::checkBindings(), Factory::create(), DataSource::expandIfNeeded(), DataRepFactory::instance(), and DataRepController::setAxisBindings().

DataRep * createDataRep ( const std::string &  name  ) 

Creates a new DataRep object of class name.

It should be a class that does not have NTuple bindings. Returns the DataRep object if successful, otherwise a DataRepException is thrown.

Definition at line 108 of file DataRepController.cxx.

References DataRepFactory::instance(), and FactoryException::what().

Referenced by DisplayController::addDataRep(), DisplayController::addDataRepStacked(), CutController::createCut(), DataRepXML::createDataRep(), and PyDataRep::PyDataRep().

DataRepController * instance (  )  [static]

Returns the pointer to the singleton instance.

Definition at line 50 of file DataRepController.cxx.

References DataRepController::DataRepController(), and DataRepController::s_instance.

Referenced by DisplayController::addDataRep(), DisplayController::addDataRepStacked(), DisplayController::bindingOptions(), CutController::createCut(), DataRepXML::createDataRep(), DisplayController::createDisplay(), PyDataRep::names(), Inspector::ntupleChanged(), PyDataRep::PyDataRep(), and DisplayController::~DisplayController().

const vector< string > & names (  )  const

Returns the names of the types of DataRep objects available.

Definition at line 99 of file DataRepController.cxx.

References DataRepFactory::instance().

void setAxisBindings ( DataRep rep,
const DataSource ntuple,
const std::vector< std::string > &  bindings 
) const

Sets the axis binding of the DataRep object.

Definition at line 146 of file DataRepController.cxx.

References Observable::addObserver(), DataRep::getProjector(), DataRep::setAxisBindings(), NTupleProjector::setNTuple(), and num_util::size().

Referenced by DataRepController::changeDataSource(), and DataRepController::createDataRep().


Member Data Documentation

std::vector< std::string > m_null_vector [private]

A empty vector of strings.

This vector is returned by member functions that can not obtain a reference from a DataRep.

Definition at line 46 of file DataRepController.h.

Referenced by DataRepController::bindingOptions().

DataRepController * s_instance = 0 [static, private]

The pointer to the singleton object.

Definition at line 42 of file DataRepController.h.

Referenced by DataRepController::instance().


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen