|
STK++ 1.0
|
A connection between two distinct Steps in a program. More...
#include <STK_Connection.h>


Public Types | |
| enum | PenStyle { NoPen, SolidLine, DashLine, DotLine, DashDotLine, DashDotDotLine, CustomDashLine } |
Public Member Functions | |
| Connection (IStep *source, IStep *target, const PenStyle &lineStyle=SolidLine) | |
| constructor | |
| virtual | ~Connection () |
| destructor. | |
| const PenStyle & | getLineStyle () const |
| Returns the line drawing style of this connection. | |
| IStep * | getSource () const |
| Returns the source end-point of this connection. | |
| IStep * | getTarget () const |
| Returns the target end-point of this connection. | |
| void | setLineStyle (const PenStyle &lineStyle) |
| Set the line drawing style of this connection. | |
| void | disconnect () |
| Disconnect this connection from the Steps it is attached to. | |
| void | reconnect () |
| Reconnect this connection. | |
| void | reconnect (IStep *newSource, IStep *newTarget) |
| Reconnect to a different source and/or target Step. | |
| 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 | |
Protected Attributes | |
| bool | isConnected_ |
| True, if the connection is attached to its end-points. | |
| PenStyle | lineStyle_ |
| Default Line drawing style for this connection. | |
| IStep * | source_ |
| Connection's source end-point. | |
| IStep * | target_ |
| Connection's target end-point. | |
Static Private Attributes | |
| static const String | ID_CONNECTION_LINESTYLE |
| Property ID to use for the line style property. | |
| static const String | ID_CONNECTION_SOURCE |
| Property ID to use for tjhe source property. | |
| static const String | ID_CONNECTION_TARGET |
| Property ID to use for the target property. | |
| static const PropertyDescriptor | lineStyleDescriptor_ |
| Descriptor of the line style property. | |
| static const PropertyDescriptor | sourceDescriptor_ |
| Descriptor of source property. | |
| static const PropertyDescriptor | targetDescriptor_ |
| Descriptor of the target property. | |
| static const String | lineStyleName [] |
| Values of the line style Property. | |
A connection between two distinct Steps in a program.
When designing a program, the user will connect the different step of its program with Connection
Definition at line 53 of file STK_Connection.h.
Definition at line 56 of file STK_Connection.h.
{ // pen style
NoPen,
SolidLine,
DashLine,
DotLine,
DashDotLine,
DashDotDotLine,
CustomDashLine
};
| STK::Connection::Connection | ( | IStep * | source, |
| IStep * | target, | ||
| const PenStyle & | lineStyle = SolidLine |
||
| ) |
constructor
Create a (solid) connection between two distinct Steps.
| source | a source end-point for this connection (non null) |
| target | a target end-point for this connection (non null) |
| lineStyle | line style to use for the Connection |
Definition at line 72 of file STK_Connection.cpp.
: lineStyle_(lineStyle) , source_(source) , target_(target) { ;}
| STK::Connection::~Connection | ( | ) | [virtual] |
| const Connection::PenStyle & STK::Connection::getLineStyle | ( | ) | const |
Returns the line drawing style of this connection.
Definition at line 89 of file STK_Connection.cpp.
References lineStyle_.
{ return lineStyle_;}
| IStep * STK::Connection::getSource | ( | ) | const |
Returns the source end-point of this connection.
Returns the source endpoint of this connection.
Definition at line 95 of file STK_Connection.cpp.
References source_.
Referenced by STK::IStep::addConnection(), STK::IStep::removeConnection(), and STK::GProgram::removeStep().
{ return source_;}
| IStep * STK::Connection::getTarget | ( | ) | const |
Returns the target end-point of this connection.
Returns the target endpoint of this connection.
Definition at line 101 of file STK_Connection.cpp.
References target_.
Referenced by STK::IStep::addConnection(), and STK::IStep::removeConnection().
{ return target_;}
| void STK::Connection::setLineStyle | ( | const PenStyle & | lineStyle | ) |
Set the line drawing style of this connection.
| lineStyle | one of the values in Qt::PenStyle except NoPen |
| invalid_argument | if lineStyle is Qt::NoPen |
| lineStyle | one of the Qt::PenStyle values |
| IllegalArgumentException | if lineStyle does not have one of the above values |
Definition at line 110 of file STK_Connection.cpp.
References lineStyle_, and NoPen.
{
if (lineStyle == NoPen)
{
throw std::invalid_argument("In Connection::setLineStyle : try to set"
"NoPen style");
}
lineStyle_ = lineStyle;
}
| void STK::Connection::disconnect | ( | ) |
Disconnect this connection from the Steps it is attached to.
Definition at line 123 of file STK_Connection.cpp.
References isConnected_, STK::IStep::removeConnection(), source_, and target_.
Referenced by reconnect().
{
if (isConnected_)
{
source_->removeConnection(this);
target_->removeConnection(this);
isConnected_ = false;
}
}

| void STK::Connection::reconnect | ( | ) |
Reconnect this connection.
The connection will reconnect with the step it was previously attached to.
Definition at line 137 of file STK_Connection.cpp.
References STK::IStep::addConnection(), isConnected_, source_, and target_.
Referenced by reconnect().
{
if (!isConnected_)
{
source_->addConnection(this);
target_->addConnection(this);
isConnected_ = true;
}
}

Reconnect to a different source and/or target Step.
The connection will disconnect from its current attachments and reconnect to the new source and target.
| newSource | a new source end-point for this connection (non null) |
| newTarget | a new target end-point for this connection (non null) |
| invalid_argument | if any of the parameters are null or newSource == newTarget |
Definition at line 151 of file STK_Connection.cpp.
References disconnect(), reconnect(), source_, and target_.
{
if (newSource == newTarget)
{
throw std::invalid_argument("STK::Connection::reconnect(newSource, newTarget"
" source and target must be different"
);
}
disconnect();
this->source_ = newSource;
this->target_ = newTarget;
reconnect();
}

| bool STK::Connection::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 Connection id property. Implements STK::IPropertySource.
Definition at line 172 of file STK_Connection.cpp.
References ID_CONNECTION_LINESTYLE, ID_CONNECTION_SOURCE, ID_CONNECTION_TARGET, and isConnected_.
{
if (id==ID_CONNECTION_LINESTYLE) return true;
if ((id==ID_CONNECTION_SOURCE||id==ID_CONNECTION_TARGET)&&
(isConnected_)) 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 188 of file STK_Connection.cpp.
References ID_CONNECTION_LINESTYLE, ID_CONNECTION_SOURCE, ID_CONNECTION_TARGET, isConnected_, lineStyle_, lineStyleName, STK::IStep::name(), source_, and target_.
{
// line style name
if (id==ID_CONNECTION_LINESTYLE)
return &(lineStyleName[lineStyle_]);
// name of the source
if ((id==ID_CONNECTION_SOURCE)&& isConnected_)
return &(source_->name());
// name of the target
if ((id==ID_CONNECTION_TARGET)&& isConnected_)
return &(target_->name());
return NULL;
}

const String STK::Connection::ID_CONNECTION_LINESTYLE [static, private] |
Property ID to use for the line style property.
Definition at line 68 of file STK_Connection.h.
Referenced by getPropertyValue(), and isPropertySet().
const String STK::Connection::ID_CONNECTION_SOURCE [static, private] |
Property ID to use for tjhe source property.
Definition at line 71 of file STK_Connection.h.
Referenced by getPropertyValue(), and isPropertySet().
const String STK::Connection::ID_CONNECTION_TARGET [static, private] |
Property ID to use for the target property.
Definition at line 74 of file STK_Connection.h.
Referenced by getPropertyValue(), and isPropertySet().
const PropertyDescriptor STK::Connection::lineStyleDescriptor_ [static, private] |
Descriptor of the line style property.
Definition at line 77 of file STK_Connection.h.
const PropertyDescriptor STK::Connection::sourceDescriptor_ [static, private] |
Descriptor of source property.
Definition at line 80 of file STK_Connection.h.
const PropertyDescriptor STK::Connection::targetDescriptor_ [static, private] |
Descriptor of the target property.
Definition at line 83 of file STK_Connection.h.
const String STK::Connection::lineStyleName [static, private] |
{
"No Line",
"Solid Line",
"Dash Line",
"Dot Line",
"Dash Dot Line",
"Dash Dot Dot Line",
"Custom Dash Line"
}
Values of the line style Property.
Definition at line 86 of file STK_Connection.h.
Referenced by getPropertyValue().
bool STK::Connection::isConnected_ [protected] |
True, if the connection is attached to its end-points.
Definition at line 90 of file STK_Connection.h.
Referenced by disconnect(), getPropertyValue(), isPropertySet(), and reconnect().
PenStyle STK::Connection::lineStyle_ [protected] |
Default Line drawing style for this connection.
Definition at line 93 of file STK_Connection.h.
Referenced by getLineStyle(), getPropertyValue(), and setLineStyle().
IStep* STK::Connection::source_ [protected] |
Connection's source end-point.
Definition at line 96 of file STK_Connection.h.
Referenced by disconnect(), getPropertyValue(), getSource(), and reconnect().
IStep* STK::Connection::target_ [protected] |
Connection's target end-point.
Definition at line 99 of file STK_Connection.h.
Referenced by disconnect(), getPropertyValue(), getTarget(), and reconnect().