STK++ 1.0
STK::IStep Class Reference

Interface Base class for Steps. More...

#include <STK_IStep.h>

Inheritance diagram for STK::IStep:
Collaboration diagram for STK::IStep:

List of all members.

Public Member Functions

 IStep (String const &name, Real const &x, Real const &y)
 constructor
virtual ~IStep ()
 destructor.
String const & name () const
 get the name of this IStep
Real const & getXLocation () const
 get the X location of the IStep
Real const & getYLocation () const
 get the Y location of the IStep
std::list< Connection * > & getIncomingConnections ()
 get the list of the incoming connections
std::list< Connection * > & getOutgoingConnections ()
 get the list of the outgoing connections
void removeConnection (Connection *connection)
 remove a connection to this Step.
void addConnection (Connection *connection)
 Add a connection to this Step.
virtual bool isPropertySet (String const &id) const
 Implementation of the pure virtual method isPropertySet defined in IPropertySource
virtual const StringgetPropertyValue (String const &id) const
 Implementation of the pure virtual method getPropertyValue defined in IPropertySource

Protected Attributes

String name_
 Name of this step.
Real xLocation_
 X Location of this Step.
Real yLocation_
 Y Location of this Step.
std::list< Connection * > incomingConnections_
 List of the incoming connections.
std::list< Connection * > outgoingConnections_
 List of the outgoing connections.

Static Private Attributes

static const String ID_STEP_SOURCE_CONNECTIONS = "Step.SourceConnection"
 Property ID to use when the list of outgoing connections is modified.
static const String ID_STEP_TARGET_CONNECTIONS = "Step.TargetConnection"
 Property ID to use when the list of incoming connections is modified.
static const String ID_STEP_XLOCATION = "Step.xLocation"
 Property ID for the X location property value.
static const String ID_STEP_YLOCATION = "Step.yLocation"
 Property ID for the Y location property value.
static const PropertyDescriptor sourceConnectionsDescriptor_
 Descriptor of the source connections property.
static const PropertyDescriptor targetConnectionsDescriptor_
 Descriptor of the target connections property.
static const PropertyDescriptor heightDescriptor_
 Descriptor of the height property.
static const PropertyDescriptor widthDescriptor_
 Descriptor of the width property.
static const PropertyDescriptor xLocationDescriptor_
 Descriptor of the x location property.
static const PropertyDescriptor yLocationDescriptor_
 Descriptor of the y location property.

Detailed Description

Interface Base class for Steps.

A Step is an executable process in a whole Program. It is represented as a graphical box with a given (height, width) and a X location and Y location in the canvas.

Each step manage a set of incoming and outgoing connections to other steps. These connections are added and removed locally. If a step is a the source of a Connection and this connection is removed, he is responsible to the destruction of the Connection. It is also responsible to signal to the target of the connection that the Connection has been released.

Definition at line 80 of file STK_IStep.h.


Constructor & Destructor Documentation

STK::IStep::IStep ( String const &  name,
Real const &  x,
Real const &  y 
)

constructor

Definition at line 71 of file STK_IStep.cpp.

STK::IStep::~IStep ( ) [virtual]

destructor.

Definition at line 80 of file STK_IStep.cpp.

References incomingConnections_, and outgoingConnections_.

{
  std::list<Connection*>::iterator it;
  // remove outgoing connections
  for (it=outgoingConnections_.begin(); it!=outgoingConnections_.end(); it++)
  {
    delete *it;
  }
  outgoingConnections_.clear();
  // incoming connections will be released by the sources
  incomingConnections_.clear();
}

Member Function Documentation

String const& STK::IStep::name ( ) const [inline]

get the name of this IStep

Returns:
the name of the IStep

Definition at line 140 of file STK_IStep.h.

References name_.

Referenced by STK::Connection::getPropertyValue().

    { return name_;}
Real const& STK::IStep::getXLocation ( ) const [inline]

get the X location of the IStep

Returns:
the horizontal location of the IStep in the view

Definition at line 147 of file STK_IStep.h.

References xLocation_.

    { return xLocation_;}
Real const& STK::IStep::getYLocation ( ) const [inline]

get the Y location of the IStep

Returns:
the vertical location of the IStep in the view

Definition at line 154 of file STK_IStep.h.

References yLocation_.

    { return yLocation_;}
std::list<Connection*>& STK::IStep::getIncomingConnections ( ) [inline]

get the list of the incoming connections

Returns:
the list of the incoming connections

Definition at line 161 of file STK_IStep.h.

References incomingConnections_.

Referenced by STK::GProgram::removeStep().

std::list<Connection*>& STK::IStep::getOutgoingConnections ( ) [inline]

get the list of the outgoing connections

Returns:
the list of the outgoing connections

Definition at line 168 of file STK_IStep.h.

References outgoingConnections_.

void STK::IStep::removeConnection ( Connection connection)

remove a connection to this Step.

Parameters:
connectionThe connection to remove

Definition at line 99 of file STK_IStep.cpp.

References STK::Connection::getSource(), STK::Connection::getTarget(), incomingConnections_, and outgoingConnections_.

Referenced by STK::Connection::disconnect(), and STK::GProgram::removeStep().

{
  // check if it is an outgoing connection
  if (connection->getSource() == this)
  {
    // remove Connection from the outgoing list of connection
    outgoingConnections_.remove(connection);
    // release memory
    delete connection;
    connection = (Connection*)NULL;
    return;
  }
  // check if it is an incoming connection
  if (connection->getTarget() == this)
  {
    incomingConnections_.remove(connection);
  }
  return;
}

Here is the call graph for this function:

void STK::IStep::addConnection ( Connection connection)

Add a connection to this Step.

Parameters:
connectionThe connection to add

Definition at line 123 of file STK_IStep.cpp.

References STK::Connection::getSource(), STK::Connection::getTarget(), incomingConnections_, and outgoingConnections_.

Referenced by STK::GProgram::addConnection(), and STK::Connection::reconnect().

{
  std::list<Connection*>::iterator it;
  // check if it is an outgoing connection
  if (connection->getSource() == this)
  {
    // check if the connection is already present
    for (it=outgoingConnections_.begin(); it!=outgoingConnections_.end(); it++)
    {
      if (*it == connection) return;
    }
    // add connection
    outgoingConnections_.push_back(connection);
    return;
  }

  // check if it is an incoming connection
  if (connection->getTarget() == this)
  {
    // check if the connection is already present
    for (it=incomingConnections_.begin(); it!=incomingConnections_.end(); it++)
    {
      if (*it == connection) return;
    }
    incomingConnections_.push_back(connection);
  }
}

Here is the call graph for this function:

bool STK::IStep::isPropertySet ( String const &  id) const [virtual]

Implementation of the pure virtual method isPropertySet defined in IPropertySource

See also:
IPropertySource::isPropertySet
Parameters:
idthe id of the property
Returns:
true if id is a valid IStep id property.

Implements STK::IPropertySource.

Definition at line 156 of file STK_IStep.cpp.

References ID_STEP_SOURCE_CONNECTIONS, ID_STEP_TARGET_CONNECTIONS, ID_STEP_XLOCATION, and ID_STEP_YLOCATION.

{
  if (  (id==ID_STEP_SOURCE_CONNECTIONS)
      ||(id==ID_STEP_TARGET_CONNECTIONS)
      ||(id==ID_STEP_XLOCATION)
      ||(id==ID_STEP_YLOCATION)
     )
  { return true;}
  return false;
}
const String * STK::IStep::getPropertyValue ( String const &  id) const [virtual]

Implementation of the pure virtual method getPropertyValue defined in IPropertySource

See also:
IPropertySource::getPropertValue
Parameters:
idthe id of the property
Returns:
the value of the property, or NA

Implements STK::IPropertySource.

Definition at line 175 of file STK_IStep.cpp.

{
  return NULL;
}

Member Data Documentation

const String STK::IStep::ID_STEP_SOURCE_CONNECTIONS = "Step.SourceConnection" [static, private]

Property ID to use when the list of outgoing connections is modified.

Definition at line 84 of file STK_IStep.h.

Referenced by isPropertySet().

const String STK::IStep::ID_STEP_TARGET_CONNECTIONS = "Step.TargetConnection" [static, private]

Property ID to use when the list of incoming connections is modified.

Definition at line 87 of file STK_IStep.h.

Referenced by isPropertySet().

const String STK::IStep::ID_STEP_XLOCATION = "Step.xLocation" [static, private]

Property ID for the X location property value.

Definition at line 90 of file STK_IStep.h.

Referenced by isPropertySet().

const String STK::IStep::ID_STEP_YLOCATION = "Step.yLocation" [static, private]

Property ID for the Y location property value.

Definition at line 93 of file STK_IStep.h.

Referenced by isPropertySet().

Descriptor of the source connections property.

Definition at line 96 of file STK_IStep.h.

Descriptor of the target connections property.

Definition at line 99 of file STK_IStep.h.

Descriptor of the height property.

Definition at line 102 of file STK_IStep.h.

Descriptor of the width property.

Definition at line 105 of file STK_IStep.h.

Descriptor of the x location property.

Definition at line 108 of file STK_IStep.h.

Descriptor of the y location property.

Definition at line 111 of file STK_IStep.h.

Name of this step.

Definition at line 115 of file STK_IStep.h.

Referenced by name().

X Location of this Step.

Definition at line 118 of file STK_IStep.h.

Referenced by getXLocation().

Y Location of this Step.

Definition at line 121 of file STK_IStep.h.

Referenced by getYLocation().

List of the incoming connections.

Definition at line 124 of file STK_IStep.h.

Referenced by addConnection(), getIncomingConnections(), removeConnection(), and ~IStep().

List of the outgoing connections.

Definition at line 127 of file STK_IStep.h.

Referenced by addConnection(), getOutgoingConnections(), removeConnection(), and ~IStep().


The documentation for this class was generated from the following files: