Go to the documentation of this file. 1 #ifndef __JROOT__JROOTSTREAMER__
2 #define __JROOT__JROOTSTREAMER__
27 namespace JPP {
using namespace JROOT; }
99 std::istream(in.rdbuf()),
170 using namespace JLANG;
174 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
176 for (
JEquation equation; *
this >> equation; ) {
186 if (facet.
isDivision (equation.getSeparator()))
188 else if (facet.
isSeparator(equation.getSeparator()))
193 okay &= (!this->
fail() || this->eof());
197 throw JException(
"Error parsing: " + equation.toString());
220 i->second->getObject(*
this, cls.
getAddress());
222 }
else if (cls.
getClass() != NULL) {
224 if (cls.
getClass()->GetListOfBases() != NULL) {
226 TIterator* i = cls.
getClass()->GetListOfBases()->MakeIterator();
228 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL && (
bool) (*this); ) {
233 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
235 TIterator* i = cls.
getClass()->GetListOfDataMembers()->MakeIterator();
237 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL && (
bool) (*this); ) {
256 return getObject(const_cast<const JRootReadableClass&>(cls));
298 template<
class JElement_t,
class JAllocator_t>
305 for (JElement_t element;
n != 0 && this->
getObject(element); --
n) {
306 object.push_back(element);
367 return writer.
put(key, value);
393 std::ostream(out.rdbuf()),
401 precision(out.precision());
469 return this->put(
"", cls,
false);
481 return this->put(const_cast<const JRootWritableClass&>(cls));
509 using namespace JLANG;
513 const JEquationFacet& facet = use_facet<JEquationFacet>(this->getloc());
519 i->second->put(*
this, prefix, cls.
getAddress());
530 }
else if (cls.
getClass() != NULL) {
532 if (cls.
getClass()->GetListOfBases() != NULL) {
534 TIterator* i = cls.
getClass()->GetListOfBases()->MakeIterator();
536 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
537 this->put(prefix, cls.
get(*p),
false);
541 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
543 TIterator* i = cls.
getClass()->GetListOfDataMembers()->MakeIterator();
545 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
547 this->put(facet.
getPrefix(prefix,p->GetName()), cls.
get(*p),
false);
574 i->second->putObject(*
this, cls.
getAddress());
576 }
else if (cls.
getClass() != NULL) {
578 if (cls.
getClass()->GetListOfBases() != NULL) {
580 TIterator* i = cls.
getClass()->GetListOfBases()->MakeIterator();
582 for (
const TBaseClass* p; (p = (
const TBaseClass*) i->Next()) != NULL; ) {
587 if (cls.
getClass()->GetListOfDataMembers() != NULL) {
589 TIterator* i = cls.
getClass()->GetListOfDataMembers()->MakeIterator();
591 for (
const TDataMember* p; (p = (
const TDataMember*) i->Next()) != NULL; ) {
629 using namespace JLANG;
652 using namespace JLANG;
673 template<
class JElement_t,
class JAllocator_t>
694 using namespace JLANG;
724 template<
class JElement_t,
class JAllocator_t>
JRootReader & getObject(T &object, const JBool< false > &option)
Read object.
const JRootDictionary_t & dictionary
JRootWriter & put(const JRootWritableClass &cls)
Write object according equation format.
JRootWriter & putObject(const std::vector< JElement_t, JAllocator_t > &object, const JBool< false > option)
Write object.
bool is_valid() const
Check validity of this addressable class.
JRootReader & get(T &object)
Read object according equation format.
JRootWriter & put(const std::string &key, const T &value, const JBool< false > option)
Write given key and value according equation format.
JRootWriter & putObject(const T &object, const JBool< true > &option)
Write object.
Auxiliary classes and methods for ROOT I/O.
This class can be used to temporarily exchange the states between streams.
const JRootDictionary_t & getDictionary() const
Get dictictionary.
pointer_type getAddress() const
Get address.
ROOT class for writing object.
TClass * getClass() const
Get class.
static const JLANG::JEndOfLine end_of_line
Print end of line.
bool isSeparator(const char c) const
Test for separator character.
bool isDivision(const char c) const
Test for division character.
JRootWriter(std::ostream &out, const JEquationParameters ¶meters, const JRootDictionary_t &dictionary)
Constructor.
static JRootReader & getObject(JRootReader &reader, T &object)
Read object.
JRootReader & getObject(std::vector< JElement_t, JAllocator_t > &object, const JBool< false > &option)
Read object.
Default helper class for formatting.
static bool is_static(const TDataMember &data_member)
Check if data member is static.
const JRootDictionary_t & dictionary
JRootWriter & putObject(const T &object, const JBool< false > &option)
Write object.
virtual JRootWriter & putObject(JRootWriter &out, const void *address) const
Stream output.
std::ostream & white_space(std::ostream &out)
Print white space.
bool putObject(TDirectory *dir, const T &object)
Write object to ROOT directory.
Implementation for ASCII output of objects with ROOT dictionary.
JRootWriter & put(const std::string &prefix, const JRootWritableClass &cls, bool eol)
ROOT class output.
JRootWriter & put(JRootWritableClass &cls)
Write object according equation format.
Forward declaration of writer object.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
static JRootReader & getObject(JRootReader &reader, T &object)
Read object.
JRootAddressableClass get(const TDataMember &data_member) const
Get addressable class of given data member.
JRootReader(std::istream &in, const JEquationParameters ¶meters, const JRootDictionary_t &dictionary)
Constructor.
Helper class for user formatting.
static JRootWriter & putObject(JRootWriter &writer, const T &object)
Write object.
virtual JRootReader & getObject(JRootReader &in, void *address) const
Stream input.
General purpose equation class.
JRootReader & getObject(JRootReadableClass &cls)
Read ROOT class according equation format.
This class can be used to temporarily redirect an input stream to an input string.
Facet class to specify parsing of equations in currect locale (see class JLANG::JEquation).
JRootWriter & putObject(const T &object)
Write object.
JRootWriter & put(const T &object)
Write object according equation format.
Test availability of stream operators.
JRootWriter & put(const std::string &key, const T &value, const JBool< true > option)
Write given key and value according equation format.
JRootReader & getObject(T &object)
Read object.
JRootReader & get(const JRootReadableClass &cls)
Read ROOT class according equation format.
JRootReader & getObject(T &object, const JBool< true > &option)
Read object.
Default helper class for formatting.
Type definition of ROOT based dictionary for ASCII O.
const JRootDictionary_t & getDictionary() const
Get dictionary.
Auxiliary template class for type bool.
Simple data structure to support I/O of equations (see class JLANG::JEquation).
virtual JRootWriter & put(JRootWriter &out, const std::string &prefix, const void *address) const
Stream output.
Helper class for user formatting.
Implementation for ASCII input of objects with ROOT dictionary.
bool fail(std::istream &in)
Check for stream state.
const char * getTypename() const
Get type name.
std::ostream & separator(std::ostream &out)
Print separator.
JRootWriter & put(const std::string &key, const T &value)
Write given key and value according equation format.
JRootReader & getObject(const JRootReadableClass &cls)
Read ROOT class.
JRootWriter & putObject(const JRootWritableClass &cls)
ROOT class output.
JRootWriter & put(const std::string &key, const std::vector< JElement_t, JAllocator_t > &value, const JBool< false > option)
Write given key and value according equation format.
ROOT class for reading object.
static JRootWriter & put(JRootWriter &writer, const std::string &key, const T &value)
Write given key and value according equation format.
Auxiliary classes and methods for language specific functionality.
static JRootWriter & put(JRootWriter &writer, const std::string &key, const T &value)
Write given key and value according equation format.
static JRootWriter & putObject(JRootWriter &writer, const T &object)
Write object.
const std::string getPrefix(const std::string &prefix, const std::string &name) const
Get combined prefix for output.
JRootAddressableClass find(const char *name) const
Find addressable base class or data member with given name within current class.