#include <OMKIConnectors.h>
Inheritance diagram for OMK::Iii::IConnector:
Public Member Functions | |
Interface. | |
virtual bool | loadParameters (const ConfigurationParameterDescriptor *node) |
Initialise the connector parameters with the configuration node. | |
virtual bool | isConnected (const Name &interactor) const=0 |
Returns if the interactor is connected or not. | |
virtual bool | preConnect (const Name &interactor, const OMK::Type::AccessGroupLevel &freezeLevel, OMK::Type::AccessLevel toolLevel)=0 |
Connection method. | |
virtual bool | connect (const Name &interactor, const Name &outputName)=0 |
virtual void | disconnect (const Name &interactor)=0 |
Disconnection method. | |
virtual void | disconnect ()=0 |
Disconnection method. | |
virtual void | updateParameter () const=0 |
Update method. | |
virtual void | sendValue (const Name &receiver) const =0 |
Sending the current value. | |
const Name & | id () const |
Get the id of the connector. | |
const Name & | category () const |
Get the category id of the connector. | |
const Name & | type () const |
Get the type id of the connector. | |
const IAccessRule & | getAccessRule () const |
Get the current access rule of the connector. | |
IAccessRule & | getAccessRule () |
std::list< Name > & | getToolsInUse () |
Return the parameter access level. | |
const std::list< Name > & | getToolsInUse () const |
Return the parameter access level. | |
void | addToolInUse (const Name &toolId) |
Add a item to the items of AccessLevelList.". | |
Protected Member Functions | |
void | SendControlTakenBy (const Name &newInteractor) |
void | SendControlReleased (const Name &interactor) |
void | SendControlReleasedBy (const Name &oldInteractor) |
void | SendControlEnded (const Name &interactor) |
Protected Attributes | |
Name | _id |
Id of the connection. | |
Name | _attributeId |
Id of the associated attribute. | |
Name | _category |
Category id of the connection. | |
Name | _type |
Type id of the connection. | |
IAccessRule * | _accessRule |
Access rule to the connector. | |
std::list< Name > | _toolsInUse |
The tools in use. | |
std::list< Name > | _toolsOnStandby |
The tools which will be in use. | |
ExtensibleSimulatedObject * | _owner |
The pointer on the interactive owner. | |
InteractiveExtension * | _interactiveExtension |
Interactor listener which aggregates the connector. |
Definition at line 60 of file OMKIConnectors.h.
OMK::Iii::IConnector::IConnector | ( | const Name & | id, | |
const Name & | category, | |||
const Name & | type, | |||
OMK::Type::AccessLevel | accessLevel, | |||
bool | freezable, | |||
ExtensibleSimulatedObject * | owner | |||
) | [protected] |
Constructor for connectors which are not dynamically created.
By default the connector is available.
Definition at line 35 of file OMKIConnectors.cpp.
References _accessRule.
00038 : _id( id ), 00039 _category( category ), 00040 _type( type ), 00041 _accessRule( 0 ), 00042 _owner( owner ) 00043 { 00044 _accessRule = AccessRuleFactory::getInstance().create( "GrpLevel" )( 0 ) ; 00045 }
OMK::Iii::IConnector::IConnector | ( | const Name & | id, | |
const Name & | attributeId, | |||
const Name & | type, | |||
InteractiveExtension * | extension, | |||
const ConfigurationParameterDescriptor * | node | |||
) | [protected] |
Creator constructor.
By default the connector is available.
id,the | id of the connector | |
attributeId,the | id of the associated attribute, most of the time the same as id | |
type,the | type of the connector | |
extension,the | extension owner of the connector | |
node,the | configuration node of the connector | |
defaultAccessRuleNode,the | default configuration node of the access rule (can be null) |
Definition at line 47 of file OMKIConnectors.cpp.
References _accessRule, _attributeId, _category, _interactiveExtension, _owner, OMK::Iii::InteractiveExtension::addConnector(), OMK::ParametersAccessor::get(), OMK::ExtensibleSimulatedObject::getAttribute(), OMK::SimulatedObject::getConfigurationParameters(), OMK::SimulatedObject::getController(), and OMK::IAttribute::getOutput().
00052 : _id( id ), 00053 _attributeId( attributeId ), 00054 _category(), 00055 _type( type ), 00056 _accessRule( 0 ), 00057 _owner( extension->getOwner() ), 00058 _interactiveExtension( extension ) 00059 { 00060 ParametersAccessor::get( node, "Category", _category ) ; 00061 00062 // Access rule 00063 const ConfigurationParameterDescriptor* accessRuleNode = 0 ; 00064 std::string accessRuleGrp ; 00065 Name accessRuleType( "GrpLevel" ) ; 00066 if( ParametersAccessor::get( node, "AccessRule", accessRuleNode ) ) 00067 { 00068 if( !dynamic_cast< const MultipleConfigurationParameter* >( accessRuleNode ) ) 00069 { // It is a name => Try to find the corresponding access rule definition 00070 // in the "AccessRules" node of the controller 00071 ParametersAccessor::get( node, "AccessRule", accessRuleGrp ) ; 00072 const ConfigurationParameterDescriptor* defaultAccessRulesNode = 0 ; 00073 ParametersAccessor::get( _owner->getController().getConfigurationParameters(), 00074 "AccessRules", defaultAccessRulesNode ) ; 00075 ParametersAccessor::get( defaultAccessRulesNode, accessRuleGrp, accessRuleNode ) ; 00076 } 00077 // else No name => Try to find a node which defines a local definition of the access rule 00078 } 00079 ParametersAccessor::get( accessRuleNode, "Class", accessRuleType ) ; 00080 _accessRule = AccessRuleFactory::getInstance().create( accessRuleType )( accessRuleNode ) ; 00081 00082 bool postCompute = _owner->getAttribute( _attributeId )->getOutput() != 0 ; 00083 ParametersAccessor::get( node, "PostCompute", postCompute ) ; 00084 // If there is a output we must use post processing 00085 _interactiveExtension->addConnector( this, postCompute ) ; 00086 }
virtual OMK::Iii::IConnector::~IConnector | ( | ) | [inline, virtual] |
OMK::Iii::IConnector::IConnector | ( | const Name & | id, | |
const Name & | category, | |||
const Name & | type, | |||
OMK::Type::AccessLevel | accessLevel, | |||
bool | freezable, | |||
ExtensibleSimulatedObject * | owner | |||
) | [protected] |
Constructor for connectors which are not dynamically created.
By default the connector is available.
Definition at line 35 of file OMKIConnectors.cpp.
References _accessRule.
00038 : _id( id ), 00039 _category( category ), 00040 _type( type ), 00041 _accessRule( 0 ), 00042 _owner( owner ) 00043 { 00044 _accessRule = AccessRuleFactory::getInstance().create( "GrpLevel" )( 0 ) ; 00045 }
OMK::Iii::IConnector::IConnector | ( | const Name & | id, | |
const Name & | attributeId, | |||
const Name & | type, | |||
InteractiveExtension * | extension, | |||
const ConfigurationParameterDescriptor * | node | |||
) | [protected] |
Creator constructor.
By default the connector is available.
id,the | id of the connector | |
attributeId,the | id of the associated attribute, most of the time the same as id | |
type,the | type of the connector | |
extension,the | extension owner of the connector | |
node,the | configuration node of the connector | |
defaultAccessRuleNode,the | default configuration node of the access rule (can be null) |
Definition at line 47 of file OMKIConnectors.cpp.
References _accessRule, _attributeId, _category, _interactiveExtension, _owner, OMK::Iii::InteractiveExtension::addConnector(), OMK::ParametersAccessor::get(), OMK::ExtensibleSimulatedObject::getAttribute(), OMK::SimulatedObject::getConfigurationParameters(), OMK::SimulatedObject::getController(), and OMK::IAttribute::getOutput().
00052 : _id( id ), 00053 _attributeId( attributeId ), 00054 _category(), 00055 _type( type ), 00056 _accessRule( 0 ), 00057 _owner( extension->getOwner() ), 00058 _interactiveExtension( extension ) 00059 { 00060 ParametersAccessor::get( node, "Category", _category ) ; 00061 00062 // Access rule 00063 const ConfigurationParameterDescriptor* accessRuleNode = 0 ; 00064 std::string accessRuleGrp ; 00065 Name accessRuleType( "GrpLevel" ) ; 00066 if( ParametersAccessor::get( node, "AccessRule", accessRuleNode ) ) 00067 { 00068 if( !dynamic_cast< const MultipleConfigurationParameter* >( accessRuleNode ) ) 00069 { // It is a name => Try to find the corresponding access rule definition 00070 // in the "AccessRules" node of the controller 00071 ParametersAccessor::get( node, "AccessRule", accessRuleGrp ) ; 00072 const ConfigurationParameterDescriptor* defaultAccessRulesNode = 0 ; 00073 ParametersAccessor::get( _owner->getController().getConfigurationParameters(), 00074 "AccessRules", defaultAccessRulesNode ) ; 00075 ParametersAccessor::get( defaultAccessRulesNode, accessRuleGrp, accessRuleNode ) ; 00076 } 00077 // else No name => Try to find a node which defines a local definition of the access rule 00078 } 00079 ParametersAccessor::get( accessRuleNode, "Class", accessRuleType ) ; 00080 _accessRule = AccessRuleFactory::getInstance().create( accessRuleType )( accessRuleNode ) ; 00081 00082 bool postCompute = _owner->getAttribute( _attributeId )->getOutput() != 0 ; 00083 ParametersAccessor::get( node, "PostCompute", postCompute ) ; 00084 // If there is a output we must use post processing 00085 _interactiveExtension->addConnector( this, postCompute ) ; 00086 }
virtual OMK::Iii::IConnector::~IConnector | ( | ) | [inline, virtual] |
virtual bool OMK::Iii::IConnector::loadParameters | ( | const ConfigurationParameterDescriptor * | node | ) | [inline, virtual] |
Initialise the connector parameters with the configuration node.
[in] | node | The configuration node of the connector |
Reimplemented in OMK::Iii::AssociatedConnectorT< Type >.
Definition at line 96 of file OMKIConnectors.h.
Referenced by OMK::Iii::AssociatedConnectorT< Type >::loadParameters().
Returns if the interactor is connected or not.
[in] | interactor | the interactor object id. |
Implemented in OMK::Iii::SimpleConnectorT< Type >, and OMK::Iii::SharedConnectorT< Type >.
virtual bool OMK::Iii::IConnector::preConnect | ( | const Name & | interactor, | |
const OMK::Type::AccessGroupLevel & | freezeLevel, | |||
OMK::Type::AccessLevel | toolLevel | |||
) | [pure virtual] |
Connection method.
[in] | interactor | the interactor object id. |
[in] | outputName | the name of the output to connect. |
Implemented in OMK::Iii::SimpleConnectorT< Type >, OMK::Iii::SharedConnectorT< Type >, and OMK::Iii::AssociatedConnectorT< Type >.
virtual bool OMK::Iii::IConnector::connect | ( | const Name & | interactor, | |
const Name & | outputName | |||
) | [pure virtual] |
Implemented in OMK::Iii::SimpleConnectorT< Type >, and OMK::Iii::SharedConnectorT< Type >.
virtual void OMK::Iii::IConnector::disconnect | ( | const Name & | interactor | ) | [pure virtual] |
Disconnection method.
[in] | interactor | the interactor object id to disconnect. |
Implemented in OMK::Iii::SimpleConnectorT< Type >, and OMK::Iii::SharedConnectorT< Type >.
virtual void OMK::Iii::IConnector::disconnect | ( | ) | [pure virtual] |
Disconnection method.
Call to disconnect all the associated inputs from the outputs of the interactors.
See connect.
Implemented in OMK::Iii::SimpleConnectorT< Type >, and OMK::Iii::SharedConnectorT< Type >.
virtual void OMK::Iii::IConnector::updateParameter | ( | ) | const [pure virtual] |
Update method.
Call by EventInteractorListener::updateParameters to update the parameter with the value read in the associated input.
Implemented in OMK::Iii::SimpleConnectorT< Type >, and OMK::Iii::SharedConnectorT< Type >.
virtual void OMK::Iii::IConnector::sendValue | ( | const Name & | receiver | ) | const [pure virtual] |
Sending the current value.
Call by EventInteractorListener::processGetParameters to send the current value of the parameter. See the protocol
Implemented in OMK::Iii::SimpleConnectorT< Type >, and OMK::Iii::SharedConnectorT< Type >.
const Name& OMK::Iii::IConnector::id | ( | ) | const [inline] |
Get the id of the connector.
Definition at line 133 of file OMKIConnectors.h.
Referenced by OMK::Iii::InteractiveExtension::addConnector(), and OMK::Iii::AssociatedConnectorT< Type >::loadParameters().
00133 { return _id ; }
const Name& OMK::Iii::IConnector::category | ( | ) | const [inline] |
Get the category id of the connector.
Definition at line 136 of file OMKIConnectors.h.
00136 { return _category ; }
const Name& OMK::Iii::IConnector::type | ( | ) | const [inline] |
Get the type id of the connector.
Definition at line 139 of file OMKIConnectors.h.
00139 { return _type ; }
const IAccessRule& OMK::Iii::IConnector::getAccessRule | ( | ) | const [inline] |
Get the current access rule of the connector.
Definition at line 142 of file OMKIConnectors.h.
00142 { return *_accessRule ; }
IAccessRule& OMK::Iii::IConnector::getAccessRule | ( | ) | [inline] |
std::list< Name >& OMK::Iii::IConnector::getToolsInUse | ( | ) | [inline] |
Return the parameter access level.
Definition at line 145 of file OMKIConnectors.h.
00145 { return _toolsInUse ; }
const std::list< Name >& OMK::Iii::IConnector::getToolsInUse | ( | ) | const [inline] |
Return the parameter access level.
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
For const version.
Definition at line 149 of file OMKIConnectors.h.
00149 { return _toolsInUse ; }
void OMK::Iii::IConnector::addToolInUse | ( | const Name & | toolId | ) | [inline] |
Add a item to the items of AccessLevelList.".
Definition at line 151 of file OMKIConnectors.h.
00151 { _toolsInUse.push_back( toolId ) ; }
void OMK::Iii::IConnector::SendControlTakenBy | ( | const Name & | newInteractor | ) | [protected] |
Definition at line 88 of file OMKIConnectors.cpp.
References _id, _owner, _toolsInUse, OMK::EventId::CONTROL_TAKEN_BY, and OMK::SimulatedObject::sendValuedEvent().
00089 { 00090 for( std::list< Name >::const_iterator interactor = _toolsInUse.begin() ; 00091 interactor != _toolsInUse.end() ; 00092 ++interactor ) 00093 { 00094 _owner->sendValuedEvent( 00095 *interactor, 00096 EventId::CONTROL_TAKEN_BY, 00097 Type::ControlUpdatedType( Type::ControlUpdatedPrm( _id, newInteractor ) ) ) ; 00098 } 00099 }
void OMK::Iii::IConnector::SendControlReleased | ( | const Name & | interactor | ) | [protected] |
Definition at line 101 of file OMKIConnectors.cpp.
References _id, _owner, OMK::EventId::CONTROL_RELEASED, and OMK::SimulatedObject::sendValuedEvent().
Referenced by OMK::Iii::SharedConnectorT< Type >::disconnect().
00102 { 00103 _owner->sendValuedEvent( interactor, EventId::CONTROL_RELEASED, _id ) ; 00104 }
void OMK::Iii::IConnector::SendControlReleasedBy | ( | const Name & | oldInteractor | ) | [protected] |
Definition at line 106 of file OMKIConnectors.cpp.
References _id, _owner, _toolsInUse, OMK::EventId::CONTROL_RELEASED_BY, and OMK::SimulatedObject::sendValuedEvent().
Referenced by OMK::Iii::SharedConnectorT< Type >::disconnect().
00107 { 00108 for( std::list< Name >::const_iterator interactor = _toolsInUse.begin() ; 00109 interactor != _toolsInUse.end() ; 00110 ++interactor ) 00111 { 00112 if( *interactor != oldInteractor ) 00113 { 00114 _owner->sendValuedEvent( 00115 *interactor, 00116 EventId::CONTROL_RELEASED_BY, 00117 Type::ControlUpdatedType( Type::ControlUpdatedPrm( _id, oldInteractor ) ) ) ; 00118 } 00119 } 00120 }
void OMK::Iii::IConnector::SendControlEnded | ( | const Name & | interactor | ) | [protected] |
Definition at line 122 of file OMKIConnectors.cpp.
References _id, _owner, OMK::EventId::CONTROL_ENDED, and OMK::SimulatedObject::sendValuedEvent().
Referenced by OMK::Iii::SharedConnectorT< Type >::disconnect(), and OMK::Iii::SimpleConnectorT< Type >::disconnect().
00123 { 00124 _owner->sendValuedEvent( interactor, EventId::CONTROL_ENDED, _id ) ; 00125 }
Name OMK::Iii::IConnector::_id [protected] |
Id of the connection.
This id is unique for the owner and identifies the parameter. The interactors knows the parameter only by this id. It is defined at the creation of the connector and cannot be changed during its life.
Definition at line 159 of file OMKIConnectors.h.
Referenced by OMK::Iii::SharedConnectorT< Type >::connect(), OMK::Iii::SimpleConnectorT< Type >::connect(), OMK::Iii::SharedConnectorT< Type >::disconnect(), OMK::Iii::SimpleConnectorT< Type >::disconnect(), SendControlEnded(), SendControlReleased(), SendControlReleasedBy(), SendControlTakenBy(), OMK::Iii::SharedConnectorT< Type >::sendValue(), and OMK::Iii::SimpleConnectorT< Type >::sendValue().
Name OMK::Iii::IConnector::_attributeId [protected] |
Id of the associated attribute.
Definition at line 161 of file OMKIConnectors.h.
Referenced by IConnector().
Name OMK::Iii::IConnector::_category [protected] |
Category id of the connection.
This id define the category for the connector and identifies the parameter category. The interactors knows the parameter category by this id. It is defined at the creation of the connector and cannot be changed during its life.
Definition at line 167 of file OMKIConnectors.h.
Referenced by IConnector().
Name OMK::Iii::IConnector::_type [protected] |
Type id of the connection.
This id define the type of the connector and identifies. It is defined at the creation of the connector and cannot be changed during its life.
Definition at line 171 of file OMKIConnectors.h.
IAccessRule* OMK::Iii::IConnector::_accessRule [protected] |
Access rule to the connector.
Reference to the rules which define access of the connector, it also encapsulates the default and current access levels.
See IAccessRule.
Definition at line 177 of file OMKIConnectors.h.
Referenced by OMK::Iii::SharedConnectorT< Type >::disconnect(), OMK::Iii::SimpleConnectorT< Type >::disconnect(), and IConnector().
std::list< Name > OMK::Iii::IConnector::_toolsInUse [protected] |
The tools in use.
Definition at line 179 of file OMKIConnectors.h.
Referenced by OMK::Iii::SharedConnectorT< Type >::disconnect(), OMK::Iii::SimpleConnectorT< Type >::disconnect(), SendControlReleasedBy(), and SendControlTakenBy().
std::list< Name > OMK::Iii::IConnector::_toolsOnStandby [protected] |
The tools which will be in use.
Definition at line 181 of file OMKIConnectors.h.
Referenced by OMK::Iii::SharedConnectorT< Type >::connect(), OMK::Iii::SimpleConnectorT< Type >::connect(), OMK::Iii::SharedConnectorT< Type >::disconnect(), and OMK::Iii::SimpleConnectorT< Type >::disconnect().
ExtensibleSimulatedObject* OMK::Iii::IConnector::_owner [protected] |
The pointer on the interactive owner.
Definition at line 183 of file OMKIConnectors.h.
Referenced by OMK::Iii::SharedConnectorT< Type >::connect(), OMK::Iii::SimpleConnectorT< Type >::connect(), OMK::Iii::SharedConnectorT< Type >::disconnect(), OMK::Iii::SimpleConnectorT< Type >::disconnect(), IConnector(), SendControlEnded(), SendControlReleased(), SendControlReleasedBy(), and SendControlTakenBy().
Interactor listener which aggregates the connector.
Definition at line 185 of file OMKIConnectors.h.
Referenced by IConnector(), and OMK::Iii::AssociatedConnectorT< Type >::loadParameters().
Documentation generated on Mon Jun 9 11:46:04 2008 |
Generated with doxygen by Dimitri van Heesch , 1997-2007 |