OMK::Inp::AddInputListenerPrm Class Reference
[User inputs]

Event to add a keyboard/mouse/joystick listener. More...

#include <OMKAddInputListenerPrm.h>

Inheritance diagram for OMK::Inp::AddInputListenerPrm:

Inheritance graph
[legend]
Collaboration diagram for OMK::Inp::AddInputListenerPrm:

Collaboration graph
[legend]
List of all members.

Reset and loaders

virtual void resetDefaultValues ()
 Reset the default values of AddInputListenerPrm.
virtual bool loadParameters (const ConfigurationParameterDescriptor *node, const std::string &prefix="", SimulatedObject *p=0)
 Configuration parameters loader of AddInputListenerPrm.
bool innerParametersLoader (const ConfigurationParameterDescriptor *node, const std::string &prefix="", SimulatedObject *p=0)
 Protected loader, does not reset the default values.

Public Member Functions

Accessors to attributes.
void setListenerId (const std::string &listenerId)
 Set the listenerId value of AddVisualObjectPrm.
const std::string & getListenerId () const
 Return the listenerId value of AddVisualObjectPrm.
void setClassId (const Name &classId)
 Set the classId value of AddInputListenerPrm.
const NamegetClassId () const
 Return the classId value of AddInputListenerPrm.
void setVisBase (const std::string &visBase)
 Set the VisBase value of AddInputListenerPrm.
const std::string & getVisBase () const
 Return the VisBase value of AddInputListenerPrm.
void setConfigParam (const ConfigurationParameterDescriptor *configParam)
 Set the configParam value of AddInputListenerPrm.
const ConfigurationParameterDescriptorgetConfigParam () const
 Return the configParam value of AddInputListenerPrm.
Operators.
bool operator== (const AddInputListenerPrm &ref) const
 Comparison operator for equality.
bool operator!= (const AddInputListenerPrm &ref) const
 Comparison operator for difference.
AddInputListenerPrmoperator= (const AddInputListenerPrm &ref)
 Copy operator.
Packable, Flowable, OMKType interfaces.
virtual void insertInStream (std::ostream &=std::cout) const
 Insert datas in an output stream.
virtual void extract (std::istream &=std::cin)
 Extract datas from an input stream.
virtual void pack (OutgoingSynchronisationMessage &out) const
 Pack datas in the message.
virtual void unpack (IncomingSynchronisationMessage &in)
 Unpack datas from the message.
virtual OMK::Type::PolatorNTcreatePolator ()
 Default polator creator.

Protected Member Functions

void _copy (const AddInputListenerPrm &ref)
 Copy methods call by constructor and operator.

Protected Attributes

Datas
std::string _listenerId
 This member holds the ObjectName value of AddVisualObjectPrm.
Name _classId
 This member holds the ClassId value of AddInputListenerPrm.
std::string _visBase
 This member holds the VisBase value of AddInputListenerPrm.
const ConfigurationParameterDescriptor_configParam
 This member holds the configParam value of AddInputListenerPrm.

Detailed Description

Event to add a keyboard/mouse/joystick listener.

Date:
2007-02-14
Author:
Benoît Chanclou
Module description :

Definition at line 47 of file OMKAddInputListenerPrm.h.


Constructor & Destructor Documentation

AddInputListenerPrm::AddInputListenerPrm (  ) 

Default constructor ofAddInputListenerPrm.

Definition at line 36 of file OMKAddInputListenerPrm.cpp.

References OMTRACE.

00037 : Base(),
00038   _classId(),
00039   _visBase( "" ),
00040   _configParam( 0 )
00041 {
00042   OMTRACE( ":-) In AddInputListenerPrm::AddInputListenerPrm default constructor" << std::endl ) ;
00043 }

AddInputListenerPrm::AddInputListenerPrm ( const AddInputListenerPrm ref  ) 

Copy constructor of AddInputListenerPrm.

Definition at line 47 of file OMKAddInputListenerPrm.cpp.

References _copy(), and OMTRACE.

00048 : Base(),
00049 _configParam( 0 )
00050 {
00051   OMTRACE( ":-) In AddInputListenerPrm::AddInputListenerPrm copy constructor" << std::endl ) ;
00052   _copy( ref ) ;
00053 }

AddInputListenerPrm::AddInputListenerPrm ( const std::string &  listenerId,
const Name classId,
const std::string &  VisBase,
const ConfigurationParameterDescriptor configParam 
)

Constructor of AddInputListenerPrm with all the parameters.

Definition at line 57 of file OMKAddInputListenerPrm.cpp.

References OMTRACE.

00061 : Base(),
00062   _listenerId( listenerId ) ,
00063   _classId( classId ) ,
00064   _visBase( visBase ) ,
00065   _configParam( configParam ? configParam->clone() : 0 ) 
00066 {
00067   OMTRACE( ":-) In AddInputListenerPrm::AddInputListenerPrm constructor with parameters" << std::endl ) ;
00068 }

AddInputListenerPrm::~AddInputListenerPrm (  )  [virtual]

Destructor of AddInputListenerPrm.

Definition at line 72 of file OMKAddInputListenerPrm.cpp.

References _configParam, and OMTRACE.

00073 {
00074   OMTRACE( ":-) In AddInputListenerPrm::~AddInputListenerPrm" << std::endl );
00075   delete _configParam ;
00076   OMTRACE( ">>> Configuration parameters deleted" << std::endl ) ;
00077 }

AddInputListenerPrm::AddInputListenerPrm (  ) 

Default constructor ofAddInputListenerPrm.

Definition at line 36 of file OMKAddInputListenerPrm.cpp.

References OMTRACE.

00037 : Base(),
00038   _classId(),
00039   _visBase( "" ),
00040   _configParam( 0 )
00041 {
00042   OMTRACE( ":-) In AddInputListenerPrm::AddInputListenerPrm default constructor" << std::endl ) ;
00043 }

AddInputListenerPrm::AddInputListenerPrm ( const AddInputListenerPrm ref  ) 

Copy constructor of AddInputListenerPrm.

Definition at line 47 of file OMKAddInputListenerPrm.cpp.

References _copy(), and OMTRACE.

00048 : Base(),
00049 _configParam( 0 )
00050 {
00051   OMTRACE( ":-) In AddInputListenerPrm::AddInputListenerPrm copy constructor" << std::endl ) ;
00052   _copy( ref ) ;
00053 }

AddInputListenerPrm::AddInputListenerPrm ( const std::string &  listenerId,
const Name classId,
const std::string &  VisBase,
const ConfigurationParameterDescriptor configParam 
)

Constructor of AddInputListenerPrm with all the parameters.

Definition at line 57 of file OMKAddInputListenerPrm.cpp.

References OMTRACE.

00061 : Base(),
00062   _listenerId( listenerId ) ,
00063   _classId( classId ) ,
00064   _visBase( visBase ) ,
00065   _configParam( configParam ? configParam->clone() : 0 ) 
00066 {
00067   OMTRACE( ":-) In AddInputListenerPrm::AddInputListenerPrm constructor with parameters" << std::endl ) ;
00068 }

AddInputListenerPrm::~AddInputListenerPrm (  )  [virtual]

Destructor of AddInputListenerPrm.

Definition at line 72 of file OMKAddInputListenerPrm.cpp.

References _configParam, and OMTRACE.

00073 {
00074   OMTRACE( ":-) In AddInputListenerPrm::~AddInputListenerPrm" << std::endl );
00075   delete _configParam ;
00076   OMTRACE( ">>> Configuration parameters deleted" << std::endl ) ;
00077 }


Member Function Documentation

void AddInputListenerPrm::resetDefaultValues (  )  [virtual]

Reset the default values of AddInputListenerPrm.

Definition at line 81 of file OMKAddInputListenerPrm.cpp.

References _classId, _configParam, _visBase, and OMTRACE.

Referenced by loadParameters().

00082 {
00083   OMTRACE( ":-) In AddInputListenerPrm::resetDefaultValues" << std::endl ) ;
00084   //=== Reset default parameters
00085   _classId = "" ;
00086   _visBase = std::string( "" ) ;
00087   delete _configParam ;
00088   _configParam = 0 ;
00089   OMTRACE( ">>> All parameters reseted"  << std::endl );
00090 }

bool AddInputListenerPrm::loadParameters ( const ConfigurationParameterDescriptor node,
const std::string &  prefix = "",
SimulatedObject p = 0 
) [virtual]

Configuration parameters loader of AddInputListenerPrm.

Parameters:
[in] node the root node of the configuration parameter
[in] prefix the text that prefix the parameters name. No prefix by default. For example the parameter named "position" by default is loaded in the configuration parameters under the name "Position" (first is upper case), and with the prefix "first" will be loaded under the name "firstPosition" (could start with a lower case).
[in] p the simulated object use by the OMKParameterAccessor to display error messages.
Returns:
true if all needed parameters can be read else false.
Reads in the configuration node the values to set the attributs.

Definition at line 94 of file OMKAddInputListenerPrm.cpp.

References innerParametersLoader(), OMTRACE, and resetDefaultValues().

00097 {
00098   OMTRACE( ":-) In AddInputListenerPrm::loadParameters" << std::endl ) ;
00099   resetDefaultValues() ;
00100   return innerParametersLoader( node, prefix, p );
00101 }

bool AddInputListenerPrm::innerParametersLoader ( const ConfigurationParameterDescriptor node,
const std::string &  prefix = "",
SimulatedObject p = 0 
) [protected]

Protected loader, does not reset the default values.

Definition at line 105 of file OMKAddInputListenerPrm.cpp.

References _classId, _configParam, _listenerId, _visBase, OMK::ConfigurationParameterDescriptor::clone(), OMK::debugMsg(), OMK::ParametersAccessor::get(), OMERROR, and OMTRACE.

Referenced by loadParameters().

00106 {
00107   OMTRACE( ":-) In AddInputListenerPrm::innerParametersLoader" << std::endl ) ;
00108   // Tests the configuration parameter node
00109   if( !node )
00110   { // No valid node => display error message and return false
00111     std::ostringstream txt ;
00112     txt << "Error in AddInputListenerPrm::innerParametersLoader";
00113     if( p ) txt << " for " << OMK::debugMsg( p ) ;
00114     txt << std::endl << ">>> :-( Invalid node" << std::endl ; 
00115     OMERROR( txt.str() ) ;
00116     return false ;
00117   }
00118   // return value
00119   bool ok = true ;
00120 
00121   //=== The optional parameters => no test
00122   // Load the value of VisBase
00123   ParametersAccessor::get( node, prefix + "VisBase", _visBase ) ;
00124   // Load the value of ObjectName
00125   ParametersAccessor::get( node, prefix + "ObjectName", _listenerId ) ;
00126 
00127   //=== The needed parameters => tested
00128   // Load the value of ClassId
00129   ok = ParametersAccessor::get( node, prefix + "ClassId", _classId, p ) && ok ;
00130   // store the value of ConfigParam
00131   _configParam = node->clone() ;
00132 
00133   OMTRACE( ":-) In AddInputListenerPrm::innerParametersLoader" << std::endl << *this << std::endl ) ;
00134 
00135   return ok ;
00136 }

void OMK::Inp::AddInputListenerPrm::setListenerId ( const std::string &  listenerId  )  [inline]

Set the listenerId value of AddVisualObjectPrm.

Definition at line 95 of file OMKAddInputListenerPrm.h.

00095 { _listenerId = listenerId ; }

const std::string& OMK::Inp::AddInputListenerPrm::getListenerId (  )  const [inline]

Return the listenerId value of AddVisualObjectPrm.

Definition at line 97 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), OMK::Inp::InputExtension::addListener(), insertInStream(), operator!=(), and pack().

00097 { return _listenerId ; }

void OMK::Inp::AddInputListenerPrm::setClassId ( const Name classId  )  [inline]

Set the classId value of AddInputListenerPrm.

Definition at line 100 of file OMKAddInputListenerPrm.h.

00100 { _classId = classId ; }

const Name& OMK::Inp::AddInputListenerPrm::getClassId (  )  const [inline]

Return the classId value of AddInputListenerPrm.

Definition at line 102 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), OMK::Inp::InputExtension::addListener(), insertInStream(), operator!=(), and pack().

00102 { return _classId ; }

void OMK::Inp::AddInputListenerPrm::setVisBase ( const std::string &  visBase  )  [inline]

Set the VisBase value of AddInputListenerPrm.

Definition at line 105 of file OMKAddInputListenerPrm.h.

00105 { _visBase = visBase ; }

const std::string& OMK::Inp::AddInputListenerPrm::getVisBase (  )  const [inline]

Return the VisBase value of AddInputListenerPrm.

Definition at line 107 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), insertInStream(), operator!=(), and pack().

00107 { return _visBase ; }

void OMK::Inp::AddInputListenerPrm::setConfigParam ( const ConfigurationParameterDescriptor configParam  )  [inline]

Set the configParam value of AddInputListenerPrm.

Definition at line 110 of file OMKAddInputListenerPrm.h.

00110 { _configParam = configParam ; }

const ConfigurationParameterDescriptor* OMK::Inp::AddInputListenerPrm::getConfigParam (  )  const [inline]

Return the configParam value of AddInputListenerPrm.

Definition at line 112 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), OMK::Inp::InputExtension::addListener(), insertInStream(), operator!=(), and pack().

00112 { return _configParam ; }

bool OMK::Inp::AddInputListenerPrm::operator== ( const AddInputListenerPrm ref  )  const [inline]

Comparison operator for equality.

Definition at line 118 of file OMKAddInputListenerPrm.h.

00118 { return !( *this != ref ) ; } 

bool AddInputListenerPrm::operator!= ( const AddInputListenerPrm ref  )  const

Comparison operator for difference.

Definition at line 141 of file OMKAddInputListenerPrm.cpp.

References _classId, _configParam, _listenerId, _visBase, getClassId(), getConfigParam(), getListenerId(), and getVisBase().

00142 {
00143   return _listenerId != ref.getListenerId()
00144       || _classId != ref.getClassId()
00145       || _visBase != ref.getVisBase()
00146       || _configParam != ref.getConfigParam() ;
00147 }

AddInputListenerPrm & AddInputListenerPrm::operator= ( const AddInputListenerPrm ref  ) 

Copy operator.

Definition at line 151 of file OMKAddInputListenerPrm.cpp.

References _copy().

00152 {
00153   if ( this != &ref ) 
00154   {
00155     _copy( ref ) ;
00156   }
00157   return *this ;
00158 }  

void AddInputListenerPrm::insertInStream ( std::ostream &  = std::cout  )  const [virtual]

Insert datas in an output stream.

Implements OMK::Flowable.

Definition at line 162 of file OMKAddInputListenerPrm.cpp.

References getClassId(), getConfigParam(), getListenerId(), and getVisBase().

00163 {
00164   out << getListenerId() << " "
00165       << getClassId() << " "
00166       << getVisBase() << " "
00167           << *getConfigParam() << " "
00168       << " " ;
00169 }

void AddInputListenerPrm::extract ( std::istream &  = std::cin  )  [virtual]

Extract datas from an input stream.

Implements OMK::Flowable.

Definition at line 173 of file OMKAddInputListenerPrm.cpp.

References _classId, _configParam, _listenerId, and _visBase.

00174 {
00175   in >> _listenerId
00176      >> _classId
00177      >> _visBase ;
00178   // At this step we must retrieve the configuration parameters
00179   // we assume that is a MultipleConfigurationParameter
00180   MultipleConfigurationParameter* configParamTmp = new MultipleConfigurationParameter ;
00181   in >> ( *configParamTmp ) ;
00182   delete _configParam ;
00183   _configParam = configParamTmp ;
00184 }

void AddInputListenerPrm::pack ( OutgoingSynchronisationMessage out  )  const [virtual]

Pack datas in the message.

Reimplemented from OMK::Flowable.

Definition at line 188 of file OMKAddInputListenerPrm.cpp.

References getClassId(), getConfigParam(), getListenerId(), and getVisBase().

00189 {
00190   out << getListenerId()
00191       << getClassId()
00192       << getVisBase()
00193           << *getConfigParam() ;
00194 }

void AddInputListenerPrm::unpack ( IncomingSynchronisationMessage in  )  [virtual]

Unpack datas from the message.

Reimplemented from OMK::Flowable.

Definition at line 198 of file OMKAddInputListenerPrm.cpp.

References _classId, _configParam, _listenerId, and _visBase.

00199 {
00200   in >> _listenerId
00201      >> _classId
00202      >> _visBase ;
00203   // At this step we must retrieve the configuration parameters
00204   // we assume that is a MultipleConfigurationParameter
00205   MultipleConfigurationParameter* configParamTmp = new MultipleConfigurationParameter ;
00206   in >> ( *configParamTmp ) ;
00207   delete _configParam ;
00208   _configParam = configParamTmp ;
00209 }

OMK::Type::PolatorNT * AddInputListenerPrm::createPolator (  )  [virtual]

Default polator creator.

Implements OMK::Type::Base.

Definition at line 213 of file OMKAddInputListenerPrm.cpp.

00214 {
00215   return new OMK::Type::Polator<AddInputListenerPrm>() ;
00216 }

void AddInputListenerPrm::_copy ( const AddInputListenerPrm ref  )  [protected]

Copy methods call by constructor and operator.

Definition at line 220 of file OMKAddInputListenerPrm.cpp.

References _classId, _configParam, _listenerId, _visBase, OMK::ConfigurationParameterDescriptor::clone(), getClassId(), getConfigParam(), getListenerId(), and getVisBase().

Referenced by AddInputListenerPrm(), and operator=().

00221 {
00222   _listenerId = ref.getListenerId() ; 
00223   _classId = ref.getClassId() ; 
00224   _visBase = ref.getVisBase() ; 
00225   delete _configParam ;
00226   _configParam = ref.getConfigParam() ? ref.getConfigParam()->clone() : 0 ; 
00227 }


Member Data Documentation

std::string OMK::Inp::AddInputListenerPrm::_listenerId [protected]

This member holds the ObjectName value of AddVisualObjectPrm.

The name of the visual object

Definition at line 150 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), and unpack().

Name OMK::Inp::AddInputListenerPrm::_classId [protected]

This member holds the ClassId value of AddInputListenerPrm.

The class id to identify the class of the animator and to create a new one

Definition at line 154 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), and unpack().

std::string OMK::Inp::AddInputListenerPrm::_visBase [protected]

This member holds the VisBase value of AddInputListenerPrm.

The name of the visualisation. If null the message will be broadcasted, if not only the specified visualisation will received the message.

Definition at line 158 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), and unpack().

const ConfigurationParameterDescriptor* OMK::Inp::AddInputListenerPrm::_configParam [protected]

This member holds the configParam value of AddInputListenerPrm.

Informations to buid the animator

Definition at line 162 of file OMKAddInputListenerPrm.h.

Referenced by _copy(), extract(), innerParametersLoader(), operator!=(), resetDefaultValues(), unpack(), and ~AddInputListenerPrm().


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007