00001
00002
00014 #ifndef _NTupleController_H_
00015 #define _NTupleController_H_
00016
00017 #include "pattern/libhippo.h"
00018
00019 #include <string>
00020 #include <vector>
00021
00022 namespace hippodraw {
00023
00024 class CircularBuffer;
00025 class DataSource;
00026 class NTuple;
00027 class Observable;
00028 class TupleCut;
00029
00042 class MDL_HIPPOPLOT_API NTupleController
00043 {
00044
00045 private:
00046
00048 static NTupleController * s_instance;
00049
00050
00052 NTupleController();
00053
00055 NTupleController ( const NTupleController & );
00056
00061 std::string::size_type findWhite ( const std::string & line,
00062 unsigned int left = 0,
00063 bool tabs_only = false );
00064
00069 int readAsciiNTuple ( NTuple * ntuple, const std::string & filename );
00070
00074 void splitAndFill ( const std::string & line,
00075 std::vector < std::string > & values );
00076
00077 public:
00078
00080 static NTupleController * instance ();
00081
00089 DataSource * createNTuple ( const std::string & filename );
00090
00092 void fillFromFile ( const std::string & file, NTuple * source );
00093
00103 NTuple * createNTuple ( const std::vector < std::string > & labels );
00104
00110 CircularBuffer *
00111 createCircularBuffer ( const std::vector < std::string > & labels );
00112
00120 NTuple * createNTuple ( unsigned int columns );
00121
00129 CircularBuffer * createCircularBuffer ( unsigned int columns );
00130
00134 NTuple * createNTuple ( );
00135
00143 CircularBuffer * createCircularBuffer ( );
00144
00149 DataSource * findDataSource ( const std::string & name ) const;
00150
00155 void changeName ( DataSource * source,
00156 const std::string & newname );
00157
00164 int writeNTupleToFile ( DataSource * source,
00165 const std::string & filename );
00166
00173 int writeNTupleToFile ( const std::string & name,
00174 const std::string & filename );
00175
00184 void saveNTuples ( const std::string & prefix,
00185 const std::string & suffix );
00186
00192 std::string registerNTuple ( DataSource * nt );
00193
00200 void registerNTuple ( const std::string &, DataSource * ntuple );
00201
00204 NTuple * createNTuple ( const std::vector < std::string > & column_list,
00205 const std::vector < const TupleCut * > & cut_list,
00206 DataSource * ds );
00207
00210 int createNTupleToFile( const std::vector < std::string > & column_list,
00211 const std::vector < const TupleCut * > & cut_list,
00212 DataSource * ds,
00213 const std::string & filename,
00214 const std::string & dsname);
00215
00216 };
00217
00218 }
00219
00220 #endif // _NTupleController_H_