00001 /* -*- mode: c++ -*- */ 00002 00014 #ifndef _NTupleController_H_ 00015 #define _NTupleController_H_ 00016 00017 #include "pattern/libhippo.h" 00018 00019 #include <map> 00020 #include <string> 00021 #include <vector> 00022 00023 class CircularBuffer; 00024 class DataSource; 00025 class NTuple; 00026 class Observable; 00027 00040 class MDL_HIPPOPLOT_API NTupleController 00041 { 00042 00043 private: 00044 00046 static NTupleController * s_instance; 00047 00048 00050 NTupleController(); 00051 00053 NTupleController ( const NTupleController & ); 00054 00059 std::string::size_type findWhite ( const std::string & line, 00060 unsigned int left = 0, 00061 bool tabs_only = false ); 00062 00067 int readAsciiNTuple ( NTuple * ntuple, const std::string & filename ); 00068 00069 public: 00070 00072 static NTupleController * instance (); 00073 00084 DataSource * createNTuple ( const std::string & filename ); 00085 00095 NTuple * createNTuple ( const std::vector < std::string > & labels ); 00096 00102 CircularBuffer * 00103 createCircularBuffer ( const std::vector < std::string > & labels ); 00104 00112 NTuple * createNTuple ( unsigned int columns ); 00113 00121 CircularBuffer * createCircularBuffer ( unsigned int columns ); 00122 00126 NTuple * createNTuple ( ); 00127 00135 CircularBuffer * createCircularBuffer ( ); 00136 00142 DataSource * findDataSource ( const std::string & name ) const; 00143 00149 void changeName ( DataSource * source, 00150 const std::string & newname ); 00151 00156 int writeNTupleToFile ( DataSource * source, 00157 const std::string & filename ); 00158 00162 int writeNTupleToFile ( const std::string & name, 00163 const std::string & filename ); 00164 00171 void saveNTuples ( const std::string & prefix, 00172 const std::string & suffix ); 00173 00179 std::string registerNTuple ( DataSource * nt ); 00180 00187 void registerNTuple ( const std::string &, DataSource * ntuple ); 00188 00189 }; 00190 00191 #endif // _NTupleController_H_