Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JROOT::JASCIIFileWriter< T > Struct Template Reference

Auxiliary class to write object with ROOT dictionary from ASCII formatted file. More...

#include <JASCIIFileStreamer.hh>

Inheritance diagram for JROOT::JASCIIFileWriter< T >:

Public Member Functions

 JASCIIFileWriter (const JRootDictionary &dictionary=JRootDictionary::getInstance())
 Constructor.
 
 JASCIIFileWriter (const char *const file_name, const JRootDictionary &dictionary=JRootDictionary::getInstance())
 Constructor.
 
JASCIIFileWriteroperator<< (const T &object)
 Write object to this file.
 

Private Attributes

object
 internal value
 
std::vector< JROOT::JRootWritableClasscolumns
 column count -> data member
 
JRootWriter writer
 

Detailed Description

template<class T>
struct JROOT::JASCIIFileWriter< T >

Auxiliary class to write object with ROOT dictionary from ASCII formatted file.

The names of in the first line are one-to-one mapped to the names of the data members of the corresponding data structure using the corresponding ROOT dictionary.

Definition at line 132 of file JASCIIFileStreamer.hh.

Constructor & Destructor Documentation

◆ JASCIIFileWriter() [1/2]

template<class T >
JROOT::JASCIIFileWriter< T >::JASCIIFileWriter ( const JRootDictionary & dictionary = JRootDictionary::getInstance())
inline

Constructor.

Parameters
dictionarydictionary

Definition at line 142 of file JASCIIFileStreamer.hh.

142 :
143 writer(static_cast<std::ostream&>(*this), JLANG::JEquationParameters(), dictionary)
144 {}
Simple data structure to support I/O of equations (see class JLANG::JEquation).

◆ JASCIIFileWriter() [2/2]

template<class T >
JROOT::JASCIIFileWriter< T >::JASCIIFileWriter ( const char *const file_name,
const JRootDictionary & dictionary = JRootDictionary::getInstance() )
inline

Constructor.

Parameters
file_namefile name
dictionarydictionary

Definition at line 153 of file JASCIIFileStreamer.hh.

154 :
155 writer(static_cast<std::ostream&>(*this), JLANG::JEquationParameters(), dictionary)
156 {
157 this->open(file_name);
158 }
T * open(const std::string &file_name)
Open file.

Member Function Documentation

◆ operator<<()

template<class T >
JASCIIFileWriter & JROOT::JASCIIFileWriter< T >::operator<< ( const T & object)
inline

Write object to this file.

Parameters
objectobject
Returns
this input stream

Definition at line 167 of file JASCIIFileStreamer.hh.

168 {
169 using namespace std;
170 using namespace JPP;
171
172 if (columns.empty()) {
173
174 JRootWritableClass cls(this->object);
175
176 for (const TDataMember* p : getListOfDataMembers<T>()) {
177
178 static_cast<ostream&>(*this) << ' ' << p->GetName();
179
180 columns.push_back(cls.get(*p));
181 }
182
183 static_cast<ostream&>(*this) << endl;
184 }
185
186 this->object = object;
187
188 writer.flags(this->flags());
189
190 for (size_t i = 0; i != columns.size(); ++i) {
192 }
193
194 return *this;
195 }
JRootWriter & putObject(const T &object)
Write object.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
std::vector< TDataMember * > getListOfDataMembers()
Get list of ROOT data members for given class.
std::vector< JROOT::JRootWritableClass > columns
column count -> data member
ROOT class for writing from object.

Member Data Documentation

◆ object

template<class T >
T JROOT::JASCIIFileWriter< T >::object
private

internal value

Definition at line 198 of file JASCIIFileStreamer.hh.

◆ columns

template<class T >
std::vector<JROOT::JRootWritableClass> JROOT::JASCIIFileWriter< T >::columns
private

column count -> data member

Definition at line 200 of file JASCIIFileStreamer.hh.

◆ writer

template<class T >
JRootWriter JROOT::JASCIIFileWriter< T >::writer
private

Definition at line 202 of file JASCIIFileStreamer.hh.


The documentation for this struct was generated from the following file: