1#ifndef __JROOT__JROOTSTREAMER__
2#define __JROOT__JROOTSTREAMER__
31namespace JPP {
using namespace JROOT; }
75 std::istream(in.rdbuf()),
120 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
122 for (
JEquation equation; *
this >> equation; ) {
132 if (facet.
isDivision (equation.getSeparator()))
134 else if (facet.
isSeparator(equation.getSeparator()))
139 status &= (!this->fail() || this->eof());
179 i->second->getObject(*
this, cls.
getAddress());
181 }
else if (cls.
getClass() != NULL) {
183 if (cls.
getClass()->GetListOfBases() != NULL) {
185 std::unique_ptr<TIterator> i(cls.
getClass()->GetListOfBases()->MakeIterator());
187 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL && (
bool) (*
this); ) {
192 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
194 std::unique_ptr<TIterator> i(cls.
getClass()->GetListOfDataMembers()->MakeIterator());
196 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL && (
bool) (*
this); ) {
256 template<
class JElement_t,
class JAllocator_t>
263 for (JElement_t element; n != 0 && this->
getObject(element); --n) {
264 object.push_back(element);
308 std::ostream(out.rdbuf()),
316 precision(out.precision());
377 return this->
put(
"", cls,
false);
408 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
414 i->second->put(*
this, prefix, cls.
getAddress());
428 }
else if (cls.
getClass() != NULL) {
430 if (cls.
getClass()->GetListOfBases() != NULL) {
432 std::unique_ptr<TIterator> i(cls.
getClass()->GetListOfBases()->MakeIterator());
434 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
435 this->
put(prefix, cls.
get(*p),
false);
439 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
441 std::unique_ptr<TIterator> i(cls.
getClass()->GetListOfDataMembers()->MakeIterator());
443 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
499 i->second->putObject(*
this, cls.
getAddress());
501 }
else if (cls.
getClass() != NULL) {
503 if (cls.
getClass()->GetListOfBases() != NULL) {
505 std::unique_ptr<TIterator> i(cls.
getClass()->GetListOfBases()->MakeIterator());
507 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
512 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
514 std::unique_ptr<TIterator> i(cls.
getClass()->GetListOfDataMembers()->MakeIterator());
516 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
541 *
this << white_space;
569 template<
class JElement_t,
class JAllocator_t>
574 for (
typename std::vector<JElement_t, JAllocator_t>::const_iterator i =
object.begin(); i !=
object.end(); ++i) {
631 return writer.
put(key, value);
This file contains the basic interface for ASCII I/O of ROOT objects.
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message.
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation).
const std::string getPrefix(const std::string &prefix, const std::string &name) const
Get combined prefix for output.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
bool isSeparator(const char c) const
Test for separator character.
bool isDivision(const char c) const
Test for division character.
General purpose equation class.
This class can be used to temporarily redirect one output (input) stream to another output (input) st...
This class can be used to temporarily redirect an input stream to an input string.
This class can be used to temporarily exchange the states between streams.
Forward declaration of writer object.
virtual JRootReader & getObject(JRootReader &in, void *address) const
Stream input.
virtual JRootWriter & putObject(JRootWriter &out, const void *address) const
Stream output.
virtual JRootWriter & put(JRootWriter &out, const std::string &prefix, const void *address) const
Stream output.
Implementation for ASCII input of objects with ROOT dictionary.
const JRootDictionary_t & dictionary
JRootReader & getObject(JRootReadableClass &cls)
Read ROOT class.
JRootReader & getObject(const JRootReadableClass &cls)
Read ROOT class.
JRootReader & getObject(T &object, const JBool< false > &option)
Read object.
JRootReader & get(const JRootReadableClass &cls)
Read ROOT class according equation format.
JRootReader & getObject(T &object)
Read object.
JRootReader & getObject(std::vector< JElement_t, JAllocator_t > &object, const JBool< false > &option)
Read object.
JRootReader(std::istream &in, const JEquationParameters ¶meters, const JRootDictionary_t &dictionary)
Constructor.
JRootReader & getObject(T &object, const JBool< true > &option)
Read object.
const JRootDictionary_t & getDictionary() const
Get dictionary.
JRootReader & get(T &object)
Read object according equation format.
Implementation for ASCII output of objects with ROOT dictionary.
JRootWriter & put(const std::string &prefix, const JRootWritableClass &cls, bool eol)
Write ROOT class according equation format.
JRootWriter & putObject(const T &object, const JBool< false > &option)
Write object.
const JRootDictionary_t & getDictionary() const
Get dictictionary.
JRootWriter(std::ostream &out, const JEquationParameters ¶meters, const JRootDictionary_t &dictionary)
Constructor.
virtual JRootWriter & put(const JEquation &equation)
Write equation.
JRootWriter & put(const std::string &key, const T &value)
Write given key and value according equation format.
JRootWriter & putObject(const T &object)
Write object.
JRootWriter & put(JRootWritableClass &cls)
Write ROOT class according equation format.
JRootWriter & putObject(const std::vector< JElement_t, JAllocator_t > &object, const JBool< false > option)
Write object.
JRootWriter & put(const T &object)
Write object according equation format.
JRootWriter & putObject(const T &object, const JBool< true > &option)
Write object.
JRootWriter & putObject(const JRootWritableClass &cls)
Write ROOT class.
JRootWriter & put(const JRootWritableClass &cls)
Write ROOT class according equation format.
const JRootDictionary_t & dictionary
Test availability of stream operators.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Auxiliary classes and methods for ROOT I/O.
Auxiliary template class for type bool.
bool is_valid() const
Check validity of this addressable class.
pointer_type getAddress() const
Get address.
JRootAddressableClass find(const char *const name) const
Find addressable base class or data member with given name within current class.
JRootAddressableClass get(const TDataMember &object) const
Get addressable class of given data member.
const char * getTypename() const
Get type name.
TClass * getClass() const
Get class.
Type definition of ROOT based dictionary for ASCII I/O.
ROOT class for reading into object.
Auxiliary template class to define default implementation of the ROOT streamer.
static JRootWriter & put(JRootWriter &writer, const std::string &key, const T &value)
Write given key and value according equation format.
static JRootReader & getObject(JRootReader &reader, T &object)
Read object.
static JRootWriter & putObject(JRootWriter &writer, const T &object)
Write object.
ROOT class for writing from object.
static bool is_static(const TDataMember &object)
Check if data member is static.