11 using namespace
Diana;
13 using
std::stringstream;
28 string begintag =
"begin " + name;
39 string begintag =
"begin " + name;
53 string begintag =
"begin " + name;
54 string endtag =
"end " + name;
66 string begintag =
"begin " + name;
77 string begintag =
"begin " + name;
78 string endtag =
"end " + name;
91 msg<<
"Error while writing object \""<< name <<
"\": "<<
" null pointer";
92 err.SetDescription(__FILE__,__LINE__,msg.str());
96 std::string type = className;
97 if(type ==
"Diana::QVector")
99 const QVector* qvec = (
const QVector*)(obj);
102 else if(type ==
"Diana::QVectorC")
104 const QVectorC* qvec = (
const QVectorC*)(obj);
107 else if(type ==
"Diana::QTime")
112 else if(type ==
"Diana::QMatrix")
117 else if(type ==
"Diana::QBaseType<int>")
119 const QInt* qint = (
const QInt*)(obj);
122 else if(type ==
"Diana::QBaseType<float>")
127 else if(type ==
"Diana::QBaseType<double>")
133 else if(type ==
"Diana::QBool")
138 else if(type ==
"Diana::QString")
145 string begintag =
"begin " + name;
146 string endtag =
"end " + name;
150 fFile->
Comment(
"Automatic dump via QObject::WriteOnStream()");
151 std::stringstream str;
152 err = obj->WriteOnStream(str);
158 msg<<
"Error while writing object \""<< name <<
"\": "<<
err.GetDescription();
159 err.SetDescription(__FILE__,__LINE__,msg.str());
167 string begintag =
"begin " + name;
168 string endtag =
"end " + name;
179 string begintag =
"begin " + name;
180 string endtag =
"end " + name;
182 vector<QVector> qvecs;
184 qvecs.push_back(obj->Re());
185 qvecs.push_back(obj->Im());
196 string begintag =
"begin " + name;
197 string endtag =
"end " + name;
213 err.SetDescription(__FILE__,__LINE__,filename);
222 string begintag =
"begin " + name;
223 string endtag =
"end " + name;
225 vector<QVector> qvecs;
231 ss << nrow <<
" " << ncol;
233 for(
int i=0; i<ncol; i++)
234 qvecs.push_back(obj->
GetCol(i));
#define REGISTER_GLOBAL_WRITER(clazz, ext)
global writer for txt files
void SetQVector(const std::string &name, const Diana::QVector *obj)
QError Close()
Close file, called by QGlobalWriterDispatcher.
void SetFloat(const std::string &name, float obj)
void SetDouble(const std::string &name, double obj)
void SetInt(const std::string &name, int obj)
void SetQMatrix(const std::string &name, const Diana::QMatrix *obj, const std::string &descr)
void SetQTime(const std::string &name, const Diana::QTime *obj)
void SetString(const std::string &name, const std::string &obj)
QError SetQObject(const std::string &name, const std::string &className, const Diana::QObject *obj, const std::string &descr)
void SetBool(const std::string &name, bool obj)
void SetQVectorC(const std::string &name, const Diana::QVectorC *obj)
QError Open(const std::string &filename, const std::string &opt)
Open file, called by QGlobalWriterDispatcher.
Class for reading and writing ascii text files.
bool Exists()
Returns true if the file exists and can be opened.
bool WriteLine(std::string line, bool append=true)
Writes a string to a file, terminated with newline.
int WriteQVectors(std::vector< Diana::QVector > outputVector, bool append=false)
Writes a vector of QVectors, each QVector in a new column. Warning: QVectors of different lengths can...
bool WriteQTime(Diana::QTime *qt, bool append=true)
Writes an object of type QTime.
bool Comment(std::string comment)
Writes a comment to a file; begins with '#', terminates with newline.
bool WriteString(std::string outputString, bool append=false)
Writes a string to a file.
int WriteQVector(Diana::QVector outputVector, bool append=false)
Writes data from a QVector to a file.
base types wrapped into a QObject. Currently implemented types are QInt QDouble and QFloat....
bool wrapped into a QObject
error class with error type and description
Abstract class for global writers.
Interface for matrices in Diana analysis.
QVector GetCol(UInt_t ncol)
get column
UInt_t GetNRow() const
get number rows
UInt_t GetNCol() const
get number of columns
string wrapped into a QObject
the Diana namespace is needed because sometimes we use Qt libraries, that use same class names of our...