1 #ifndef __JROOT__JROOTSTREAMER__
2 #define __JROOT__JROOTSTREAMER__
30 namespace JPP {
using namespace JROOT; }
74 std::istream(in.rdbuf()),
76 dictionary(dictionary)
117 if (cls.is_valid()) {
119 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
121 for (
JEquation equation; *
this >> equation; ) {
129 JRedirectString redirect(*
this, equation.getValue());
131 if (facet.isDivision (equation.getSeparator()))
133 else if (facet.isSeparator(equation.getSeparator()))
138 status &= (!this->
fail() || this->eof());
178 i->second->getObject(*
this, cls.
getAddress());
180 }
else if (cls.
getClass() != NULL) {
182 if (cls.
getClass()->GetListOfBases() != NULL) {
184 std::unique_ptr<TIterator>
i(cls.
getClass()->GetListOfBases()->MakeIterator());
186 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL && (
bool) (*this); ) {
191 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
193 std::unique_ptr<TIterator>
i(cls.
getClass()->GetListOfDataMembers()->MakeIterator());
195 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL && (
bool) (*this); ) {
214 return getObject(const_cast<const JRootReadableClass&>(cls));
255 template<
class JElement_t,
class JAllocator_t>
262 for (JElement_t element; n != 0 && this->
getObject(element); --
n) {
263 object.push_back(element);
307 std::ostream(out.rdbuf()),
309 dictionary(dictionary)
315 precision(out.precision());
359 JRedirectStream redirect(*
this, os);
364 return this->put(
JEquation(key, os.str()));
376 return this->put(
"", cls,
false);
388 return this->put(const_cast<const JRootWritableClass&>(cls));
407 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
413 i->second->put(*
this, prefix, cls.
getAddress());
420 JRedirectStream redirect(*
this, os);
427 }
else if (cls.
getClass() != NULL) {
429 if (cls.
getClass()->GetListOfBases() != NULL) {
431 std::unique_ptr<TIterator>
i(cls.
getClass()->GetListOfBases()->MakeIterator());
433 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
434 this->put(prefix, cls.
get(*p),
false);
438 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
440 std::unique_ptr<TIterator>
i(cls.
getClass()->GetListOfDataMembers()->MakeIterator());
442 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
444 this->put(facet.getPrefix(prefix,p->GetName()), cls.
get(*p),
false);
498 i->second->putObject(*
this, cls.
getAddress());
500 }
else if (cls.
getClass() != NULL) {
502 if (cls.
getClass()->GetListOfBases() != NULL) {
504 std::unique_ptr<TIterator>
i(cls.
getClass()->GetListOfBases()->MakeIterator());
506 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
511 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
513 std::unique_ptr<TIterator>
i(cls.
getClass()->GetListOfDataMembers()->MakeIterator());
515 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
568 template<
class JElement_t,
class JAllocator_t>
630 return writer.
put(key, value);
const JRootDictionary_t & getDictionary() const
Get dictictionary.
JRootWriter & put(const std::string &key, const T &value)
Write given key and value according equation format.
JRootWriter & putObject(const T &object, const JBool< true > &option)
Write object.
ROOT class for reading object.
JRootReader & getObject(T &object, const JBool< false > &option)
Read object.
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation).
Implementation for ASCII output of objects with ROOT dictionary.
static JRootReader & getObject(JRootReader &reader, T &object)
Read object.
virtual JRootWriter & put(const JEquation &equation)
Write equation.
const char * getTypename() const
Get type name.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
This class can be used to temporarily exchange the states between streams.
std::ostream & white_space(std::ostream &out)
Print white space.
Auxiliary template class to define default implementation of the ROOT streamer.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Simple data structure to support I/O of equations (see class JLANG::JEquation).
then usage $script< detector file >< detectorfile > nIf the range of floors is the first detector file is aligned to the second before the comparison nIn this
virtual JRootReader & getObject(JRootReader &in, void *address) const
Stream input.
Forward declaration of writer object.
virtual JRootWriter & putObject(JRootWriter &out, const void *address) const
Stream output.
JRootWriter & putObject(const T &object)
Write object.
Test availability of stream operators.
General purpose equation class.
virtual JRootWriter & put(JRootWriter &out, const std::string &prefix, const void *address) const
Stream output.
Implementation for ASCII input of objects with ROOT dictionary.
Auxiliary template class for type bool.
const JRootDictionary_t & dictionary
pointer_type getAddress() const
Get address.
do set_variable OUTPUT_DIRECTORY $WORKDIR T
JRootReader & getObject(const JRootReadableClass &cls)
Read ROOT class.
JRootWriter(std::ostream &out, const JEquationParameters ¶meters, const JRootDictionary_t &dictionary)
Constructor.
JRootReader(std::istream &in, const JEquationParameters ¶meters, const JRootDictionary_t &dictionary)
Constructor.
static JRootWriter & putObject(JRootWriter &writer, const T &object)
Write object.
JRootReader & getObject(T &object)
Read object.
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory.
JRootReader & getObject(JRootReadableClass &cls)
Read ROOT class.
JRootWriter & put(const std::string &prefix, const JRootWritableClass &cls, bool eol)
Write ROOT class according equation format.
JRootWriter & put(JRootWritableClass &cls)
Write ROOT class according equation format.
JRootReader & getObject(std::vector< JElement_t, JAllocator_t > &object, const JBool< false > &option)
Read object.
JRootAddressableClass get(const TDataMember &data_member) const
Get addressable class of given data member.
bool fail(std::istream &in)
Check for stream state.
This file contains the basic interface for ASCII I/O of ROOT objects.
JRootWriter & putObject(const T &object, const JBool< false > &option)
Write object.
Type definition of ROOT based dictionary for ASCII I/O.
static JRootWriter & put(JRootWriter &writer, const std::string &key, const T &value)
Write given key and value according equation format.
bool is_valid() const
Check validity of this addressable class.
TClass * getClass() const
Get class.
then fatal The output file must have the wildcard in the e g root fi eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
JRootAddressableClass find(const char *const name) const
Find addressable base class or data member with given name within current class.
JRootReader & getObject(T &object, const JBool< true > &option)
Read object.
const JRootDictionary_t & dictionary
JRootWriter & put(const T &object)
Write object according equation format.
const JRootDictionary_t & getDictionary() const
Get dictionary.
JRootWriter & put(const JRootWritableClass &cls)
Write ROOT class according equation format.
JRootWriter & putObject(const JRootWritableClass &cls)
Write ROOT class.
static bool is_static(const TDataMember &data_member)
Check if data member is static.
ROOT class for writing object.
JRootWriter & putObject(const std::vector< JElement_t, JAllocator_t > &object, const JBool< false > option)
Write object.