|
STK++ 1.0
|
A GProgram is a succession of Step connected. More...
#include <STK_GProgram.h>


Public Member Functions | |
| GProgram (String const &name) | |
| constructor | |
| virtual | ~GProgram () |
| destructor | |
| String const & | name () |
| get the name_ of the program. | |
| void | run () |
| Execute the program. | |
| void | addStep (IStep *step) |
| Add a step to the Program. | |
| void | removeStep (IStep *step) |
| remove a step to the Program. | |
| bool | addConnection (IStep *source, IStep *target) |
| Add a Connection between two steps of the Program. | |
| virtual bool | isPropertySet (String const &id) const |
Implementation of the pure virtual method isPropertySet defined in IPropertySource | |
| virtual const String * | getPropertyValue (String const &id) const |
Implementation of the pure virtual method getPropertyValue defined in IPropertySource | |
Private Attributes | |
| String | name_ |
| name of the GProgram | |
| std::list< IStep * > | steps_ |
| list of the steps | |
Static Private Attributes | |
| static const String | ID_GPROGAM_NAME = "GProgram.name" |
| Property ID for the name of the GProgram value. | |
| static const PropertyDescriptor | nameDescriptor_ |
| Descriptor of the name property. | |
A GProgram is a succession of Step connected.
Each Step Perform a specific treatment.
Definition at line 51 of file STK_GProgram.h.
| STK::GProgram::GProgram | ( | String const & | name | ) |
| STK::GProgram::~GProgram | ( | ) | [virtual] |
| String const& STK::GProgram::name | ( | ) | [inline] |
get the name_ of the program.
Definition at line 76 of file STK_GProgram.h.
References name_.
{return name_;}
| void STK::GProgram::run | ( | ) |
| void STK::GProgram::addStep | ( | IStep * | step | ) |
Add a step to the Program.
| step | The step to add |
Definition at line 72 of file STK_GProgram.cpp.
References steps_.
Referenced by main().
| void STK::GProgram::removeStep | ( | IStep * | step | ) |
remove a step to the Program.
| step | The step to remove |
As a step can have incoming and outgoing connections, we have to remove safely all the stored values in the IStep connected with step.
| step | The step to remove |
Definition at line 89 of file STK_GProgram.cpp.
References STK::IStep::getIncomingConnections(), STK::Connection::getSource(), STK::IStep::removeConnection(), and steps_.
Referenced by main().
{
std::list<Connection*>& incomingConnection = step->getIncomingConnections();
std::list<Connection*>::iterator it;
// remove the incoming Connections
for (it=incomingConnection.begin(); it!=incomingConnection.end(); it++)
{
Connection* arc = *it;
arc->getSource()->removeConnection(arc);
}
// remove the IStep
steps_.remove(step);
delete step;
}

Add a Connection between two steps of the Program.
addConnection check if the Connection will not create an infinite loop in the program. Return false if it is the case.
The method will ask to the target Step if the Connection is compatible. If the Connection is compatible the Connection is created and added to the list of incoming Connection to the target Step and the outgoing Connection of the source Step
| source | The source of the Connection |
| target | The target of the Connection |
addConnection check if the Connection will not create an infinite loop in the program. Return false if it is the case. Then the method will ask to the target Step if the Connection is compatible. If the Connection is compatible the Connection is created and added to the list of incoming Connection to the target Step and the outgoing Connection of the source Step
| source | The source of the Connection |
| target | The target of the Connection |
Definition at line 119 of file STK_GProgram.cpp.
References STK::IStep::addConnection().
Referenced by main().
{
// TODO Check for an infinite loop in the program
// no loop we create the connection and add it
Connection* arc = new Connection(source, target);
source->addConnection(arc);
target->addConnection(arc);
return true;
}

| bool STK::GProgram::isPropertySet | ( | String const & | id | ) | const [virtual] |
Implementation of the pure virtual method isPropertySet defined in IPropertySource
| id | the id of the property |
true if id is a valid IStep id property. Implements STK::IPropertySource.
Definition at line 134 of file STK_GProgram.cpp.
References ID_GPROGAM_NAME.
{
if (id==ID_GPROGAM_NAME)
{ return true;}
return false;
}
Implementation of the pure virtual method getPropertyValue defined in IPropertySource
| id | the id of the property |
NA Implements STK::IPropertySource.
Definition at line 149 of file STK_GProgram.cpp.
References name_.
{
return &name_;
}
const String STK::GProgram::ID_GPROGAM_NAME = "GProgram.name" [static, private] |
Property ID for the name of the GProgram value.
Definition at line 55 of file STK_GProgram.h.
Referenced by isPropertySet().
const PropertyDescriptor STK::GProgram::nameDescriptor_ [static, private] |
Descriptor of the name property.
Definition at line 58 of file STK_GProgram.h.
String STK::GProgram::name_ [private] |
name of the GProgram
Definition at line 61 of file STK_GProgram.h.
Referenced by getPropertyValue(), and name().
std::list<IStep*> STK::GProgram::steps_ [private] |
list of the steps
Definition at line 64 of file STK_GProgram.h.
Referenced by addStep(), removeStep(), and ~GProgram().