OMK::Iii::InteractorExtension Class Reference
[Interactive objectInteractorInspectable objectInspector]

Ancestor of every interactive, interactor or inspector objects. More...

#include <OMKInteractorExtension.h>

Inheritance diagram for OMK::Iii::InteractorExtension:

Inheritance graph
[legend]
Collaboration diagram for OMK::Iii::InteractorExtension:

Collaboration graph
[legend]
List of all members.

Sessions handling.

SessionsMap _sessionsPrm
 Map of session parameters.
virtual void startSessionWith (const Name &interactiveObject)
 Method to start a new session.
virtual void closeSessionWith (const Name &interactiveObject)
 Method to close a session.
SessionPrmgetSessionWith (const Name &interactiveObject)
 Method to retrieve the session associated with the interactive object.
void closeAllSessions ()
 Method to close all the sessions.
virtual SessionPrmcreateSession (const Name &interactiveObject)
 Method to create a new session.

Events processing.

EventListener_accessibleConnectorsListener
 Pointer to aggregate the "accessible connectors" listener.
EventListener_currentValuesSentAndControlTakenListener
 Pointer to aggregate the "control taken and get current values sent" listener.
EventListener_controlReleasedListener
 Pointer to aggregate the "control released" listener.
EventListener_controlEndedListener
 Pointer to aggregate the "control ended" listener.
EventListener_controlTakenByListener
 Pointer to aggregate the "control taken by" listener.
EventListener_controlReleasedByListener
 Pointer to aggregate the "control released by" listener.
EventListener_currentValuesSentListener
 Pointer to aggregate the "current values sent" listener.
virtual bool processAccessibleParameters (Type::AccessibleParametersListEvent *event)
 Process the "available_connectors" event.
virtual bool processCurrentValuesSentAndControlTaken (Type::ControlTakenEvent *event)
 Process the "control_taken" event.
virtual bool processControlReleased (Type::ControlReleasedEvent *event)
 Process the "control_released" event.
virtual bool processControlEnded (Type::ControlEndedEvent *event)
 Process the "control_ended" event.
virtual bool processControlTakenBy (Type::ControlUpdatedEvent *event)
virtual bool processControlReleasedBy (Type::ControlUpdatedEvent *event)
virtual bool processCurrentValuesSent (Event *event)
 Process the "current_values_sent" event.

Public Member Functions

ExtensibleSimulatedObjectgetInteractor ()
OMK::Type::AccessLevel getAccessLevel () const
 Get the access level of the interactor.
void setAccessLevel (OMK::Type::AccessLevel level=0)
 Set the access level of the interactor.
const OMK::NamegetGroup () const
 Get the group name of the interactor.
void setGroup (const OMK::Name &name)
 Set the group name of the interactor.
const OMK::Type::AccessGroupgetAccessGroup () const
void addInteractorOutput (InteractorOutput *interactorOutput)
 Method to add output connectors.

Protected Member Functions

Interactor interface
virtual bool loadExtensionParameters (const ConfigurationParameterDescriptor *node)
 This method initialises the interactor.
virtual void startInteractor ()
 This method initialises the interactor mode of the object.

Protected Attributes

OMK::Type::AccessGroup _access
 Level access and group of the interactor.
InteractorOutputsMap _interactorOutputs
 Output connectors map.

Detailed Description

Ancestor of every interactive, interactor or inspector objects.

Date:
2006-10-12
Author:
Benoît Chanclou
Module description :
Use it by derivation to add the necessary methods. This base class is abstract and never implemented, only the derivate classes are. All the members of this class are protected except the destructor according to the OpenMASK precepts.
This class defines all the items to create an interactive, interactor or inspector object.
See the introduction to the interaction protocols

Definition at line 53 of file OMKInteractorExtension.h.


Constructor & Destructor Documentation

InteractorExtension::~InteractorExtension (  )  [virtual]

Destructor of InteractorObject.

Definition at line 88 of file OMKInteractorExtension.cpp.

References _accessibleConnectorsListener, _controlEndedListener, _controlReleasedByListener, _controlReleasedListener, _controlTakenByListener, _currentValuesSentAndControlTakenListener, _currentValuesSentListener, _interactorOutputs, and closeAllSessions().

00089 {
00090   //Removes event listener
00091   delete _accessibleConnectorsListener ;
00092   delete _currentValuesSentAndControlTakenListener ;
00093   delete _controlReleasedListener ;
00094   delete _controlEndedListener ;
00095   delete _controlTakenByListener ;
00096   delete _controlReleasedByListener ;
00097   delete _currentValuesSentListener ;
00098   
00099   // Destroy each session
00100   closeAllSessions() ;
00101 
00102   // Destroy each connector, which will disconnect its associated input
00103   for ( InteractorOutputsMap::const_iterator i = _interactorOutputs.begin() ; i !=  _interactorOutputs.end() ; ++i )
00104   {
00105     delete i->second ;
00106   }
00107   // Finally clears the map 
00108   _interactorOutputs.clear() ;
00109 }

InteractorExtension::InteractorExtension ( ExtensibleSimulatedObject owner,
const Name id,
bool  registerExtension = true 
) [protected]

Protected constructor of InteractorObject call by derivate classes.

Definition at line 41 of file OMKInteractorExtension.cpp.

References OMK::Extension::_id, OMK::ExtensionT< SimulatedObjectType >::_owner, OMK::IAttribute::createOutput(), OMK::debugMsg(), OMK::Name::getCString(), OMK::ConfigurationParameterDescriptor::getNumberOfSubItems(), OMK::IAttribute::getOutput(), OMK::ConfigurationParameterDescriptor::getSubDescriptorByName(), OMK_DEBUG_III, and OMTRACEID.

00042 : ExtensionT< ExtensibleSimulatedObject >( owner, id, registerExtension ),
00043   _access( "", 1 ),
00044   _accessibleConnectorsListener( 0 ),
00045   _currentValuesSentAndControlTakenListener( 0 ),
00046   _controlReleasedListener( 0 ),
00047   _controlEndedListener( 0 ),
00048   _controlTakenByListener( 0 ),
00049   _controlReleasedByListener( 0 ),
00050   _currentValuesSentListener( 0 )
00051 {
00052   // To be sure that there is an output all the interactor output are scanned
00053   const ConfigurationParameterDescriptor * node = _owner->getObjectDescriptor().getExtensionsParameters() ;
00054   const ConfigurationParameterDescriptor * extNode = node ? node->getSubDescriptorByName( _id.getCString() ) : 0 ;
00055   const ConfigurationParameterDescriptor * outputNode = extNode ? extNode->getSubDescriptorByName( "Outputs" ) : 0 ;
00056   if( outputNode )
00057   {
00058     int nbItems = outputNode->getNumberOfSubItems() ;
00059     OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner ) << " has " << nbItems << " outputs" ) ;
00060     for( int i = 0 ; i < nbItems ; ++i )
00061     { 
00062       // Retrieves parameters sets for each interactor output
00063       Name id( static_cast<const MultipleConfigurationParameter *>( outputNode )->getNameOfSubDescriptor( i ) ) ;
00064       IAttribute* attribute = _owner->getAttribute( id ) ;
00065       if( attribute )
00066       {
00067         // To be sure that there is an output
00068         attribute->createOutput() ;
00069         OMTRACEID( OMK_DEBUG_III, ( attribute->getOutput() ? ":-)" : ":-(" ) << " Create the output for \"" << id << "\" !" ) ; 
00070       }
00071       else
00072       {
00073         OMTRACEID( OMK_DEBUG_III, ":-( Error the interactor " <<  OMK::debugMsg( this, _owner ) << std::endl
00074                  << ">>> Unable to create the output for \"" << id << "\" because this attribute doesn't exist !" ) ; 
00075       }
00076     }
00077   }
00078   else
00079   {
00080     OMTRACEID( OMK_DEBUG_III, ":-( Error the interactor " <<  OMK::debugMsg( this, _owner ) << std::endl
00081               << ">>> Unable to find the output node !" ) ; 
00082   }
00083 }

InteractorExtension::~InteractorExtension (  )  [virtual]

Destructor of InteractorObject.

Definition at line 88 of file OMKInteractorExtension.cpp.

References _accessibleConnectorsListener, _controlEndedListener, _controlReleasedByListener, _controlReleasedListener, _controlTakenByListener, _currentValuesSentAndControlTakenListener, _currentValuesSentListener, _interactorOutputs, and closeAllSessions().

00089 {
00090   //Removes event listener
00091   delete _accessibleConnectorsListener ;
00092   delete _currentValuesSentAndControlTakenListener ;
00093   delete _controlReleasedListener ;
00094   delete _controlEndedListener ;
00095   delete _controlTakenByListener ;
00096   delete _controlReleasedByListener ;
00097   delete _currentValuesSentListener ;
00098   
00099   // Destroy each session
00100   closeAllSessions() ;
00101 
00102   // Destroy each connector, which will disconnect its associated input
00103   for ( InteractorOutputsMap::const_iterator i = _interactorOutputs.begin() ; i !=  _interactorOutputs.end() ; ++i )
00104   {
00105     delete i->second ;
00106   }
00107   // Finally clears the map 
00108   _interactorOutputs.clear() ;
00109 }

InteractorExtension::InteractorExtension ( ExtensibleSimulatedObject owner,
const Name id,
bool  registerExtension = true 
) [protected]

Protected constructor of InteractorObject call by derivate classes.

Definition at line 41 of file OMKInteractorExtension.cpp.

References OMK::Extension::_id, OMK::ExtensionT< SimulatedObjectType >::_owner, OMK::IAttribute::createOutput(), OMK::debugMsg(), OMK::Name::getCString(), OMK::ConfigurationParameterDescriptor::getNumberOfSubItems(), OMK::IAttribute::getOutput(), OMK::ConfigurationParameterDescriptor::getSubDescriptorByName(), OMK_DEBUG_III, and OMTRACEID.

00042 : ExtensionT< ExtensibleSimulatedObject >( owner, id, registerExtension ),
00043   _access( "", 1 ),
00044   _accessibleConnectorsListener( 0 ),
00045   _currentValuesSentAndControlTakenListener( 0 ),
00046   _controlReleasedListener( 0 ),
00047   _controlEndedListener( 0 ),
00048   _controlTakenByListener( 0 ),
00049   _controlReleasedByListener( 0 ),
00050   _currentValuesSentListener( 0 )
00051 {
00052   // To be sure that there is an output all the interactor output are scanned
00053   const ConfigurationParameterDescriptor * node = _owner->getObjectDescriptor().getExtensionsParameters() ;
00054   const ConfigurationParameterDescriptor * extNode = node ? node->getSubDescriptorByName( _id.getCString() ) : 0 ;
00055   const ConfigurationParameterDescriptor * outputNode = extNode ? extNode->getSubDescriptorByName( "Outputs" ) : 0 ;
00056   if( outputNode )
00057   {
00058     int nbItems = outputNode->getNumberOfSubItems() ;
00059     OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner ) << " has " << nbItems << " outputs" ) ;
00060     for( int i = 0 ; i < nbItems ; ++i )
00061     { 
00062       // Retrieves parameters sets for each interactor output
00063       Name id( static_cast<const MultipleConfigurationParameter *>( outputNode )->getNameOfSubDescriptor( i ) ) ;
00064       IAttribute* attribute = _owner->getAttribute( id ) ;
00065       if( attribute )
00066       {
00067         // To be sure that there is an output
00068         attribute->createOutput() ;
00069         OMTRACEID( OMK_DEBUG_III, ( attribute->getOutput() ? ":-)" : ":-(" ) << " Create the output for \"" << id << "\" !" ) ; 
00070       }
00071       else
00072       {
00073         OMTRACEID( OMK_DEBUG_III, ":-( Error the interactor " <<  OMK::debugMsg( this, _owner ) << std::endl
00074                  << ">>> Unable to create the output for \"" << id << "\" because this attribute doesn't exist !" ) ; 
00075       }
00076     }
00077   }
00078   else
00079   {
00080     OMTRACEID( OMK_DEBUG_III, ":-( Error the interactor " <<  OMK::debugMsg( this, _owner ) << std::endl
00081               << ">>> Unable to find the output node !" ) ; 
00082   }
00083 }


Member Function Documentation

bool InteractorExtension::loadExtensionParameters ( const ConfigurationParameterDescriptor node  )  [protected, virtual]

This method initialises the interactor.

Load the parameters to create the interactor outputs.

Reimplemented from OMK::Extension.

Reimplemented in OMK::Iii::JointInteractorExtension.

Definition at line 112 of file OMKInteractorExtension.cpp.

References _access, OMK::Type::AccessGroup::_groupName, OMK::Type::AccessGroup::_level, OMK::ExtensionT< SimulatedObjectType >::_owner, OMK::Iii::InteractorOutput::create(), OMK::debugMsg(), OMK::ParametersAccessor::get(), OMK::ConfigurationParameterDescriptor::getNumberOfSubItems(), OMK::ConfigurationParameterDescriptor::getSubDescriptorByName(), OMK_DEBUG_III, OMTRACEID, and startInteractor().

00113 {
00114   bool ok = true ;
00115 
00116   ParametersAccessor::get( node, "Level", _access._level ) ; 
00117   ok = ParametersAccessor::get( node, "Group", _access._groupName ) && ok ; 
00118   OMTRACEID( OMK_DEBUG_III, "The interactor" <<  OMK::debugMsg( this, _owner ) 
00119                          << " is in the group \"" << _access._groupName 
00120                          << "\" and has the level " << _access._level ) ;
00121 
00122   startInteractor() ;
00123 
00124   const ConfigurationParameterDescriptor * outputNode = node->getSubDescriptorByName( "Outputs" ) ;
00125   if( outputNode )
00126   {
00127     int nbItems = outputNode->getNumberOfSubItems() ;
00128     OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner ) << " has " << nbItems << " outputs" ) ;
00129     for( int i = 0 ; i < nbItems && ok ; ++i )
00130     { 
00131       // Retrieves parameters sets for each interactor output
00132       Name id( static_cast<const MultipleConfigurationParameter *>( outputNode )->getNameOfSubDescriptor( i ) ) ;
00133       const ConfigurationParameterDescriptor * outputParameters = outputNode->getSubDescriptorByPosition( i ) ;
00134       ok = InteractorOutput::create( id, this, outputParameters ) && ok ;
00135     }
00136   }
00137 
00138   return ok  ;
00139 }

void InteractorExtension::startInteractor (  )  [protected, virtual]

This method initialises the interactor mode of the object.

Initialising the interactor mode is to create the appropriate event listeners.

Definition at line 142 of file OMKInteractorExtension.cpp.

References _accessibleConnectorsListener, _controlEndedListener, _controlReleasedByListener, _controlReleasedListener, _controlTakenByListener, _currentValuesSentAndControlTakenListener, _currentValuesSentListener, OMK::ExtensionT< SimulatedObjectType >::_owner, OMK::EventId::ACCESSIBLE_PARAMETERS, OMK::EventId::CONTROL_ENDED, OMK::EventId::CONTROL_RELEASED, OMK::EventId::CONTROL_RELEASED_BY, OMK::EventId::CONTROL_TAKEN_BY, OMK::EventId::CURRENT_VALUES_SENT, OMK::EventId::CURRENT_VALUES_SENT_AND_CONTROL_TAKEN, processAccessibleParameters(), processControlEnded(), processControlReleased(), processControlReleasedBy(), processControlTakenBy(), processCurrentValuesSent(), and processCurrentValuesSentAndControlTaken().

Referenced by OMK::Iii::JointInteractorExtension::loadExtensionParameters(), and loadExtensionParameters().

00143 {
00144   if( !_accessibleConnectorsListener )
00145   { 
00146     // The event listener is not already created => adds it
00147     _accessibleConnectorsListener = new Type::AccessibleParametersListEventListener
00148       ( *_owner, this, 
00149         &InteractorExtension::processAccessibleParameters, 
00150         EventId::ACCESSIBLE_PARAMETERS ) ;
00151     _currentValuesSentAndControlTakenListener = new ControlTakenEventListener
00152       ( *_owner, this, 
00153          &InteractorExtension::processCurrentValuesSentAndControlTaken, 
00154         EventId::CURRENT_VALUES_SENT_AND_CONTROL_TAKEN ) ;
00155     _controlReleasedListener = new ControlEndedEventListener
00156       (  *_owner, this, 
00157          &InteractorExtension::processControlReleased,
00158          EventId::CONTROL_RELEASED ) ;
00159     _controlEndedListener = new ControlEndedEventListener
00160       ( *_owner, this, 
00161         &InteractorExtension::processControlEnded, 
00162         EventId::CONTROL_ENDED ) ;
00163     _controlTakenByListener = new ControlUpdatedEventListener
00164       ( *_owner, this, 
00165         &InteractorExtension::processControlTakenBy, 
00166         EventId::CONTROL_TAKEN_BY ) ;
00167     _controlReleasedByListener = new ControlUpdatedEventListener
00168       ( *_owner, this, 
00169         &InteractorExtension::processControlReleasedBy, 
00170         EventId::CONTROL_RELEASED_BY ) ;
00171     _currentValuesSentListener = new EventListenerCallBack< InteractorExtension >
00172       ( *_owner, this, 
00173         &InteractorExtension::processCurrentValuesSent, 
00174         EventId::CURRENT_VALUES_SENT ) ;
00175   }
00176 }

void InteractorExtension::startSessionWith ( const Name interactiveObject  )  [virtual]

Method to start a new session.

Parameters:
[in] interactiveObject The id of the interactive object the interactor wants to interact with.
With createSession method creates a new session and adds it to the map of sessions, then starts the dialog with the interactive object by asking its parameters.

This method is a virtual and can be defined in sons. The son must create create a new session, add it to the map. The son chooses the type and the behavior of the session to be created.

If you only want to use an other type of session instead of the standard one, you should overwrite the protected method createSession instead of this one.

Definition at line 179 of file OMKInteractorExtension.cpp.

References OMK::ExtensionT< SimulatedObjectType >::_owner, _sessionsPrm, createSession(), OMK::debugMsg(), OMK::Iii::getAccessibleParameters(), OMK::Iii::SessionPrm::getInteractiveObject(), getSessionWith(), OMK_DEBUG_III, and OMTRACEID.

Referenced by OMK::Iii::JointInteractorExtension::startRetroPropagation().

00180 { 
00181   if( !getSessionWith( interactiveObject ) )
00182   {
00183     OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner ) << " starts session with \"" <<  interactiveObject << "\"") ;
00184     // Add a new session
00185     SessionPrm* session = createSession( interactiveObject ) ;
00186     if( session )
00187     {
00188       _sessionsPrm.insert( std::pair< const Name, SessionPrm* >( session->getInteractiveObject(), session ) ) ;
00189       // Asks for parameters => init will be call if the interactive object answers with the list of its parameters
00190       (*session).c( getAccessibleParameters ) ;
00191     }
00192   }
00193   else
00194   {
00195     OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner )
00196                << " doesn't need to start a session with interactive object \"" <<  interactiveObject << "\", session already exists" ) ;
00197   }
00198 }

void InteractorExtension::closeSessionWith ( const Name interactiveObject  )  [virtual]

Method to close a session.

Parameters:
[in] interactiveObject The id of the interactive object in interaction.
Releases the control and destroys the session parameters.

Definition at line 208 of file OMKInteractorExtension.cpp.

References OMK::ExtensionT< SimulatedObjectType >::_owner, _sessionsPrm, OMK::Iii::controlRelease(), OMK::debugMsg(), getSessionWith(), OMK_DEBUG_III, and OMTRACEID.

Referenced by closeAllSessions().

00209 { 
00210   SessionPrm* session = getSessionWith( interactiveObject ) ;
00211   if( session )
00212   {
00213     OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner ) << " stops session with " <<  interactiveObject ) ;
00214     // Releases the interactive object, erases session from map, and destroys it
00215     (*session).c( controlRelease ) ;
00216     _sessionsPrm.erase( interactiveObject ) ;
00217     delete session ;
00218   }
00219 }

SessionPrm * InteractorExtension::getSessionWith ( const Name interactiveObject  ) 

Method to retrieve the session associated with the interactive object.

Parameters:
[in] interactiveObject The id of the interactive object in interaction.
Returns:
The session parameters associated to the interaction with the interactive object or null if the interactor is not in interaction with this object id.

Definition at line 231 of file OMKInteractorExtension.cpp.

References _sessionsPrm.

Referenced by closeSessionWith(), processAccessibleParameters(), OMK::Iii::InteractorOutputT< PrmType, ModelType >::processSetValue(), OMK::Iii::JointInteractorExtension::startRetroPropagation(), startSessionWith(), and OMK::Iii::JointInteractorExtension::stopRetroPropagation().

00232 {
00233   SessionsMap::const_iterator session = _sessionsPrm.find( interactiveObject ) ;
00234   return ( session != _sessionsPrm.end() ) ? session->second : 0 ;
00235 }

void InteractorExtension::closeAllSessions (  ) 

Method to close all the sessions.

Releases the control and destroys the all the sessions parameters.

Definition at line 222 of file OMKInteractorExtension.cpp.

References _sessionsPrm, and closeSessionWith().

Referenced by ~InteractorExtension().

00223 {
00224   for ( SessionsMap::const_iterator i = _sessionsPrm.begin() ; i != _sessionsPrm.end() ; i = _sessionsPrm.begin() )
00225   {
00226     closeSessionWith( i->first ) ;
00227   }
00228 }

SessionPrm * InteractorExtension::createSession ( const Name interactiveObject  )  [protected, virtual]

Method to create a new session.

Parameters:
[in] interactiveObject The id of the interactive object the interactor wants to interact with.
Creates a new standard session parameters.

This method is a virtual and can be defined in sons. The son can create a new type of session.

Definition at line 201 of file OMKInteractorExtension.cpp.

References OMK::Iii::SessionPrm::create().

Referenced by startSessionWith().

00202 {
00203   // return the standard session (can be nul if interactiveObject is not a simulated object)
00204   return SessionPrm::create( this, interactiveObject ) ;
00205 }

ExtensibleSimulatedObject* OMK::Iii::InteractorExtension::getInteractor (  )  [inline]

Definition at line 129 of file OMKInteractorExtension.h.

Referenced by OMK::Iii::InteractorOutput::create(), OMK::Iii::SessionPrm::selfControlRelease(), OMK::Iii::SessionPrm::selfControlTakeOverAndGetCurrentValues(), and OMK::Iii::SessionPrm::selfGetAccessibleParameters().

00129 { return _owner ; }

OMK::Type::AccessLevel OMK::Iii::InteractorExtension::getAccessLevel (  )  const [inline]

Get the access level of the interactor.

Returns:
the access level of the interactor, see _access.

Definition at line 132 of file OMKInteractorExtension.h.

Referenced by OMK::Iii::SessionPrm::selfControlTakeOverAndGetCurrentValues(), and OMK::Iii::SessionPrm::selfGetAccessibleParameters().

00132 { return _access._level ; }

void OMK::Iii::InteractorExtension::setAccessLevel ( OMK::Type::AccessLevel  level = 0  )  [inline]

Set the access level of the interactor.

Parameters:
[in] level See _access.

Definition at line 135 of file OMKInteractorExtension.h.

00135 { _access._level = level ; }

const OMK::Name& OMK::Iii::InteractorExtension::getGroup (  )  const [inline]

Get the group name of the interactor.

Returns:
the group name of the interactor, see _access.

Definition at line 138 of file OMKInteractorExtension.h.

Referenced by OMK::Iii::SessionPrm::selfControlTakeOverAndGetCurrentValues(), and OMK::Iii::SessionPrm::selfGetAccessibleParameters().

00138 { return _access._groupName ; }

void OMK::Iii::InteractorExtension::setGroup ( const OMK::Name name  )  [inline]

Set the group name of the interactor.

Parameters:
[in] name See _access.

Definition at line 141 of file OMKInteractorExtension.h.

00141 { _access._groupName = name ; }

const OMK::Type::AccessGroup& OMK::Iii::InteractorExtension::getAccessGroup (  )  const [inline]

Definition at line 143 of file OMKInteractorExtension.h.

00143 { return _access ; }

bool InteractorExtension::processAccessibleParameters ( Type::AccessibleParametersListEvent *  event  )  [protected, virtual]

Process the "available_connectors" event.

This event is a answer coming from the interactive object to question of the associated. This answer is a valued event with the list of available connectors.

This message is the first in the protocol, it initializes the dialog between the interactor and an interactive object. The session parameters are initialized here, see SessionPrm::init and "available connectors".

Definition at line 238 of file OMKInteractorExtension.cpp.

References _interactorOutputs, OMK::ExtensionT< SimulatedObjectType >::_owner, OMK::EventId::ACCESSIBLE_PARAMETERS, OMK::debugMsg(), getSessionWith(), OMK::Iii::SessionPrm::init(), OMASSERTM, OMK_DEBUG_III, and OMTRACEID.

Referenced by startInteractor().

00239 {
00240   OMASSERTM( event->eventId == EventId::ACCESSIBLE_PARAMETERS, "The event must be \"" << EventId::ACCESSIBLE_PARAMETERS << "\" but is \"" << event->eventId << "\"" ) ;
00241   SessionPrm* session = getSessionWith( event->sender ) ;
00242   OMTRACEID( OMK_DEBUG_III, "The interactor " <<  OMK::debugMsg( this, _owner ) << " received the connectors list from \"" << event->sender << "\"" << ( session ? "" : " but it is not interacting with it !" ) ) ;
00243   if( session )
00244   {
00245     session->init( _interactorOutputs, event->value ) ;
00246   }
00247   return session != 0 ;
00248 }

virtual bool OMK::Iii::InteractorExtension::processCurrentValuesSentAndControlTaken ( Type::ControlTakenEvent *  event  )  [protected, virtual]

Process the "control_taken" event.

This event is a answer coming form the interactive object to the "control take over" action. This answer is a valued event with the list of actually controlled connectors.

This message is a feed back for the interactor to know which connectors it is controlling actually. The default behavior for this message processing is to update the list of outputs which control connectors. This method should be overwritten to change this behavior, see "control taken".

Referenced by startInteractor().

virtual bool OMK::Iii::InteractorExtension::processControlReleased ( Type::ControlReleasedEvent *  event  )  [protected, virtual]

Process the "control_released" event.

This event is sent by the interactive object to the interactor when it has finished to process a "control_release" event previously sent by the interactor. This event acts as a acknowledgment for the event "control_release". This event contains id of the connector that is no more controlled. See "control ended".

Referenced by startInteractor().

virtual bool OMK::Iii::InteractorExtension::processControlEnded ( Type::ControlEndedEvent *  event  )  [protected, virtual]

Process the "control_ended" event.

This event is an information coming from the interactive object. This information is a valued event with the id of the connector that is no more controlled.

This message is a feed back for the interactor to know which connectors it is controlling actually. The default behavior for this message processing is to update the list of outputs which control connectors. This method should be overwritten to change this behavior, see "control ended".

Referenced by startInteractor().

virtual bool OMK::Iii::InteractorExtension::processControlTakenBy ( Type::ControlUpdatedEvent *  event  )  [protected, virtual]

Referenced by startInteractor().

virtual bool OMK::Iii::InteractorExtension::processControlReleasedBy ( Type::ControlUpdatedEvent *  event  )  [protected, virtual]

Referenced by startInteractor().

bool InteractorExtension::processCurrentValuesSent ( Event event  )  [protected, virtual]

Process the "current_values_sent" event.

Should be overwritten by sons classes. Do nothing by default.

Definition at line 296 of file OMKInteractorExtension.cpp.

References OMK::EventId::CURRENT_VALUES_SENT, OMK::Event::eventId, and OMASSERTM.

Referenced by startInteractor().

00297 {
00298   OMASSERTM( event->eventId == EventId::CURRENT_VALUES_SENT, "The event must be \"" << EventId::CURRENT_VALUES_SENT << "\" but is \"" << event->eventId << "\"" ) ;
00299   return true ; 
00300 }

void InteractorExtension::addInteractorOutput ( InteractorOutput interactorOutput  ) 

Method to add output connectors.

The output connector will be added the map of output connectors.

Definition at line 314 of file OMKInteractorExtension.cpp.

References _interactorOutputs, OMK::Iii::InteractorOutput::category(), and OMK::Iii::InteractorOutput::type().

Referenced by OMK::Iii::InteractorOutput::create().

00315 {
00316   _interactorOutputs.insert( std::pair< InteractorOutputsIndex, InteractorOutput* >( InteractorOutputsIndex( interactorOutput->category(), interactorOutput->type() ), interactorOutput ) ) ;
00317 }


Member Data Documentation

SessionsMap OMK::Iii::InteractorExtension::_sessionsPrm [protected]

Map of session parameters.

This map stores the session parameters for each interactive object in interaction with the associated interactor. It is indexed by interactive object id.

Definition at line 126 of file OMKInteractorExtension.h.

Referenced by closeAllSessions(), closeSessionWith(), getSessionWith(), and startSessionWith().

OMK::Type::AccessGroup OMK::Iii::InteractorExtension::_access [protected]

Level access and group of the interactor.

This value indicates the access level to the parameters. Only interactor with an appropriate access level will be able to see the parameters. A parameter with an access level of 10 will be seen only by interactors of level 10 or more, with an access level of 1, it will be seen by any interactors.
This level can be change with setAccessLevel and read by getAccessLevel. This name indicates the group of the interactor. Only interactors with an appropriate group and access level will be able to see the parameters. This group can be change with setGroup and read by getGroup.

Definition at line 156 of file OMKInteractorExtension.h.

Referenced by OMK::Iii::JointInteractorExtension::JointInteractorExtension(), OMK::Iii::JointInteractorExtension::loadExtensionParameters(), and loadExtensionParameters().

EventListener* OMK::Iii::InteractorExtension::_accessibleConnectorsListener [protected]

Pointer to aggregate the "accessible connectors" listener.

Definition at line 161 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

EventListener* OMK::Iii::InteractorExtension::_currentValuesSentAndControlTakenListener [protected]

Pointer to aggregate the "control taken and get current values sent" listener.

Definition at line 163 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

EventListener* OMK::Iii::InteractorExtension::_controlReleasedListener [protected]

Pointer to aggregate the "control released" listener.

Definition at line 165 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

EventListener* OMK::Iii::InteractorExtension::_controlEndedListener [protected]

Pointer to aggregate the "control ended" listener.

Definition at line 167 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

EventListener* OMK::Iii::InteractorExtension::_controlTakenByListener [protected]

Pointer to aggregate the "control taken by" listener.

Definition at line 169 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

EventListener* OMK::Iii::InteractorExtension::_controlReleasedByListener [protected]

Pointer to aggregate the "control released by" listener.

Definition at line 171 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

EventListener* OMK::Iii::InteractorExtension::_currentValuesSentListener [protected]

Pointer to aggregate the "current values sent" listener.

Definition at line 173 of file OMKInteractorExtension.h.

Referenced by startInteractor(), and ~InteractorExtension().

InteractorOutputsMap OMK::Iii::InteractorExtension::_interactorOutputs [protected]

Output connectors map.

Definition at line 224 of file OMKInteractorExtension.h.

Referenced by addInteractorOutput(), processAccessibleParameters(), and ~InteractorExtension().


logo OpenMask

Documentation generated on Mon Jun 9 11:46:04 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007