1 #ifndef __JROOT__JROOTSTREAMER__
2 #define __JROOT__JROOTSTREAMER__
29 namespace JPP {
using namespace JROOT; }
73 std::istream(in.rdbuf()),
75 dictionary(dictionary)
116 if (cls.is_valid()) {
118 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
120 for (
JEquation equation; *
this >> equation; ) {
128 JRedirectString redirect(*
this, equation.getValue());
130 if (facet.isDivision (equation.getSeparator()))
132 else if (facet.isSeparator(equation.getSeparator()))
137 status &= (!this->
fail() || this->eof());
177 i->second->getObject(*
this, cls.
getAddress());
179 }
else if (cls.
getClass() != NULL) {
181 if (cls.
getClass()->GetListOfBases() != NULL) {
183 TIterator* i = cls.
getClass()->GetListOfBases()->MakeIterator();
185 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL && (
bool) (*this); ) {
190 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
192 TIterator* i = cls.
getClass()->GetListOfDataMembers()->MakeIterator();
194 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL && (
bool) (*this); ) {
213 return getObject(const_cast<const JRootReadableClass&>(cls));
254 template<
class JElement_t,
class JAllocator_t>
261 for (JElement_t element; n != 0 && this->
getObject(element); --
n) {
262 object.push_back(element);
306 std::ostream(out.rdbuf()),
308 dictionary(dictionary)
314 precision(out.precision());
358 JRedirectStream redirect(*
this, os);
363 return this->put(
JEquation(key, os.str()));
375 return this->put(
"", cls,
false);
387 return this->put(const_cast<const JRootWritableClass&>(cls));
406 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
412 i->second->put(*
this, prefix, cls.
getAddress());
419 JRedirectStream redirect(*
this, os);
426 }
else if (cls.
getClass() != NULL) {
428 if (cls.
getClass()->GetListOfBases() != NULL) {
430 TIterator* i = cls.
getClass()->GetListOfBases()->MakeIterator();
432 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
433 this->put(prefix, cls.
get(*p),
false);
437 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
439 TIterator* i = cls.
getClass()->GetListOfDataMembers()->MakeIterator();
441 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
443 this->put(facet.getPrefix(prefix,p->GetName()), cls.
get(*p),
false);
497 i->second->putObject(*
this, cls.
getAddress());
499 }
else if (cls.
getClass() != NULL) {
501 if (cls.
getClass()->GetListOfBases() != NULL) {
503 TIterator* i = cls.
getClass()->GetListOfBases()->MakeIterator();
505 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
510 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
512 TIterator* i = cls.
getClass()->GetListOfDataMembers()->MakeIterator();
514 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
567 template<
class JElement_t,
class JAllocator_t>
629 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.
JRootAddressableClass find(const char *name) const
Find addressable base class or data member with given name within current class.
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).
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.
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.
alias put_queue eval echo n
JRootReader & getObject(T &object, const JBool< true > &option)
Read object.
const JRootDictionary_t & dictionary
JRootWriter & put(const T &object)
Write object according equation format.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
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.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.
JRootWriter & putObject(const std::vector< JElement_t, JAllocator_t > &object, const JBool< false > option)
Write object.