DataSourceController.h
Go to the documentation of this file.
1 /* -*- mode: c++ -*- */
2 
14 #ifndef _DataSourceController_H_
15 #define _DataSourceController_H_
16 
17 #include "pattern/Observer.h"
18 
19 #ifdef _MSC_VER
20 #include <msdevstudio/MSconfig.h>
21 #pragma warning(disable:4290) // advice from MSDN article and others
22  // VC++ is not following the standard
23 #endif
24 
25 #include <stdexcept>
26 #include <vector>
27 
28 namespace hippodraw {
29 
30 class DataSource;
31 class Observable;
32 
41 {
42 
43 private:
44 
47 
50 
53 
57  typedef std::vector < DataSource * > DataSourceList_t;
58 
62 
66 
68  mutable std:: vector < std::string > m_names;
69 
71  std::string m_base_name;
72 
75  int m_suffix;
76 
80 
81 public:
82 
84  static DataSourceController * instance ();
85 
90  virtual void update ( const Observable * );
91 
95  void willDelete ( const Observable * observee );
96 
102  int indexOfDataSource ( const std::string & name ) const;
103 
111  DataSource * findDataSource ( const std::string & name )
112  const throw ( std::runtime_error );
113 
121  DataSource * getDataSource ( const std::string & name ) const;
122 
127  void changeName ( const std::string & old_name,
128  const std::string & new_name );
129 
130 
137  void getDataSources ( std::vector < DataSource * > &,
138  bool all = true ) const;
139 
145  const std::vector < std::string > & getNTupleNames () const;
146 
149  void registerDataSourceFile ( DataSource * ds );
150 
155  std::string registerNTuple ( DataSource * nt );
156 
162  void registerNTuple ( const std::string &, DataSource * source );
163 
168  void unregisterNTuple ( const DataSource * nt );
169 
173  bool isFromFile ( const DataSource * source ) const;
174 
177  DataSource * getCurrent () const;
178 
181  void setCurrentIndex ( int index );
182 
183 };
184 
185 } // namespace hippodraw
186 
187 #endif // _DataSourceController_H_

Generated for HippoDraw Class Library by doxygen