#include <BaseRepository.h>
Information on where to read input files. | |
static void | prependReadDir (string) |
Add a directory to readDirs(). | |
static void | appendReadDir (string) |
Add a directory to readDirs(). | |
static stack< string > & | currentReadDirStack () |
The stack of directories used by the "read" command. | |
static vector< string > & | readDirs () |
List of directories to search for files for the "read" command. | |
Public Types | |
typedef StringSet | DirectorySet |
A set of strings. | |
typedef vector< string > | StringVector |
A vector of character strings. | |
typedef set< const InterfaceBase * > | InterfaceSet |
A set of pointers to InterfaceBase objects. | |
typedef map< const ClassDescriptionBase *, InterfaceSet > | TypeInterfaceMap |
A map of sets of IterfaceBase objects indexed by pointers to ClassDescriptionBase objects. | |
typedef map< const ClassDescriptionBase *, const ClassDocumentationBase * > | TypeDocumentationMap |
A map of ClassDocumentationBase objects indexed by pointers to ClassDescriptionBase objects. | |
Static Public Member Functions | |
static string | exec (string cmd, ostream &) |
Interpret the command in cmd and return possible messages. | |
Functions for adding and deleting objects and interfaces. | |
static void | Register (const InterfaceBase &, const type_info &) |
Register an interface. | |
static void | Register (const ClassDocumentationBase &, const type_info &) |
Register a class documentation. | |
static void | Register (IBPtr) |
Register a new object using the its current name. | |
static void | Register (IBPtr, string name) |
Register a new object giving it a new name. | |
static void | remove (tIBPtr) |
Remove the given object from the repository. | |
static string | remove (const ObjectSet &rmset) |
Remove objects. | |
static void | rename (tIBPtr object, string newName) |
Rename a given object. | |
Access the directory stack. | |
static void | CreateDirectory (string) |
Create a new directory with the given name. | |
static void | CheckObjectDirectory (string) |
Check if directory exixts. | |
static void | CheckDirectory (string) |
Check if directory exixts. | |
static void | DirectoryAppend (string &) |
Return the absolute path. | |
static void | ChangeDirectory (string name) |
Set the current directory to name. | |
static void | PushDirectory (string name) |
Set the current directory to name. | |
static void | PopDirectory () |
Pop the directory stack. | |
static vector< string > & | globalLibraries () |
A list of all globally loaded libraries. | |
Access objects in the repository. | |
template<typename T> | |
static Ptr< T >::pointer | GetPtr (const T &) |
Return a reference counted pointer to the given object. | |
template<typename PtrType> | |
static PtrType | GetPtr (string) |
Return a pointer of the specified type to an object with the given name. | |
template<typename PtrType> | |
static PtrType | GetObject (string) |
Return a pointer of the specified type to an object with the given name. | |
static IBPtr | GetPointer (string) |
Return a pointer to an object with the given name or null if no such object exists. | |
static IVector | SearchDirectory (string name, string className="") |
Return all objects in the directory name. | |
static IBPtr | TraceObject (string name) |
Find an object. | |
static string | GetInterfacedBaseClasses (const ClassDescriptionBase *cdb) |
Return a string containing the name of the given class description and its base classes, one on each line. | |
static IBPtr | getObjectFromNoun (string noun) |
Get an object. | |
Access references between object in the repository. | |
static IVector | GetObjectsReferringTo (IBPtr) |
Get referring objects. | |
static IVector | DirectReferences (IBPtr) |
Get direct references. | |
static void | addReferences (tIBPtr obj, ObjectSet &refs) |
Get all references. | |
Access the interfaces of the objects in the repository. | |
static InterfaceMap | getInterfaces (const type_info &ti, bool all=true) |
Get interfaces. | |
static const InterfaceBase * | FindInterface (IBPtr object, string name) |
Return an interface with the given name to the given object. | |
static string | getInterfaceFromNoun (string noun) |
Get an interface name. | |
static string | getPosArgFromNoun (string noun) |
Get interface index. | |
Manipulate objects in the repository. | |
static void | update () |
Call the InterfacedBase::update() function of all objects. | |
template<typename Cont> | |
static void | clearAll (const Cont &c) |
Clear the InterfacedBase::touched() flag in all objects in the given container. | |
template<typename Cont> | |
static void | resetAll (const Cont &c) |
Set the status of all objects in the given container to InterfacedBase::uninitialized. | |
static void | readSetup (tIBPtr ip, istream &is) |
Setup an object. | |
static void | lock (tIBPtr ip) |
Lock the given object. | |
static void | unlock (tIBPtr ip) |
Unlock the given object. | |
Access the documentation of objects. | |
static const ClassDocumentationBase * | getDocumentation (tcIBPtr ip) |
Return the class documentation of a given object. | |
static string | getModelDescription (tcIBPtr ip) |
Get the description for the model implemented in the class of the given object. | |
static string | getModelReferences (tcIBPtr ip) |
Get the references for the model implemented in the class of the given object. | |
Manipulate the output streams of the repository. | |
static void | cout (ostream &os) |
Set the standard output stream. | |
static ostream & | cout () |
Get the standard output stream. | |
static void | cerr (ostream &os) |
Set the standard error stream. | |
static ostream & | cerr () |
Get the standard error stream. | |
static void | clog (ostream &os) |
Set the standard log stream. | |
static ostream & | clog () |
Get the standard log stream. | |
Static Protected Member Functions | |
static void | addInterfaces (const ClassDescriptionBase &, InterfaceMap &, bool all=true) |
Add interfaces to the given map for the class with the given class description. | |
Access standard InterfacedBase functions. | |
template<typename T> | |
static Ptr< T >::pointer | clone (const T &t) |
Return a clone of the given object. | |
template<typename T> | |
static Ptr< T >::pointer | fullclone (const T &t) |
Return a clone of the given object. | |
static void | rebind (InterfacedBase &obj, const TranslationMap &trans, const IVector &defaults) |
Rebind references. | |
Functions containing the static instances of objects used | |
by the repository. | |
static ObjectMap & | objects () |
All InterfacedBase objects mapped to their name. | |
static ObjectSet & | allObjects () |
All InterfacedBase objects. | |
static TypeInterfaceMap & | interfaces () |
Sets of InterfaceBase objects mapped to the class description of the class for which they are defined. | |
static TypeDocumentationMap & | documentations () |
Sets of ClassDocumentationBase objects mapped to the class description of the class for which they are defined. | |
static DirectorySet & | directories () |
All defined directories. | |
static StringVector & | directoryStack () |
The current directory stack. | |
static bool & | updating () |
Flag to say if we are in the middle of an update procedure. | |
static ostream *& | coutp () |
The current current standard output stream. | |
static ostream *& | cerrp () |
The current current standard error stream. | |
static ostream *& | clogp () |
The current current standard log stream. |
The objects and their names are divided up in a tree-like structure inspired by the Unix file system.
The InterfacedBase objects may be manipulated using InterfaceBase objects. This may be done directly or via a simple command interface using the exec() method.
RepositoryBase is closely related to the Repository sub-class. The division may seem unnecessary, but the idea is that BaseRepository is a general repository for administrating and manipulating a set of InterfacedBase objects, while the Repository adds on utilites which are special to ThePEG where the objects are Interfaced (a sub-class of InterfacedBase).
Definition at line 45 of file BaseRepository.h.
typedef StringSet ThePEG::BaseRepository::DirectorySet |
typedef vector<string> ThePEG::BaseRepository::StringVector |
typedef set<const InterfaceBase *> ThePEG::BaseRepository::InterfaceSet |
typedef map<const ClassDescriptionBase *, InterfaceSet> ThePEG::BaseRepository::TypeInterfaceMap |
A map of sets of IterfaceBase objects indexed by pointers to ClassDescriptionBase objects.
Definition at line 60 of file BaseRepository.h.
typedef map<const ClassDescriptionBase *, const ClassDocumentationBase *> ThePEG::BaseRepository::TypeDocumentationMap |
A map of ClassDocumentationBase objects indexed by pointers to ClassDescriptionBase objects.
Definition at line 65 of file BaseRepository.h.
static string ThePEG::BaseRepository::exec | ( | string | cmd, | |
ostream & | ||||
) | [static] |
Interpret the command in cmd and return possible messages.
This is the main function for the command-line interface. The syntax is described elsewhere. The ostream argument is currently unused.
Reimplemented in ThePEG::Repository.
static void ThePEG::BaseRepository::Register | ( | const InterfaceBase & | , | |
const type_info & | ||||
) | [static] |
Register an interface.
This is called automatically in the InterfaceBase constructor and should never be called explicitly.
static void ThePEG::BaseRepository::Register | ( | const ClassDocumentationBase & | , | |
const type_info & | ||||
) | [static] |
Register a class documentation.
This is called automatically in the ClassDocumentationBase constructor and should never be called explicitly.
static void ThePEG::BaseRepository::Register | ( | IBPtr | ) | [static] |
Register a new object using the its current name.
If the object is already in the repository, nothing happens. If another object already exists with the same name, the new object will have #
's appended to its name to make it unique.
Reimplemented in ThePEG::Repository.
static void ThePEG::BaseRepository::Register | ( | IBPtr | , | |
string | name | |||
) | [static] |
Register a new object giving it a new name.
If the object is already in the repository, nothing happens. If another object already exists with the same name, the new object will have #
's appended to its name to make it unique.
Reimplemented in ThePEG::Repository.
static void ThePEG::BaseRepository::remove | ( | tIBPtr | ) | [static] |
Remove the given object from the repository.
If the object was not present nothing will happen.
Reimplemented in ThePEG::Repository.
static string ThePEG::BaseRepository::remove | ( | const ObjectSet & | rmset | ) | [static] |
Remove objects.
Remove the objects in rmset if there are no other objects in the repository referring to them, otherwise return an error message and the names of the objects refering to them separated by new-line characters.
Reimplemented in ThePEG::Repository.
static void ThePEG::BaseRepository::rename | ( | tIBPtr | object, | |
string | newName | |||
) | [static] |
Rename a given object.
Syntacticly the same as remove(object); Register(object, newName);
.
static void ThePEG::BaseRepository::CreateDirectory | ( | string | ) | [static] |
Create a new directory with the given name.
If the given name starts with a /
the name is assumed to be an absolute path, otherwise it is assumed to be a path relative to the current directory.
static void ThePEG::BaseRepository::CheckObjectDirectory | ( | string | ) | [static] |
Check if directory exixts.
Check if the name given as argument corresponds to an existing directory. If the argument string does not end in a /
it is assumed to be the name of an object in a directory, and only the directory part of the name is checked. If the given name starts with a /
the name is assumed to be an absolute path, otherwise it is assumed to be a path relative to the current directory.
RepositoryNoDirectory | if the correspinding directory is non-existent. |
static void ThePEG::BaseRepository::CheckDirectory | ( | string | ) | [static] |
Check if directory exixts.
Check if the name given as argument corresponds to an existing directory. If the given name starts with a /
the name is assumed to be an absolute path, otherwise it is assumed to be a path relative to the current directory.
RepositoryNoDirectory | if the correspinding directory is non-existent. |
static void ThePEG::BaseRepository::DirectoryAppend | ( | string & | ) | [static] |
Return the absolute path.
If the given name starts with a /
the name is assumed to be an absolute path already, otherwise it is assumed to be a path relative to the current directory, and the absolute path is constructed.
static void ThePEG::BaseRepository::ChangeDirectory | ( | string | name | ) | [static] |
Set the current directory to name.
name can be aither a relative or absolute path. The new directory replaces the previous current directory on the directory stack.
RepositoryNoDirectory | if the directory is non-existent. |
static void ThePEG::BaseRepository::PushDirectory | ( | string | name | ) | [static] |
Set the current directory to name.
name can be aither a relative or absolute path. The new directory is pushed onto the directory stack.
RepositoryNoDirectory | if the directory is non-existent. |
static void ThePEG::BaseRepository::PopDirectory | ( | ) | [static] |
Pop the directory stack.
Leave the current directory and set the directory which is on top of the popped directory stack.
static Ptr<T>::pointer ThePEG::BaseRepository::GetPtr | ( | const T & | ) | [inline, static] |
Return a reference counted pointer to the given object.
This currently not needed when ThePEG is used with the ThePEG::Pointer::RCPtr class of pointers.
static PtrType ThePEG::BaseRepository::GetPtr | ( | string | ) | [inline, static] |
Return a pointer of the specified type to an object with the given name.
If such an object does not exist, GetPtr will return a null pointer.
static PtrType ThePEG::BaseRepository::GetObject | ( | string | ) | [inline, static] |
Return a pointer of the specified type to an object with the given name.
If such an object does not exist an exception will be thrown.
RepositoryNotFound | if the object was not found. | |
RepositoryClassMisMatch | if the object exists but is of the wrong class. |
static IVector ThePEG::BaseRepository::SearchDirectory | ( | string | name, | |
string | className = "" | |||
) | [static] |
Return all objects in the directory name.
Optionally only return objects of class className or of a sub-class thereof.
static IBPtr ThePEG::BaseRepository::TraceObject | ( | string | name | ) | [static] |
Find an object.
If the name does not begin with '/', the current directory is prepended. If the string is on the form object:interface
(or object:interface[i]
) and interface
corresponds to an Reference (or RefVector) interface, the corresponding referenced object is returned. (also object:interface:interface
is allowed etc.)
static IBPtr ThePEG::BaseRepository::getObjectFromNoun | ( | string | noun | ) | [static] |
Get an object.
Decompose a string of the form object:interface
or object:vector-interface[pos]
. Retrun a pointer to the corresponding object
.
static void ThePEG::BaseRepository::addReferences | ( | tIBPtr | obj, | |
ObjectSet & | refs | |||
) | [static] |
static InterfaceMap ThePEG::BaseRepository::getInterfaces | ( | const type_info & | ti, | |
bool | all = true | |||
) | [static] |
Get interfaces.
Return the interfaces defined for the InterfacedBase class with the given type_info, ti, mapped to their name. If several interfaces with the same name exists only the one which correspond to the most derived class will be given, except if all is true in which case all interfaces are given (prefixed by '+'s to become unique).
static string ThePEG::BaseRepository::getInterfaceFromNoun | ( | string | noun | ) | [static] |
Get an interface name.
Decompose a string of the form object:interface
or object:vector-interface[pos]
. Return the interface name (without the [pos]
).
static string ThePEG::BaseRepository::getPosArgFromNoun | ( | string | noun | ) | [static] |
Get interface index.
Decompose a string of the form object:interface
or object:vector-interface[pos]
. Return the pos
part or empty string if not present.
static void ThePEG::BaseRepository::readSetup | ( | tIBPtr | ip, | |
istream & | is | |||
) | [static] |
Setup an object.
Execute the InterfacedBase::readSetup() method of ip with the stream is as argument.
static void ThePEG::BaseRepository::lock | ( | tIBPtr | ip | ) | [inline, static] |
Lock the given object.
Locked objects cannot be changed through an interface.
Definition at line 393 of file BaseRepository.h.
static void ThePEG::BaseRepository::unlock | ( | tIBPtr | ip | ) | [inline, static] |
Unlock the given object.
Locked objects cannot be changed through an interface.
Definition at line 399 of file BaseRepository.h.
static Ptr<T>::pointer ThePEG::BaseRepository::clone | ( | const T & | t | ) | [inline, static, protected] |
Return a clone of the given object.
Calls the InterfacedBase::clone() function of t and casts the resulting pointer to the correct type.
static Ptr<T>::pointer ThePEG::BaseRepository::fullclone | ( | const T & | t | ) | [inline, static, protected] |
Return a clone of the given object.
Calls the InterfacedBase::fullclone() function of t and casts the resulting pointer to the correct type.
static void ThePEG::BaseRepository::rebind | ( | InterfacedBase & | obj, | |
const TranslationMap & | trans, | |||
const IVector & | defaults | |||
) | [static, protected] |
Rebind references.
For all objects directly referenced by obj, replace them with the translation found in trans. If obj has a Reference or a member of a RefVector interface which is null, and the corresponding interface has the RefInterfaceBase::defaultIfNull() flag set, translate the null pointer to the first acceptable object in defaults.
static void ThePEG::BaseRepository::addInterfaces | ( | const ClassDescriptionBase & | , | |
InterfaceMap & | , | |||
bool | all = true | |||
) | [static, protected] |
Add interfaces to the given map for the class with the given class description.
Recursively do the same with the base classes.