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

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

#include <OMKAddInputKeyPrm.h>

Inheritance diagram for OMK::Inp::AddInputKeyPrm:

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

Collaboration graph
[legend]
List of all members.

Reset and loaders

virtual void resetDefaultValues ()
 Reset the default values of AddInputKeyPrm.
virtual bool loadParameters (const ConfigurationParameterDescriptor *node, const std::string &prefix="", SimulatedObject *p=0)
 Configuration parameters loader of AddInputKeyPrm.
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 setListeningObjectId (const Name &listeningObjectId)
 Set the listeningObjectId value of AddVisualObjectPrm.
const NamegetListeningObjectId () const
 Return the listeningObjectId value of AddVisualObjectPrm.
void setKey (const std::string &key)
 Set the Key value of AddInputKeyPrm.
const std::string & getKey () const
 Return the Key value of AddInputKeyPrm.
Operators.
bool operator== (const AddInputKeyPrm &ref) const
 Comparison operator for equality.
bool operator!= (const AddInputKeyPrm &ref) const
 Comparison operator for difference.
AddInputKeyPrmoperator= (const AddInputKeyPrm &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 AddInputKeyPrm &ref)
 Copy methods call by constructor and operator.

Protected Attributes

Datas
std::string _key
 This member holds the Key value of AddInputKeyPrm.
Name _listeningObjectId
 This member holds the ObjectName value of AddVisualObjectPrm.

Detailed Description

Event to add a keyboard/mouse/joystick listener.

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

Definition at line 44 of file OMKAddInputKeyPrm.h.


Constructor & Destructor Documentation

AddInputKeyPrm::AddInputKeyPrm (  ) 

Default constructor ofAddInputKeyPrm.

Definition at line 36 of file OMKAddInputKeyPrm.cpp.

00037 : Base(),
00038   _key( "" ),
00039   _listeningObjectId()
00040 {
00041 }

AddInputKeyPrm::AddInputKeyPrm ( const AddInputKeyPrm ref  ) 

Copy constructor of AddInputKeyPrm.

Definition at line 45 of file OMKAddInputKeyPrm.cpp.

References _copy().

00046 : Base()
00047 {
00048   _copy( ref ) ;
00049 }

AddInputKeyPrm::AddInputKeyPrm ( const std::string &  key,
const Name listeningObjectId 
)

Constructor of AddInputKeyPrm with all the parameters.

Definition at line 53 of file OMKAddInputKeyPrm.cpp.

00055 : Base(),
00056   _key( key ),
00057   _listeningObjectId( listeningObjectId )
00058 {
00059 }

AddInputKeyPrm::~AddInputKeyPrm (  )  [virtual]

Destructor of AddInputKeyPrm.

Definition at line 63 of file OMKAddInputKeyPrm.cpp.

00064 {
00065 }

AddInputKeyPrm::AddInputKeyPrm (  ) 

Default constructor ofAddInputKeyPrm.

Definition at line 36 of file OMKAddInputKeyPrm.cpp.

00037 : Base(),
00038   _key( "" ),
00039   _listeningObjectId()
00040 {
00041 }

AddInputKeyPrm::AddInputKeyPrm ( const AddInputKeyPrm ref  ) 

Copy constructor of AddInputKeyPrm.

Definition at line 45 of file OMKAddInputKeyPrm.cpp.

References _copy().

00046 : Base()
00047 {
00048   _copy( ref ) ;
00049 }

AddInputKeyPrm::AddInputKeyPrm ( const std::string &  key,
const Name listeningObjectId 
)

Constructor of AddInputKeyPrm with all the parameters.

Definition at line 53 of file OMKAddInputKeyPrm.cpp.

00055 : Base(),
00056   _key( key ),
00057   _listeningObjectId( listeningObjectId )
00058 {
00059 }

AddInputKeyPrm::~AddInputKeyPrm (  )  [virtual]

Destructor of AddInputKeyPrm.

Definition at line 63 of file OMKAddInputKeyPrm.cpp.

00064 {
00065 }


Member Function Documentation

void AddInputKeyPrm::resetDefaultValues (  )  [virtual]

Reset the default values of AddInputKeyPrm.

Definition at line 69 of file OMKAddInputKeyPrm.cpp.

References _key.

Referenced by loadParameters().

00070 {
00071   //=== Reset default parameters
00072   _key = "" ;
00073 }

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

Configuration parameters loader of AddInputKeyPrm.

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 77 of file OMKAddInputKeyPrm.cpp.

References innerParametersLoader(), and resetDefaultValues().

00080 {
00081   resetDefaultValues() ;
00082   return innerParametersLoader( node, prefix, p );
00083 }

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

Protected loader, does not reset the default values.

Definition at line 87 of file OMKAddInputKeyPrm.cpp.

References _key, _listeningObjectId, OMK::debugMsg(), OMK::ParametersAccessor::get(), and OMERROR.

Referenced by loadParameters().

00088 {
00089   // Tests the configuration parameter node
00090   if( !node )
00091   { // No valid node => display error message and return false
00092     std::ostringstream txt ;
00093     txt << "Error in AddInputKeyPrm::innerParametersLoader";
00094     if( p ) txt << " for " << OMK::debugMsg( p ) ;
00095     txt << std::endl << ">>> :-( Invalid node" << std::endl ; 
00096     OMERROR( txt.str() ) ;
00097     return false ;
00098   }
00099   // return value
00100   bool ok = true ;
00101 
00102   //=== The needed parameters => tested
00103   // Load the value of Key
00104   ok = ParametersAccessor::get( node, prefix + "Key", _key, p ) && ok ;
00105   // Load the value of ListeningObjectId
00106   ok = ParametersAccessor::get( node, prefix + "ObjectName", _listeningObjectId, p ) && ok ;
00107 
00108   return ok ;
00109 }

void OMK::Inp::AddInputKeyPrm::setListeningObjectId ( const Name listeningObjectId  )  [inline]

Set the listeningObjectId value of AddVisualObjectPrm.

Definition at line 90 of file OMKAddInputKeyPrm.h.

00090 { _listeningObjectId = listeningObjectId ; }

const Name& OMK::Inp::AddInputKeyPrm::getListeningObjectId (  )  const [inline]

Return the listeningObjectId value of AddVisualObjectPrm.

Definition at line 92 of file OMKAddInputKeyPrm.h.

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

00092 { return _listeningObjectId ; }

void OMK::Inp::AddInputKeyPrm::setKey ( const std::string &  key  )  [inline]

Set the Key value of AddInputKeyPrm.

Definition at line 95 of file OMKAddInputKeyPrm.h.

00095 { _key = key ; }

const std::string& OMK::Inp::AddInputKeyPrm::getKey (  )  const [inline]

Return the Key value of AddInputKeyPrm.

Definition at line 97 of file OMKAddInputKeyPrm.h.

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

00097 { return _key ; }

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

Comparison operator for equality.

Definition at line 103 of file OMKAddInputKeyPrm.h.

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

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

Comparison operator for difference.

Definition at line 114 of file OMKAddInputKeyPrm.cpp.

References _key, _listeningObjectId, getKey(), and getListeningObjectId().

00115 {
00116   return _key != ref.getKey()
00117       || _listeningObjectId != ref.getListeningObjectId() ;
00118 }

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

Copy operator.

Definition at line 122 of file OMKAddInputKeyPrm.cpp.

References _copy().

00123 {
00124   if ( this != &ref ) 
00125   {
00126     _copy( ref ) ;
00127   }
00128   return *this ;
00129 }  

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

Insert datas in an output stream.

Implements OMK::Flowable.

Definition at line 133 of file OMKAddInputKeyPrm.cpp.

References getKey(), and getListeningObjectId().

00134 {
00135   out << getKey() << " "
00136       << getListeningObjectId() << " "
00137       << " " ;
00138 }

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

Extract datas from an input stream.

Implements OMK::Flowable.

Definition at line 142 of file OMKAddInputKeyPrm.cpp.

References _key, and _listeningObjectId.

00143 {
00144   in >> _key
00145      >> _listeningObjectId ;
00146 }

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

Pack datas in the message.

Reimplemented from OMK::Flowable.

Definition at line 150 of file OMKAddInputKeyPrm.cpp.

References getKey(), and getListeningObjectId().

00151 {
00152   out << getKey()
00153       << getListeningObjectId()  ;
00154 }

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

Unpack datas from the message.

Reimplemented from OMK::Flowable.

Definition at line 158 of file OMKAddInputKeyPrm.cpp.

References _key, and _listeningObjectId.

00159 {
00160   in >> _key
00161      >> _listeningObjectId ;
00162 }

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

Default polator creator.

Implements OMK::Type::Base.

Definition at line 166 of file OMKAddInputKeyPrm.cpp.

00167 {
00168   return new OMK::Type::Polator<AddInputKeyPrm>() ;
00169 }

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

Copy methods call by constructor and operator.

Definition at line 173 of file OMKAddInputKeyPrm.cpp.

References _key, _listeningObjectId, getKey(), and getListeningObjectId().

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

00174 {
00175   _key = ref.getKey() ; 
00176   _listeningObjectId = ref.getListeningObjectId() ; 
00177 }


Member Data Documentation

std::string OMK::Inp::AddInputKeyPrm::_key [protected]

This member holds the Key value of AddInputKeyPrm.

The key to listen.

Definition at line 135 of file OMKAddInputKeyPrm.h.

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

Name OMK::Inp::AddInputKeyPrm::_listeningObjectId [protected]

This member holds the ObjectName value of AddVisualObjectPrm.

The name of the object which will listen the key.

Definition at line 139 of file OMKAddInputKeyPrm.h.

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


logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007