9 #ifndef ThePEG_ClassDescription_H 10 #define ThePEG_ClassDescription_H 12 #include "ThePEG/Config/ThePEG.h" 13 #include "ClassDescription.fh" 14 #include "ThePEG/Utilities/Named.h" 15 #include "ThePEG/Persistency/PersistentOStream.fh" 16 #include "ThePEG/Persistency/PersistentIStream.fh" 17 #include "ClassTraits.h" 18 #include "DescriptionList.h" 82 const type_info & newInfo,
126 virtual void setup() = 0;
170 DescriptionVector::iterator last)
214 template <
typename T,
int IBase,
218 static void addBases(vector<const ClassDescriptionBase *> & c){
232 template <
typename T,
int IBase>
235 static void addBases(vector<const ClassDescriptionBase *> & ) {}
244 template <
typename T>
287 template <
typename T>
307 throw std::logic_error(
"Tried to instantiate virtual class " +
Named::name());
317 Traits::output(Traits::cast(b), os);
328 int oldVersion)
const {
329 Traits::input(Traits::cast(b), is, oldVersion);
338 template <
typename T>
365 Traits::output(Traits::cast(b), os);
376 int oldVersion)
const {
377 Traits::input(Traits::cast(b), is, oldVersion);
386 template <
typename T>
422 template <
typename T>
442 throw std::logic_error(
"Tried to instantiate virtual class " +
Named::name());
459 #define ThePEG_DECLARE_CLASS_DESCRIPTION(Class) \ 461 static ClassDescription<Class> init ## Class \ 463 #define ThePEG_DECLARE_ABSTRACT_CLASS_DESCRIPTION(Class) \ 465 static AbstractClassDescription<Class> init ## Class \ 467 #define ThePEG_DECLARE_NOPIO_CLASS_DESCRIPTION(Class) \ 469 static NoPIOClassDescription<Class> init ## Class \ 471 #define ThePEG_DECLARE_ABSTRACT_NOPIO_CLASS_DESCRIPTION(Class) \ 473 static AbstractNoPIOClassDescription<Class> init ## Class \ 475 #define ThePEG_IMPLEMENT_CLASS_DESCRIPTION(Class) \ 476 ClassDescription<Class> Class::init ## Class \ 478 #define ThePEG_IMPLEMENT_ABSTRACT_CLASS_DESCRIPTION(Class) \ 479 AbstractClassDescription<Class> Class::init ## Class \ 481 #define ThePEG_IMPLEMENT_NOPIO_CLASS_DESCRIPTION(Class) \ 482 NoPIOClassDescription<Class> Class::init ## Class \ 484 #define ThePEG_IMPLEMENT_ABSTRACT_NOPIO_CLASS_DESCRIPTION(Class) \ 485 AbstractNoPIOClassDescription<Class> Class::init ## Class \ NoPIOClassDescription()
Default constructor.
virtual BPtr create() const
Do not create an object of the described class (which is abstract).
PersistentIStream is used to read persistent objects from a stream where they were previously written...
ClassTraits< T > Traits
The traits class for the template argument class.
virtual BPtr create() const =0
Create an object of the described class.
virtual void output(tcBPtr, PersistentOStream &) const
Do nothing since the described class has no persistent data.
ClassDescriptionBase is the base class for all class description classes.
virtual BPtr create() const
Create an object of the described class.
static const ClassDescriptionBase * find(const type_info &ti)
Get the description of a class giving its type_info object.
A concreate implementation of ClassDescriptionBase describing a concrete class with persistent data...
static void Register(ClassDescriptionBase &)
Insert a description in the list.
const type_info & theInfo
The type_info object for the described class.
PersistentOStream is used to write objects persistently to a stream from which they can be read in ag...
A concreate implementation of ClassDescriptionBase describing an abstract class with persistent data...
ClassDescription()
Default constructor.
TransientConstRCPtr is a simple wrapper around a bare const pointer which can be assigned to and from...
virtual void input(tBPtr b, PersistentIStream &is, int oldVersion) const
Read the members of an object of the described class from a persistent stream.
TransientRCPtr is a simple wrapper around a bare pointer which can be assigned to and from an RCPtr a...
static void addBases(vector< const ClassDescriptionBase *> &c)
Add base classes.
virtual BPtr create() const
Do not create an object of the described class (which is abstract).
An intermediate templated base class derived from ClassDescriptionBase.
void baseClasses(DescriptionVector::iterator first, DescriptionVector::iterator last)
Set the base classes.
This is the main namespace within which all identifiers in ThePEG are declared.
The Named class is a simple concrete base class to used by classes of objects with a name...
ClassTraits< T > Traits
The traits class for the template argument class.
ClassDescriptionTBase(bool abst)
Default constructor.
DescriptionVector theBaseClasses
The vector of base classes.
A concreate implementation of ClassDescriptionBase describing a concrete class without persistent dat...
virtual void setup()
Set up the base class information for this object.
int theVersion
The version of the described class.
virtual void setup()=0
Set up the base class information for this object.
string theLibrary
The library file where this class may be found.
ClassTraits< T > Traits
The traits class for the template argument class.
const type_info & info() const
The standart RTTI type_info object for the described class.
ClassTraits< T > Traits
The traits class for the template argument class.
virtual BPtr create() const
Create an object of the described class.
A concreate implementation of ClassDescriptionBase describing an abstract class without persistent da...
ClassDescriptionBase(string newName, const type_info &newInfo, int newVersion, string newLibrary, bool abst)
The constructor used by sub-classes.
bool isAbstract
True if this class is abstract.
virtual void input(tBPtr b, PersistentIStream &is, int oldVersion) const
Read the members of an object of the described class from a persistent stream.
AbstractNoPIOClassDescription()
Default constructor.
int version() const
The version of the described class.
AbstractClassDescription()
Default constructor.
RCPtr is a reference counted (smart) pointer.
const string & name() const
Return name.
bool isA(const ClassDescriptionBase &base) const
Return true if the class described by the argument is a base class of the class described by this...
virtual void input(tBPtr, PersistentIStream &, int) const
Do nothing since the described class has no persistent data.
virtual void output(tcBPtr b, PersistentOStream &os) const
Output the members of an object of the described class to a persistent stream.
string library() const
The name of a file containing the dynamic library where the class is implemented. ...
virtual void output(tcBPtr b, PersistentOStream &os) const
Output the members of an object of the described class to a persistent stream.
virtual void output(tcBPtr b, PersistentOStream &os) const =0
Output the members of an object of the described class to a persistent stream.
The default concrete implementation of ClassTraitsBase.
vector< const ClassDescriptionBase * > DescriptionVector
A vector of class descriptions.
int NthBase
The type of the BaseN'th base class (int means there are no further base classes).
virtual ~ClassDescriptionTBase()
The descructor.
const DescriptionVector & descriptions() const
Return the descriptions of the base classes of the described class.
bool check() const
Return true if this object was set up properly.
bool done
True if this object was set up properly.
virtual void input(tBPtr, PersistentIStream &, int) const
Do nothing since the described class has no persistent data.
virtual void input(tBPtr b, PersistentIStream &is, int oldVersion) const =0
Read the members of an object of the described class from a persistent stream.
A helper class for tracing the base classes of a class to be described.
virtual void output(tcBPtr, PersistentOStream &) const
Do nothing since the described class has no persistent data.
ClassTraits< T > Traits
The traits class for the template argument class.
virtual ~ClassDescriptionBase()
Empty destructor.