9 #ifndef ThePEG_PersistentIStream_H
10 #define ThePEG_PersistentIStream_H
13 #include "ThePEG/Config/ThePEG.h"
14 #include "InputDescription.h"
15 #include "PersistentIStream.fh"
16 #include "ThePEG/Utilities/Exception.h"
109 template <
typename T>
122 template <
typename T>
135 template <
typename T>
255 typename Container::value_type val;
258 while ( size-- &&
good() ) {
260 c.insert(c.end(), val);
325 operator bool()
const {
return good(); }
345 struct MissingClass:
public Exception {};
349 struct MissingObject:
public Exception {};
353 struct ReadFailure:
public Exception {};
364 char get() {
return is().get(); }
395 is().ignore(INT_MAX,
tSep);
417 void endBase(
string classname);
522 static const char tNo =
'n';
549 PersistentIManip func) {
575 template <
typename T1,
typename T2>
577 return is >> p.first >> p.second;
581 template <
typename Key,
typename T,
typename Cmp,
typename A>
587 while ( size-- && is ) {
595 template <
typename Key,
typename T,
typename Cmp,
typename A>
597 multimap<Key,T,Cmp,A> & m) {
603 while ( size-- && is ) {
606 m.insert(make_pair(k, t));
613 template <
typename Key,
typename Cmp,
typename A>
615 set<Key,Cmp,A> & s) {
621 template <
typename Key,
typename Cmp,
typename A>
623 multiset<Key,Cmp,A> & s) {
630 template <
typename T,
typename A>
639 template <
typename T,
typename A>
648 template <
typename T,
typename A>
bool operator!() const
Check the state of the stream.
PersistentIStream is used to read persistent objects from a stream where they were previously written...
static const char tNext
The marker character indicating the beginning of the next base class in case of multiple inheritance...
InputDescription::DescriptionVector DescriptionVector
A vector of bare pointers to InputDescription objects.
BPtr getObject()
Read in an object.
Define the base class from which all (polymorphic) classes in ThePEG are derived. ...
int subVersion
Subversion number of the PersistentOStream which has written the file being read. ...
void setBadState()
Set the stream in a bad state.
void skipField()
Scan the stream for the next field separator.
PersistentIStream & setPedantic()
Set pedantic mode.
PersistentIStream & operator>>(TransientConstRCPtr< T > &ptr)
Operator for extracting persistent objects from the stream.
bool good() const
Check the state of the stream.
std::complex< double > Complex
ThePEG code should use Complex for all complex scalars.
static const char tNull
The special marker character indicating an escaped marker character.
ObjectVector readObjects
Lists of objects that have been read.
PersistentIStream & operator>>(ConstRCPtr< T > &ptr)
Operator for extracting persistent objects from the stream.
PersistentIStream & operator>>(long &i)
Read a long integer.
PersistentIStream & pedantic(PersistentIStream &is)
The manipulator for setting pedantic mode.
PersistentIStream & operator>>(short &i)
Read a short integer.
static const char tEnd
The special marker character indicating the end of an object.
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
static const char tNoSep
The special marker character used to avoid confusion with escaped tSep markers.
PersistentIStream & operator>>(RCPtr< T > &ptr)
Operator for extracting persistent objects from the stream.
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
void getObjectPart(tBPtr obj, const InputDescription *pid)
For a given object, read the member variables corresponding to a given InputDescription object...
ConstRCPtr is a reference counted (smart) const pointer.
const vector< string > & globalLibraries() const
The global libraries loaded on initialization.
T1 dynamic_ptr_cast(const T2 &t2)
Replacement for the standard dynamic_cast.
static const char tSep
The special marker character indicating the end of a value.
This is the main namespace within which all identifiers in ThePEG are declared.
PersistentIStream & operator>>(int &i)
Read an integer.
void getContainer(Container &c)
Intput of containers streamable objects.
bool pedantic() const
Check the tolerance.
const InputDescription * getClass()
Read a class description from the underlying stream and return a corresponding InputDescription objec...
istream * theIStream
A pointer to the associated istream.
bool badState
False if no errors has occurred.
bool beginObject()
Check if the next char to be read is a tBegin marker.
~PersistentIStream()
The destructor.
void init()
Internal initialization.
PersistentIStream()
Standard ctors and assignment are private and not implemented.
static const char tBegin
The special marker character indicating the beginning of an object.
vector< BPtr > ObjectVector
A vector of pointers to persistent objects.
bool isPedantic
Pedantic or tolerant.
bool allocStream
True if the associated istream should be deleted when the PersistentIStream is destroyed.
vector< T > & operator>>(vector< T > &tv, U &u)
Overload the right shift operator for vector to pop objects from a vector.
RCPtr is a reference counted (smart) pointer.
#define ThePEG_DECLARE_POINTERS(full, abbrev)
This macro helps us to declare pointers and stuff to standard classes.
PersistentIStream & operator>>(unsigned short &i)
Read an unsigned short integer.
vector< string > theGlobalLibraries
Global libraries loaded in the initialization.
void endBase(string classname)
Scan stream for "end base class" marker.
PersistentIStream & tolerant(PersistentIStream &is)
The manipulator for setting tolerant mode.
void getSep()
Read a field separator from the stream.
Exception is the base class for all exceptions to be used in ThePEG.
DescriptionVector readClasses
Lists of classes and corresponding version strings that have been read.
PersistentIStream & operator>>(double &d)
Read a double.
istream & is()
Return a reference to the associated stream.
static const char tYes
The special marker character indicating a true boolean value.
char escaped()
Get the next character from the associated istream and decode it if it is escaped.
const istream & is() const
Return a const reference to the associated stream.
void endObject()
Scan the stream to the end of the current object.
PersistentIStream & operator=(const PersistentIStream &)
Standard ctors and assignment are private and not implemented.
PersistentIStream & setTolerant()
Set tolerant mode.
PersistentIStream & operator>>(unsigned int &i)
Read an unsigned integer.
int version
Version number of the PersistentOStream which has written the file being read.
PersistentIStream & operator>>(TransientRCPtr< T > &ptr)
Operator for extracting persistent objects from the stream.
bool keepId
If keepId is true, the order in which the original objects were created will be kept.
static const char tNo
The special marker character indicating a false boolean value.
PersistentIStream & operator>>(float &f)
Read a float.
PersistentIStream(istream &is, bool keepid=false)
Constuctor giving an input stream to be used as an underlying istream.
PersistentIStream & operator>>(unsigned long &i)
Read an unsigned long integer.