44#include <ginac/ginac.h>
45#include <xercesc/dom/DOM.hpp>
46XERCES_CPP_NAMESPACE_USE
49enum PrepareMode{ PREP_INIT, PREP_VERBOSE, PREP_UPDATE };
50enum Type { MOD_PULSE, MOD_ATOM, MOD_CONCAT, MOD_CONTAINER, MOD_VOID, COIL};
56#define ATTRIBUTE(KEY,VAL) if (mode!=PREP_UPDATE && m_attributes.find(KEY)==m_attributes.end() ) \
57 m_attributes.insert(pair<string,Attribute*>(KEY,new Attribute(KEY,this, true, true,VAL)));
58#define HIDDEN_ATTRIBUTE(KEY,VAL) if (mode!=PREP_UPDATE && m_attributes.find(KEY)==m_attributes.end() ) \
59 m_attributes.insert(pair<string,Attribute*>(KEY,new Attribute(KEY,this,false, true,VAL)));
60#define UNOBSERVABLE_ATTRIBUTE(KEY) if (mode!=PREP_UPDATE && m_attributes.find(KEY)==m_attributes.end() ) \
61 m_attributes.insert(pair<string,Attribute*>(KEY,new Attribute(KEY,this,false,false)));
88 map<string,Attribute*>::iterator iter;
170 static bool ReplaceString (
string& str,
const string& s1,
const string& s2);
185 static vector<string>
Tokenize (
const string& str,
const string& delimiters =
",");
285 bool Observe (
Attribute* attrib,
string prot_name,
string attrib_name,
bool verbose);
286 bool Observe (
Attribute* attrib,
string prot_name,
string attrib_name,
string attrib_keyword,
bool verbose);
294 template <
typename T>
bool Notify (
const T& val) {
296 map<string,Attribute*>::iterator iter;
298 if (iter->second->GetAddress() == ((
void*) &val) )
return iter->second->Notify(val);
309 template <
typename T>
bool NewState (
const T& val) {
311 map<string,Attribute*>::iterator iter;
313 if (iter->second->GetAddress() == ((
void*) &val) )
return iter->second->NewState(val);
Implementation of Attribute.
Implementation of JEMRIS Debug.
mode
Definition Declarations.h:112
Implementation of JEMRIS StrX.
Implementation of JEMRIS TPOI.
Implementation of JEMRIS World.
Attribute class. Attributes are private member variables of a Prototype which are accessible through ...
Definition Attribute.h:62
World parameters provide the parametric data of the sequence.
Definition Parameters.h:37
Prototype super class.
Definition Prototype.h:71
static vector< string > Tokenize(const string &str, const string &delimiters=",")
A global string tokenizer.
Definition Prototype.cpp:92
virtual Prototype * GetPrototypeByAttributeValue(string name, string attrib)
Get a Prototype by value of an attribute.
Definition Prototype.h:263
vector< Attribute * > m_obs_attribs
Vector of observed Attributes.
Definition Prototype.h:336
virtual ~Prototype()
Default destructor.
Definition Prototype.h:87
bool IsPrepared()
Check if the Prototype is prepared.
Definition Prototype.h:131
bool m_prepared
True, after the first call to Prepare.
Definition Prototype.h:330
virtual void Initialize(DOMNode *conf)=0
Initialise this prototype.
string m_name
Name of this Prototype.
Definition Prototype.h:331
bool HasDOMattribute(const string attribute)
Check, if attribute exists in DOM node of this module.
Definition Prototype.h:216
virtual Prototype * GetParent()
Get Parent.
Definition Prototype.h:106
DOMNode * GetNode()
Get the DOMNode of this module.
Definition Prototype.h:153
void SetName(string name)
Set the name of this module.
Definition Prototype.cpp:31
bool HasAttribute(string name)
Check if an attribute exist.
Definition Prototype.h:241
bool m_aux
auxiliary helper variable for debugging purposes
Definition Prototype.h:329
Type GetType()
Get the module type of this module.
Definition Prototype.h:199
void CopyObservers(Attribute *a1, Attribute *a2)
Copy observers from one attribute to another.
Definition Prototype.cpp:120
static bool ReplaceString(string &str, const string &s1, const string &s2)
A global sub-string replacer.
Definition Prototype.cpp:40
vector< double > m_vector
A vector which elements are accessible through loop counters.
Definition Prototype.h:334
Type m_type
The type of the module: one of MOD_PULSE, MOD_ATOM, MOD_CONCAT.
Definition Prototype.h:333
bool Observe(Attribute *attrib, string prot_name, string attrib_name, bool verbose)
Set up the list of observations.
Definition Prototype.cpp:143
vector< string > m_obs_attrib_keyword
Vector of user-defined Attribute names.
Definition Prototype.h:337
string GetDOMattribute(const string attribute)
Get attribute value from the DOMNode.
Definition Prototype.h:208
map< string, Attribute * > m_attributes
Map to connect a keyword with an Attribute.
Definition Prototype.h:335
bool Notify(const T &val)
Notify all observers of an attribute.
Definition Prototype.h:294
void SetNode(DOMNode *node)
Set the DOMNode of this module.
Definition Prototype.h:160
vector< double > * GetVector()
Each Prototype has a double vector as a private member, which values can be filled through XML and ac...
Definition Prototype.h:324
Prototype()
Constructor.
Definition Prototype.h:80
bool NewState(const T &val)
Check the state of an attribute.
Definition Prototype.h:309
Prototype(const Prototype &)
Default copy constructor.
Definition Prototype.h:99
string GetName()
Get the name of this module.
Definition Prototype.h:270
void HideAttribute(string attrib, bool observable=true)
Hide an attribute.
Definition Prototype.cpp:132
static bool ReplaceSymbolString(string &str, const string &s1, const string &s2)
A global sub-string replacer which replaces only complete symbol strings.
Definition Prototype.cpp:60
string GetClassType()
Get the class type of this prototype.
Definition Prototype.h:192
virtual Prototype * Clone() const =0
Clone a prototype.
DOMNode * m_node
The node configuring this Module.
Definition Prototype.h:332
Attribute * GetAttribute(string name)
Get an Attribute.
Definition Prototype.cpp:111
virtual bool Prepare(PrepareMode mode)=0
Prepare this pulse.
Definition Prototype.cpp:182
Simple class for transcoding sax errors to the machines locale.
Definition StrX.h:37
const std::string std_str() const
Transcode to string.
Definition StrX.cpp:77