14 #include "msdevstudio/MSconfig.h"
32 using std::runtime_error;
36 using namespace hippodraw;
58 const vector< string > &
67 const vector < string > &
82 const std::vector < std::string > & bindings )
const
84 if ( ntuple == 0 )
return false;
87 vector < string > ::const_iterator first = bindings.begin ();
88 while ( first != bindings.end() ) {
89 const string & label = *first++;
90 if ( label ==
"nil" )
continue;
91 ntuple -> throwIfInvalidLabel ( label );
97 const vector < string > &
103 return factory ->
names ();
113 rep = factory -> create ( type );
116 const string what = e.
what ();
120 projector -> addObserver ( rep );
129 const std::vector < std::string > & bindings )
const
148 const std::vector < std::string > & bindings )
const
158 const vector < const TupleCut * > & cuts = ntProjector -> getCutList ();
159 unsigned int size = cuts.size ();
160 for (
unsigned int i = 0; i <
size; i++ ) {
162 const string & label = tc -> getLabel ();
163 unsigned int index = ntProjector -> indexOf ( label );
165 cut -> setColumn ( index );
177 assert ( projector != 0 );
179 DataSource * source = projector -> getNTuple ();
180 source -> removeObserver ( rep );
182 const vector < string > & bindings = projector -> getAxisBindings ();
187 catch (
const runtime_error & e ) {
static DataRepFactory * instance()
Returns the pointer to the singleton instance.
void setAxisBindings(DataRep *rep, const DataSource *ntuple, const std::vector< std::string > &bindings) const
Sets the axis binding of the DataRep object.
The base class for the Projector hierarchy.
hippodraw::TupleCut class interface
Type * create(const std::string &name)
Creates a new object from a prototype named name.
virtual void setNTuple(const DataSource *source)
Changes the DataSource used for the projections to source.
static DataRepController * instance()
Returns the pointer to the singleton instance.
const std::vector< std::string > & names() const
Returns the names of the types of DataRep objects available.
An NTupleProjector is a projector that projects data from an DataSource object.
virtual ProjectorBase * getProjector() const
Returns the Projector object controlling the data.
hippodraw::NTupleProjector class interface
hippodraw::PlotterBase class interface.
Base class for DataSource.
virtual const std::vector< std::string > & bindingOptions() const
Returns a vector of strings describing the binding options.
PyArray_TYPES type(numeric::array arr)
~DataRepController()
The destructor.
static DataRepController * s_instance
The pointer to the singleton object.
std::vector< std::string > m_null_vector
A empty vector of strings.
The class expresses a cut on a DataSource, i.e.
An xception class that is thrown when attempting to bind a DataRep to a NTuple with a column name tha...
virtual void expandIfNeeded(const std::vector< std::string > &labels) const
Expand the multidimension column if needed.
intp size(numeric::array arr)
DataRep * createDataRep(const std::string &name)
Creates a new DataRep object of class name.
An exception class that is thrown when the factory fails to find the request class by its name...
The base class for data representations.
void changeDataSource(DataRep *rep, const DataSource *tuple)
Changes the DataSource.
Type * prototype(const std::string &name) const
Returns a pointer to a prototype with name name.
This Singleton class maintains a list of DataRep objects.
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...
A singleton class that is the interface between GUI and the DataRep.
hippodraw::NTuple class interface.
const std::vector< std::string > & bindingOptions(const std::string &name)
Returns the binding options, if any, for the named DataRep.
hippodraw::FunctionRep class interface
void addObserver(Observer *)
Adds an Observer to the Observer list.
DataRepController class interface.
DataRepController()
A default constructor for avoiding creation except by itself or with derived classes.
virtual void setAxisBindings(const std::vector< std::string > &bindings)
Sets the axis bindings.
char const * what() const
The error message that can be retreived.