1 #ifndef GPM_GraphElement_H
2 #define GPM_GraphElement_H
22 static const tFlag REMOVE;
23 static const tFlag KEEP;
26 static const tFlag UNSET;
27 static const tFlag SET;
28 static const tFlag ADD;
29 static const tFlag VALID;
39 map<tString,SV::GPM_Variable> mVariables;
42 map<tString,SV::GPM_Variable> mActionVariables;
44 map<tString,tFlag> mVariableActions;
47 tFlag mTopologicalAction;
50 tFlag mGroupNameAction;
87 virtual SP::GPM_GraphElement NewInstance()
const=0;
120 void setEnvironment(
const map<tString,SP::GPM_Variable>& env);
124 virtual void updateEnvironment(
const map<tString,SP::GPM_Variable>& env);
128 SV::GPM_Variable addToVariables(
const tString &variableName,SP::GPM_Variable var);
141 void setVariable(
const tString &variableName,SP::GPM_Variable var);
145 void setVariableValue(
const tString &variableName,
const tString& value);
148 void setVariableValue(
const tString &variableName,
const double& value);
151 void setVariableValue(
const tString &variableName,
const int& n,
const double* value);
154 void setVariableValue(
const tString &variableName,
const tFlag& type,
const int& n,
const double* value);
162 mVariables.erase(varName);
168 map<tString,SV::GPM_Variable>::const_iterator iter=mVariables.begin();
169 while (iter!=mVariables.end()) {
170 names.push_back(iter->first);
179 map<tString,SV::GPM_Variable>::const_iterator iter=mVariables.find(variableName);
180 if (iter!=mVariables.end()) {
181 variable=iter->second;
188 tString getVariableValuesToString(
const tString& variableName)
const;
192 SP::GPM_Variable getVariable(
const tString& variableName)
const;
199 tBoolean getVariableValue(
const tString &variableName,
double& value)
const;
202 tBoolean getVariableValue(
const tString &variableName,
int& n,
double* value)
const;
206 tFlag getVariableType(
const tString& variableName)
const;
222 virtual tString getGroupTypeName()
const=0;
254 return mTopologicalAction;
259 return (mTopologicalAction==REMOVE);
267 virtual tBoolean setTriggerAction(
const tFlag& action,
const tString& varName,SP::GPM_Variable var);
273 virtual tBoolean setTriggerAction(
const tFlag& action,
const tString& varName,
const double& value);
276 virtual tBoolean setTriggerAction(
const tFlag& action,
const tString& varName,
const int& n,
const double* value);
279 virtual tBoolean setTriggerAction(
const tFlag& action,
const tString& varName,
const tFlag& type,
const int& n,
const double* value);
285 map<tString,SV::GPM_Variable>::const_iterator iter=mActionVariables.find(variableName);
286 if (iter!=mActionVariables.end()) {
287 variable=iter->second;
295 map<tString,tFlag>::const_iterator iter=mVariableActions.find(varName);
296 if (iter!=mVariableActions.end()) {
303 virtual void clearActions();
307 virtual void executeTriggerActions();
354 virtual void saveToStream(ofstream& f)
const;
361 virtual tString toString()
const;
tBoolean getTriggerActionValues(const tString &variableName, SV::GPM_Variable &variable) const
get action variables
Definition: GPM_GraphElement.h:283
void setGraph(SP::GPM_Graph graph)
set the attached graph
Definition: GPM_GraphElement.h:95
virtual void toDoAfterThisSetting()
method called after This setting
Definition: GPM_GraphElement.h:76
void setGroupName(const tString &v)
set group name
Definition: GPM_GraphElement.h:228
#define tBoolean
Definition: types.h:35
tBoolean hasTriggerCutAction() const
return true if the element has a trigger cut action
Definition: GPM_GraphElement.h:258
void removeVariable(const tString &varName)
remove the variable
Definition: GPM_GraphElement.h:161
tBoolean getVariables(const tString &variableName, SV::GPM_Variable &variable) const
get variables
Definition: GPM_GraphElement.h:177
tFlag getTriggerAction(const tString &varName) const
get the variable action
Definition: GPM_GraphElement.h:294
void setId(const int &id)
set graph
Definition: GPM_GraphElement.h:332
tFlag getTopologicalAction() const
get toppologial action
Definition: GPM_GraphElement.h:253
#define SP_OBJECT(X)
Definition: CORE_Pointers.h:176
This class describes a node.
Definition: GPM_Variable.h:16
#define DEFINE_SVPTR(X)
Definition: CORE_ListPointers.h:21
void getVariableNames(vector< tString > &names) const
get the variable names
Definition: GPM_GraphElement.h:166
#define tString
Definition: types.h:36
virtual void clearVariables()
clear the variables
Definition: GPM_GraphElement.h:210
virtual void toDoAfterThisSetting()
method called after setThis() method this method can oly be called once.
Definition: CORE_Object.h:188
int getId() const
get id
Definition: GPM_GraphElement.h:337
This class is the base class of all graph classes.
Definition: GPM_Object.h:17
This class describes a graph which is a list of nodes & ports.
Definition: GPM_Graph.h:19
tString getGroupName() const
set group name
Definition: GPM_GraphElement.h:234
This class describes an element of a graph.
Definition: GPM_GraphElement.h:17
#define tFlag
Definition: types.h:14