vrecko
virtual reality framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vrecko::BaseClass Class Reference

#include <BaseClass.h>

Inheritance diagram for vrecko::BaseClass:
APMenu::MenuItem MainObject vrecko::Ability vrecko::AbilityDispatcher vrecko::Device vrecko::DeviceManager vrecko::EnvironmentObject vrecko::EventDispatcher vrecko::OctTree vrecko::Scene vrecko::Scene::EOIteratorHelper vrecko::World

Classes

struct  NOTIFICATION_DESCRIPTION
 

Public Types

enum  NotificationTypes {
  NOTIFICATION_DELETE_CLASS = 1, NOTIFICATION_EO_REGISTERING = 2, NOTIFICATION_EO_UNREGISTERING = 4, NOTIFICATION_PROGRAM_TERMINATION = 8,
  NOTIFICATION_ALL = 0xFFFFFFFF
}
 

Public Member Functions

 BaseClass (const char *startingSenderString)
 The main constructor. More...
 
 BaseClass (BaseClass &bc)
 Copy constructor. Probably not really used. More...
 
virtual ~BaseClass ()
 Destructor. More...
 
virtual bool initialize (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *parameters=NULL)
 Core initialization. More...
 
virtual bool initializeFromString (const char *xmlString)
 Helper method that allows to initialize ability from a XML-formatted string. More...
 
virtual void update (void)
 This method is called periodically in case this instance is registered in Scheduler. More...
 
virtual
XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode
saveXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *)
 Save current setting into a XML node. More...
 
bool inputPresent (const std::string &name)
 Returns true if input pin (not request inputpin ) with given name is present. More...
 
bool outputPresent (const std::string &name)
 Returns true if output pin (not request output pin) with given name is present. More...
 
void addInputPin (InputPinBase *pin)
 Adds an input pin. More...
 
void removeInputPin (InputPinBase *pin)
 Removes an input pin. More...
 
void addOutputPin (OutputPinBase *pin)
 Adds an output pin. More...
 
void removeOutputPin (OutputPinBase *pin)
 Removes and output pin. More...
 
void addRequestInputPin (RequestInputPinBase *pin)
 Adds a request input pin. More...
 
void removeRequestInputPin (RequestInputPinBase *pin)
 Removes a request input pin. More...
 
void addRequestOutputPin (RequestOutputPinBase *pin)
 Adds a request output pin. More...
 
void removeRequestOutputPin (RequestOutputPinBase *pin)
 Removes a request output pin. More...
 
bool addNotification (BaseClass *receiver, unsigned long notificationTypes)
 Registers an observer that will be notified if a specific change occurs. More...
 
bool removeNotification (BaseClass *receiver, unsigned long notificationTypes=NOTIFICATION_ALL)
 Unregisters a previously registered observer. More...
 
virtual void processEvent (const std::string &input_name, VreckoMessage *pMessage)
 Internal method for processing the events. More...
 
virtual VreckoMessageprocessRequest (const std::string &request_input_name, VreckoMessage *pMessage)
 Internal method for processing the requests. More...
 
virtual const std::string & getSenderString (void)
 Returns the sender (or receiver) identification string. More...
 
void reportError (const std::string &error)
 Print error message. More...
 
void setPriority (long int pr)
 Sets the priority. (Possible problems - read the full description for more info) More...
 
long int getPriority (void) const
 Returns current object priority. More...
 
void setAttribute (const std::string &attr_name, int attr_value)
 Sets an attribute value. More...
 
int getAttribute (const std::string &attr_name)
 Returns attribute value. More...
 
int getAttribute (const char *attr_name)
 Returns attribute value. More...
 
void deleteAttribute (const std::string &attr_name)
 Delete an attribute. More...
 
void setSceneFile (const std::string &sceneFileName)
 Set the name of the file this component was in (and possibly will be saved to). More...
 
const std::string & getSceneFile () const
 Get the name of the file this component was in. More...
 
virtual void preInitialize (void)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual void postInitialize (void)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual bool loadXMLParameters (XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
virtual bool loadXMLParameters (const char *xmlString)
 OBSOLETE METHOD, kept for backwards compatibility. More...
 
InputPinBasegetInputPin (const char *strName)
 Returns pointer to an input pin with specified name. More...
 
OutputPinBasegetOutputPin (const char *strName)
 Returns pointer to an output pin with specified name. More...
 
RequestInputPinBasegetRequestInputPin (const char *strName)
 Returns pointer to an request input pin with specified name. More...
 
RequestOutputPinBasegetRequestOutputPin (const char *strName)
 Returns pointer to an input pin with specified name. More...
 

Protected Types

typedef std::map< std::string,
int > 
AttributeMap
 Attributes. More...
 
typedef std::vector
< osg::ref_ptr< IOPinBase > > 
PinList
 

Protected Member Functions

bool sendNotifications (unsigned long notificationType, void *notificationData)
 
virtual int processNotification (BaseClass *sender, unsigned long notificationType, void *notificationData)
 Process an incoming notification. More...
 
IOPinBasefindPinInList (const char *strName, PinList *pinList)
 Internal method to find a given pin in a given list. More...
 

Protected Attributes

AttributeMap attribute
 
MTReadWriteLock attributeLock
 
std::string senderString
 
MTLock notificationsLock
 
std::vector
< NOTIFICATION_DESCRIPTION
notifications
 
long int priority
 
const std::string * sceneFile
 
PinList inputPinsList
 
PinList outputPinsList
 
PinList requestInputPinsList
 
PinList requestOutputPinsList
 

Detailed Description

Class BaseClass is the base class of the VRECKO. It includes functions for inputs/outputs operations and event processing. And it also includes termination flag and pointers to the World.

Member Typedef Documentation

typedef std::map<std::string, int> vrecko::BaseClass::AttributeMap
protected

Attributes.

typedef std::vector<osg::ref_ptr<IOPinBase> > vrecko::BaseClass::PinList
protected

Member Enumeration Documentation

Enumerator
NOTIFICATION_DELETE_CLASS 

notification will be sent on class deletion

NOTIFICATION_EO_REGISTERING 

sent when an EO object is being registered to the Scene. !!! WARNING !!! This notification is sent when the internal EOMap is locked from updates -

  • if you will try to register or unregister any object in this handler, the application will freeze forever. BE AWARE! [sender] will be the Scene, [notificationData] will be the given object.
NOTIFICATION_EO_UNREGISTERING 

sent when an EO object is unregistered from Scene !!! WARNING !!! This notification is sent when the internal EOMap is locked from updates -

  • if you will try to register or unregister any object in this handler, the application will freeze forever. BE AWARE! [sender] will be the Scene, [notificationData] will be the given object.
NOTIFICATION_PROGRAM_TERMINATION 
 Sent when the program will be terminated,

BEFORE the actual destruction of the world/devices/object/abilities/... Sent ONLY to objects, which were registered to World.

NOTIFICATION_ALL 

every type of notification

Constructor & Destructor Documentation

BaseClass::BaseClass ( const char *  startingSenderString)

The main constructor.

Especially in the case of abilities: The constructor should contain only the very basic initialization (setting variables to zero etc.) AND IF REALLY NECESSARY then also setting the priority AND adding the ability to the scheduler and setting the update frequency. (The reason for setting these two things is the user can also specify them in the XML file to overwrite default setting. This will be processed after the constructor, but before the initialize().)

The main initialization should be made in the initialize() method. The reason is that in the constructor, the Ability doesn't know who will be its owner and what will be its ID.

Parameters
startingSenderString(const char *)
Returns
()
BaseClass::BaseClass ( BaseClass bc)

Copy constructor. Probably not really used.

Parameters
bc(BaseClass &)
Returns
()
BaseClass::~BaseClass ( )
virtual

Destructor.

This has to be virtual - see for example http://blogs.msdn.com/b/oldnewthing/archive/2004/05/07/127826.aspx .

Returns
()

Member Function Documentation

void BaseClass::addInputPin ( InputPinBase pin)

Adds an input pin.

Usually not used directly, but using the INIT_INPUT macro in IOPins.h .

It still may be useful to use it directly at times, but usually for highly dynamic abilities, which need to register and unregister plenty of different pins at runtime.

The usual declaration/definition/initialization on an input pit comprises of using macros DECLARE_INPUT, INIT_INPUT and METHOD_INPUT. The usage is described in manual in more detail. See this page: http://decibel.fi.muni.cz/wiki/index.php/VRECKO_Zpravy

Parameters
pin(InputPinBase *)
Returns
(void)
bool BaseClass::addNotification ( BaseClass receiver,
unsigned long  notificationTypes 
)

Registers an observer that will be notified if a specific change occurs.

Note: Due to the locking mechanism used, this is ok to use in multi-threading environment.

Parameters
receiver(BaseClass *) Pointer to the object that will be notified - its processNotification() method will be called.
notificationTypes(unsigned long) Any combination of bitvalues defined in the NotificationTypes enum (combine them using bitwise OR, i.e. operator | ).
Returns
(bool) True if everything went ok.
void BaseClass::addOutputPin ( OutputPinBase pin)

Adds an output pin.

Usually not used directly, but using the INIT_OUTPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(OutputPinBase *)
Returns
(void)
void BaseClass::addRequestInputPin ( RequestInputPinBase pin)

Adds a request input pin.

Usually not used directly, but using the INIT_REQUEST_INPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(RequestInputPinBase *)
Returns
(void)
void BaseClass::addRequestOutputPin ( RequestOutputPinBase pin)

Adds a request output pin.

Usually not used directly, but using the INIT_REQUEST_OUTPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(RequestOutputPinBase *)
Returns
(void)
void BaseClass::deleteAttribute ( const std::string &  attr_name)

Delete an attribute.

Any other subsequent calls to getAttribute() will return 0.

Parameters
attr_name(const std::string &)
Returns
(void)
IOPinBase* vrecko::BaseClass::findPinInList ( const char *  strName,
PinList pinList 
)
inlineprotected

Internal method to find a given pin in a given list.

Parameters
strName(const char *) Pin name.
pinList(PinList *) List to be searched.
Returns
(IOPinBase*) Pointer to the pin or NULL if not found.
int vrecko::BaseClass::getAttribute ( const std::string &  attr_name)
inline

Returns attribute value.

If you specify a non-existing attribute, 0 will be returned.

Parameters
attr_name(const std::string &)
Returns
(int)
int vrecko::BaseClass::getAttribute ( const char *  attr_name)
inline

Returns attribute value.

If you specify a non-existing attribute, 0 will be returned.

Parameters
attr_name(const char *)
Returns
(int)
InputPinBase * BaseClass::getInputPin ( const char *  strName)

Returns pointer to an input pin with specified name.

Parameters
strName(const char *) Pin name.
Returns
(InputPinBase*) Returned pointer or NULL if not found.
OutputPinBase * BaseClass::getOutputPin ( const char *  strName)

Returns pointer to an output pin with specified name.

Parameters
strName(const char *) Pin name.
Returns
(OutputPinBase*) Returned pointer or NULL if not found.
long int vrecko::BaseClass::getPriority ( void  ) const
inline

Returns current object priority.

For more information about priority and its usage see setPriority().

Returns
(long int) The current object priority.
RequestInputPinBase * BaseClass::getRequestInputPin ( const char *  strName)

Returns pointer to an request input pin with specified name.

Parameters
strName(const char *) Pin name.
Returns
(RequestInputPinBase*) Returned pointer or NULL if not found.
RequestOutputPinBase * BaseClass::getRequestOutputPin ( const char *  strName)

Returns pointer to an input pin with specified name.

Parameters
strName(const char *) Pin name.
Returns
(RequestOutputPinBase*) Returned pointer or NULL if not found.
const std::string& vrecko::BaseClass::getSceneFile ( ) const
inline

Get the name of the file this component was in.

The method may return NULL.

Warning
Note that the string pointer may point to the shared memory pool (so don't change the string directly!)
Returns
(const std::string &)
virtual const std::string& vrecko::BaseClass::getSenderString ( void  )
inlinevirtual

Returns the sender (or receiver) identification string.

Returns
(const std::string &) Reference to the stored sender string.

Reimplemented in vrecko::Ability.

bool BaseClass::initialize ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode parameters = NULL)
virtual

Core initialization.

It is important to place the initializing code here, because especially in the case of Abilities, this is the point when the ID and owner is known and we can react accordingly. (This information is unknown in the constructor.)

You will probably want to override this method. This method supersedes the original preInitialize() / loadXMLParameters() / postInitialize() methods, which are now obsolete, but for the sake of compatibility they are called from the initialize() if the method is not overridden. You can override it and forget about pre/postInitialize() or loadParameters() - it's now an old solution.

Parameters
parameters(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode *) Pointer to a XML DOM node, might be NULL if no parameters were specified. The ability should initialize to default values in that case.
Returns
(bool) Returns true on success.

Reimplemented in vrecko::ControllableAbility, AP_CableEditor::CableEditor, APLightsEditor::Editor, APNature::TerrainAbility, ht::ScreenSetup, APGUI::GUI_Controller, APShootingSimulation::ShootingSimulation, ht::ScreenSetupSimple, APGUI::Icon, APCameraPath::Camera, APGUI::Slider, vrecko::EnvironmentObject, ode::DynamicScene, APInputConnector::InputConnector, APRoomEdit::RoomEditor, APGUI::IconColour, APGUI::Menu, vreckoDP_base::Wiimote, APDYNAMICART::ToolEraser, APDYNAMICART::ToolTongs, APGUI::ColorPicker, APDYNAMICART::ToolSelector, APDYNAMICART::ToolMagicWand, APDYNAMICART::ToolHook, APDYNAMICART::ToolRotation, APDYNAMICART::ToolSlice, APEditorController::EditorController, APEditorQAbilities::ObjectMovement, ht::HeadTracking, APEditorQAbilities::AbilityEditor, APHelloWorld::MyAbility, and APWeather::Weather.

bool BaseClass::initializeFromString ( const char *  xmlString)
virtual

Helper method that allows to initialize ability from a XML-formatted string.

This method takes string, converts it to XML nodes and passes the result to the "real" initialize() method.

Parameters
xmlString(const char *) The string formatted like this: "<Parameters>...</Parameters>"
Returns
(bool) True in case the function was successful.
bool BaseClass::inputPresent ( const std::string &  name)

Returns true if input pin (not request inputpin ) with given name is present.

Return vector with description of all inputs for the object. Return type of the input. Return vector with description of all outputs for the object. Return type of the output.

Parameters
name(const std::string &) Pin name
Returns
(bool) True if the pin already exists.
virtual bool vrecko::BaseClass::loadXMLParameters ( XERCES_CPP_NAMESPACE_QUALIFIER DOMNode )
inlinevirtual

OBSOLETE METHOD, kept for backwards compatibility.

The preInitialize(), loadXMLParameters() and postInitialize() methods were replaced in 2011 by a single method initialize().

Parameters
*(XERCES_CPP_NAMESPACE_QUALIFIER DOMNode)
Returns
(bool)

Reimplemented in APMenu::DynamicMenu, APSpacePartitioning::PointShell_Object_Data, vrecko::World, APDYNAMICART::Ctrl_FreeHandPainting, APDYNAMICART::DAEnvironment, APLightsEditor::Lights, APDYNAMICART::Ctrl_MotionVisualization, ArtificialWorld::BlockUpdater, APCameraPath::Camera, vreckoDP_base::LHeadTracker, APRoomEdit::WallGeometry, APCameraMovement::CameraPath, APObjectUtils::ObjectEffect, APObjectUtils::KeepOnScreen, vreckoDP_base::NestOfBirds, APHUD::HUDDisplay, Cache, APObjectUtils::Animator, PhysXPlugin::PhysXScene, APDYNAMICART::Ctrl_PerlinLines, APClouds::Clouds, CarSim::CarExecutionUnit, vreckoDP_base::VRPN3DMouse, APTextOutput::Console, grass::Grass, APConstrainedMovement::ConstraintDescription, AP_LSystem::LSObject, APConnectEditor::ConnectEditor, base::SystemInfo, vreckoDP_base::OptiTrack, CarSim::RoadsState, vreckoDP_base::L3DMouse, boids::Boid, boids::BoidsLogic, vreckoDP_Kinect::Kinect, PhysXPlugin::BasePhysXObject, PhysXPlugin::Cloth, boids::BoidsPlanner, VirtualFixture::Trace, navigation::AvatarInHand, PhysXPlugin::BaseActor, VirtualFixture::ProxiBorder, BehindObstacleExp_wT, BehindObstacleExperiment, base::Avatar, APConnectEditor::Cut, base::ShowFDH, CarSim::CarControlUnit, APObjectUtils::CopyProperties, VirtualFixture::ProxiBox, VirtualFixture::ProxiCone, VirtualFixture::ProxiCylinder, VirtualFixture::ProxiSphere, behindO::WIM, APObjectUtils::ConnectionViz, APObjectUtils::ObjectModif, APObjectUtils::ObjectSelector, APSpacePartitioning::VoxelGrid_Object_Data, PhysXPlugin::BaseJoint, VirtualFixture::Avatar, behindO::HeadManipulator, APObjectUtils::ObjectEffectMan, PhysXPlugin::RemoteDebugger, behindO::HMDHeadManipulator, APFFDEditor::EditorLogic, VirtualFixture::Log, base::Rotate, ChessBoard, PhysXPlugin::Box, PhysXPlugin::Capsule, PhysXPlugin::CylindricalJoint, PhysXPlugin::Fluid, PhysXPlugin::Plane, PhysXPlugin::PointInPlaneJoint, PhysXPlugin::PointOnLineJoint, PhysXPlugin::PrismaticJoint, PhysXPlugin::Sphere, PhysXPlugin::SphericalJoint, PHEffect, PhysXPlugin::DistanceJoint, PhysXPlugin::FixedJoint, PhysXPlugin::PulleyJoint, PhysXPlugin::RevoluteJoint, PHANToMAvatar, base::Light, ArtificialWorld::WorldBuilder, APConnectEditor::Rotation, navigation::KMTracker, ode::Cube, Filter::Linear, ChessPiece, ode::CompositeObject, ode::Sphere, PhysXPlugin::ForceField, ode::CappedCylinder, and Filter::PosNoiseRemover.

bool BaseClass::loadXMLParameters ( const char *  xmlString)
virtual

OBSOLETE METHOD, kept for backwards compatibility.

The preInitialize(), loadXMLParameters() and postInitialize() methods were replaced in 2011 by a single method initialize().

Parameters
xmlString(const char *)
Returns
(bool)
bool BaseClass::outputPresent ( const std::string &  name)

Returns true if output pin (not request output pin) with given name is present.

Parameters
name(const std::string &) Pin name
Returns
(bool) True if the pin already exists.
virtual void vrecko::BaseClass::postInitialize ( void  )
inlinevirtual

OBSOLETE METHOD, kept for backwards compatibility.

The preInitialize(), loadXMLParameters() and postInitialize() methods were replaced in 2011 by a single method initialize().

Reimplemented in APMenu::DynamicMenu, APLightsEditor::Lights, APDYNAMICART::Ctrl_FreeHandPainting, APDYNAMICART::Controller, AP_CableEditor::Cable, APDYNAMICART::Ctrl_MotionVisualization, APDYNAMICART::DAEnvironment, ArtificialWorld::BlockUpdater, APRoomEdit::WallGeometry, APDYNAMICART::Ctrl_PerlinLines, APObjectUtils::ObjectEffect, APCameraMovement::CameraPath, APDYNAMICART::PLControllerTool, APHUD::HUDDisplay, PhysXPlugin::PhysXScene, APDYNAMICART::PLMagnetTool, APTextOutput::Console, APClouds::Clouds, AP_LSystem::LSObject, grass::Grass, base::SystemInfo, vrecko::PyAbility, PhysXPlugin::PhysXObject, vreckoDP_base::OptiTrack, PhysXPlugin::BaseActor, boids::BoidsLogic, boids::Boid, PhysXPlugin::BasePhysXObject, boids::BoidsPlanner, VirtualFixture::ProxiBorder, base::Avatar, APDYNAMICART::JuliaAttractor, APObjectUtils::ConnectionViz, BehindObstacleExp_wT, BehindObstacleExperiment, APDYNAMICART::PLNestTool, behindO::WIM, APObjectUtils::ObjectModif, APObjectUtils::ObjectSelector, VirtualFixture::ProxiBox, VirtualFixture::ProxiCone, VirtualFixture::ProxiCylinder, VirtualFixture::ProxiSphere, VirtualFixture::Trace, ArtificialWorld::WorldBuilder, APObjectUtils::ObjectEffectMan, APSpacePartitioning::VoxelGrid_Object_Data, PhysXPlugin::RemoteDebugger, VirtualFixture::Avatar, APFFDEditor::EditorLogic, navigation::AvatarInHand, PhysXPlugin::UpdatablePhysXObject, VirtualFixture::Log, PHEffect, PHANToMAvatar, behindO::CentreObjectManipulator, behindO::MappingFunctions, navigation::KMTracker, ode::Cube, base::Light, ode::CompositeObject, ode::Sphere, and ode::CappedCylinder.

virtual void vrecko::BaseClass::preInitialize ( void  )
inlinevirtual

OBSOLETE METHOD, kept for backwards compatibility.

The preInitialize(), loadXMLParameters() and postInitialize() methods were replaced in 2011 by a single method initialize().

Reimplemented in APMenu::DynamicMenu, APLightsEditor::Lights, APDYNAMICART::Ctrl_FreeHandPainting, APDYNAMICART::Controller, AP_CableEditor::Cable, APDYNAMICART::Ctrl_MotionVisualization, APDYNAMICART::DAEnvironment, ArtificialWorld::BlockUpdater, behindO::Mirror, APRoomEdit::WallGeometry, APObjectUtils::KeepOnScreen, APObjectUtils::ObjectEffect, APCameraMovement::CameraPath, APHUD::HUDDisplay, APObjectUtils::Animator, PhysXPlugin::PhysXScene, APSpacePartitioning::SNCH_Object, CarSim::CarExecutionUnit, APTextOutput::Console, CarSim::TLsOnJuncManager, APClouds::Clouds, base::MTMatrixTransform, base::SystemInfo, vrecko::PyAbility, AP_LSystem::LSObject, vreckoDP_base::OptiTrack, CarSim::RoadsState, boids::BoidsLogic, APSpacePartitioning::NoPartitioning_Scene, base::MouseHand, boids::Boid, PhysXPlugin::BasePhysXObject, boids::BoidsPlanner, PhysXPlugin::PhysXObject, APSpacePartitioning::SphereBVH_Scene, VirtualFixture::ProxiBorder, base::Avatar, CarSim::CarControlUnit, APObjectUtils::ConnectionViz, APSpacePartitioning::SphereBVH_Object, behindO::AvatarManipulator, BehindObstacleExp_wT, BehindObstacleExperiment, behindO::EyeManipulator, behindO::Manipulator, APSpacePartitioning::PointShellVSVoxel_Object, base::hand, VirtualFixture::ProxiBox, VirtualFixture::ProxiCone, VirtualFixture::ProxiCylinder, VirtualFixture::ProxiSphere, VirtualFixture::Trace, behindO::HeadManipulator, APObjectUtils::ObjectModif, APObjectUtils::ObjectSelector, APSpacePartitioning::VoxelGrid_Object_Data, VirtualFixture::Avatar, behindO::HMDHeadManipulator, APObjectUtils::ObjectEffectMan, APObjectUtils::ObjectInfo, base::Light, base::Rotate, VirtualFixture::Log, PHEffect, CarSim::Remover, ChessPiece, APSpacePartitioning::SP_Object_Data_Base, PHANToMAvatar, Filter::Linear, navigation::KMTracker, and Filter::PosNoiseRemover.

void BaseClass::processEvent ( const std::string &  input_name,
VreckoMessage pMessage 
)
virtual

Internal method for processing the events.

After the message reimplementation, this is a method, which redistributes the events into your methods attached to the respective inputs. There is usually now no need to override this method or interact with it in any way. You can usually easily define your inputs via the DECLARE_INPUT and INIT_INPUT macros and declare handling method using the METHOD_INPUT macro.

Internally, this method is used to process all the messages and find the appropriate handling method defined by the METHOD_INPUT.

Parameters
input_name(const std::string &) Name of the input pin
pMessage(VreckoMessage *) Pointer to the message. This will be automatically cast to the correct message type, if you are using the DECLARE_INPUT (etc.) macros.
Returns
(void)

Reimplemented in APInputConnector::InputConnector, navigation::AvatarInHand, and navigation::KMTracker.

virtual int vrecko::BaseClass::processNotification ( BaseClass sender,
unsigned long  notificationType,
void *  notificationData 
)
inlineprotectedvirtual

Process an incoming notification.

Override this method to react to a registered notification (see addNotification() method).

Parameters
sender(BaseClass *) The sender of the notification
notificationType(unsigned long) Type of the notification, only ONE bit will be set
notificationData(void *) Appropriate notification data, dependent on the notificationType.
Returns
(int) Should return 0, other values are reserved for future use.

Reimplemented in vrecko::ControllableAbility, APMenu::MenuItem, vrecko::Scene::EOIteratorHelper, AP_CableEditor::CableEditor, APEditorController::EditorController, AP_CableEditor::Cable, APSpacePartitioning::SphereBVH_Object_Data, and APObjectUtils::ObjectEffectMan.

VreckoMessage * BaseClass::processRequest ( const std::string &  request_input_name,
VreckoMessage pMessage 
)
virtual

Internal method for processing the requests.

After the message reimplementation, this is a method, which redistributes the requests into your methods attached to the respective request inputs. There is now no need to override this method or interact with it in any way. You can usually easily define your inputs via the DECLARE_REQUEST_INPUT and INIT_REQUEST_INPUT macros and declare handling method using the METHOD_REQUEST_INPUT macro.

Internally, this method is used to process all the requests and find the appropriate handling method defined by the METHOD_REQUEST_INPUT.

Parameters
request_input_name(const std::string &) Request input name
pMessage(VreckoMessage *) Message sent to the input
Returns
(VreckoMessage *) Returning message
void BaseClass::removeInputPin ( InputPinBase pin)

Removes an input pin.

Usually not used directly, but using the UNINIT_INPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(InputPinBase *)
Returns
(void)
bool BaseClass::removeNotification ( BaseClass receiver,
unsigned long  notificationTypes = NOTIFICATION_ALL 
)

Unregisters a previously registered observer.

Note: Due to the locking mechanism used, this is ok to use in multi-threading environment.

Only specified notifications will be unregistered. You can specify the ALL_NOTIFICATIONS constant to unregister everything.

MUTLITHREADING note: Since we are using locks, it is guaranteed that after this method returns there is no "pending" notification and no other notifications will arise.

Parameters
receiver(BaseClass *) Registered object that is receiving notifications.
notificationTypes(unsigned long) Any combination of bitvalues defined in the NotificationTypes enum (combine them using bitwise OR, i.e. operator | ).
Returns
(bool) True if everything went ok.
void BaseClass::removeOutputPin ( OutputPinBase pin)

Removes and output pin.

Usually not used directly, but using the UNINIT_OUTPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(OutputPinBase *)
Returns
(void)
void BaseClass::removeRequestInputPin ( RequestInputPinBase pin)

Removes a request input pin.

Usually not used directly, but using the UNINIT_REQUEST_INPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(RequestInputPinBase *)
Returns
(void)
void BaseClass::removeRequestOutputPin ( RequestOutputPinBase pin)

Removes a request output pin.

Usually not used directly, but using the UNINIT_REQUEST_OUTPUT macro in IOPins.h .

For more information see addInputPin().

Parameters
pin(RequestOutputPinBase *)
Returns
(void)
void BaseClass::reportError ( const std::string &  error)

Print error message.

This method is not really used, but might be good for inspiration in the future (attaches own identification to a given error message).

Parameters
error(const std::string &)
Returns
(void)
virtual XERCES_CPP_NAMESPACE_QUALIFIER DOMNode* vrecko::BaseClass::saveXMLParameters ( XERCES_CPP_NAMESPACE_QUALIFIER DOMDocument *  )
inlinevirtual
bool BaseClass::sendNotifications ( unsigned long  notificationType,
void *  notificationData 
)
protected

Send notifications to all BaseClasses, which are registered to receive the selected notification type (only ONE type at a time, i.e. the notificationType have to have only ONE bit set).

void vrecko::BaseClass::setAttribute ( const std::string &  attr_name,
int  attr_value 
)
inline

Sets an attribute value.

This method either sets value for a new attribute or replace value of an old attribute.

Parameters
attr_name(const std::string &) Attribute name.
attr_value(int) New value.
Returns
(void)
void vrecko::BaseClass::setPriority ( long int  pr)
inline

Sets the priority. (Possible problems - read the full description for more info)

The priority is used if the update() method is called periodically (i.e. every frame). The objects with highest priority will be called first.

If not set explicitly, the default priority of an object is 0.

Once the object is registered in Scheduler, the priority is used to insert sort the object between the "competing" ones. Any later change of priority is allowed and the object will be correctly re-sorted in Scheduler (happens usually in the next frame).

Warning
The priority for most abilities should be set in their constructor, because the user has also an option to set the priority in the XML configuration file. The priority set in constructor will then act as a default value and can be overridden in the XML.
Parameters
pr(long int) The new priority, can be negative meaning simply lower-than-default priority. The default is 0.
Returns
(void)
void BaseClass::setSceneFile ( const std::string &  sceneFileName)

Set the name of the file this component was in (and possibly will be saved to).

You can specify an empty string meaning "no file".

Parameters
sceneFileName(const std::string &)
Returns
(void)
virtual void vrecko::BaseClass::update ( void  )
inlinevirtual

This method is called periodically in case this instance is registered in Scheduler.

The method is called periodically at specified frequency or every frame. Use the Scheduler::addEntity() method to register your class and set the frequency.

Reimplemented in APMenu::DynamicMenu, AP_CableEditor::Cable, vrecko::EventDispatcher, vrecko::Scene, APDYNAMICART::Controller, vrecko::ControllableAbility, APDYNAMICART::DAEnvironment, APDYNAMICART::PoA, APDYNAMICART::Ctrl_MotionVisualization, APDYNAMICART::Ctrl_FreeHandPainting, ArtificialWorld::BlockUpdater, behindO::Mirror, APGUI::GUI_Controller, APDYNAMICART::BrushStroke, vreckoDP_base::LHeadTracker, vreckoDP_base::fsPinchGlove, APCameraMovement::CameraPath, APObjectUtils::ObjectEffect, APNature::TerrainAbility, APDYNAMICART::PoB, APObjectUtils::KeepOnScreen, APDYNAMICART::PLControllerTool, APGUI::Slider, vreckoDP_base::Ultratrak, APHUD::HUDDisplay, vreckoDP_base::NestOfBirds, APInputConnector::InputConnector, APObjectUtils::Animator, PhysXPlugin::PhysXScene, Cache, APShootingSimulation::ShootingSimulation, APLightsEditor::Editor, vrecko::Device, ode::DynamicScene, APClouds::Clouds, APCameraPath::Camera, APDYNAMICART::Ctrl_PerlinLines, APDYNAMICART::PLMagnetTool, CarSim::CarExecutionUnit, APDYNAMICART::ToolBrush, vreckoDP_base::VRPN3DMouse, APDYNAMICART::OrdinaryAttractor, APTextOutput::Console, AP_CableEditor::CableEditor, APDYNAMICART::Ctrl_StringSculptures, APGUI::ColorPicker, vreckoDP_base::KeyboardMouse, CarSim::TLsOnJuncManager, APRoomEdit::RoomEditor, base::SystemInfo, APDYNAMICART::Ctrl_PolyhedraSculptures, APDYNAMICART::ToolTongs, APDYNAMICART::Attractor, base::MTMatrixTransform, APDYNAMICART::PerlinLines, grass::Grass, vreckoDP_base::fdtDataGlove, vreckoDP_base::OptiTrack, boids::BoidsLogic, CarSim::RoadsState, APDYNAMICART::Ctrl_Attractor, APDYNAMICART::PolyhedraSculpture, vrecko::PyAbility, APDYNAMICART::Hoop, vreckoDP_base::L3DMouse, boids::BoidsPlanner, vreckoDP_base::Wiimote, vreckoDP_Kinect::Kinect, boids::Boid, APDYNAMICART::HookObject, APDYNAMICART::ToolMagicWand, APSpacePartitioning::NoPartitioning_Scene, APDYNAMICART::PLNestTool, APDYNAMICART::ToolSelector, navigation::AvatarInHand, base::MouseHand, APCameraMovement::CameraMovementEditor, APDYNAMICART::JuliaAttractor, BehindObstacleExp_wT, BehindObstacleExperiment, APConstrainedMovement::ConstrainedObjectMovement, APDYNAMICART::ToolHook, APObjectUtils::CopyProperties, vreckoDP_base::MicroScribe3D, VirtualFixture::ProxiBorder, base::Avatar, APObjectUtils::ConnectionViz, APObjectUtils::ObjectModif, APObjectUtils::ObjectSelector, base::Display, APEditorController::EditorController, APObjectUtils::ObjectEffectMan, CarSim::CarControlUnit, APDYNAMICART::ToolRotation, APEditorQAbilities::ObjectMovement, behindO::AvatarManipulator, behindO::EyeManipulator, behindO::Manipulator, behindO::WIM, VirtualFixture::ProxiBox, VirtualFixture::ProxiCone, VirtualFixture::ProxiCylinder, VirtualFixture::ProxiSphere, VirtualFixture::Trace, base::ShowFDH, base::ShowFDHModel, navigation::KMTracker, APSpacePartitioning::VoxelGrid_Object_Data, VirtualFixture::Avatar, behindO::HeadManipulator, ht::HeadTracking, behindO::CuttingPlane, behindO::HMDHeadManipulator, APConnectEditor::Cut, APObjectUtils::ObjectInfo, VirtualFixture::Log, base::hand, base::Rotate, behindO::ChangeOfVisibility, CarSim::Remover, PHEffect, behindO::CentreObjectManipulator, behindO::MappingFunctions, APEditorQAbilities::AvatarMovement, APEditorQAbilities::SimpleObjectMovement, APFFDEditor::EditorLogic, PHANToMAvatar, APConnectEditor::Rotation, APConnectEditor::Scale, ChessBoard, ode::Cube, APSpacePartitioning::SP_Object_Data_Base, base::Light, ArtificialWorld::WorldBuilder, APHelloWorld::MyAbility, ode::CompositeObject, ode::Sphere, ChessPiece, ode::CappedCylinder, behindO::ContactObjectManipulator, and behindO::Lens.

Member Data Documentation

AttributeMap vrecko::BaseClass::attribute
protected
MTReadWriteLock vrecko::BaseClass::attributeLock
protected
PinList vrecko::BaseClass::inputPinsList
protected

List of all input pins for this object... we know that all of them are of type InputPinBase, but the ancestor class is used, so the same methods can be used to manipulate with similar lists.

std::vector<NOTIFICATION_DESCRIPTION> vrecko::BaseClass::notifications
protected

Array with all the notifications.

MTLock vrecko::BaseClass::notificationsLock
protected

Lock to protect access to the notifications vector.

PinList vrecko::BaseClass::outputPinsList
protected

List of all input pins for this object... we know that all of them are of type OutputPinBase, but the ancestor class is used, so the same methods can be used to manipulate with similar lists.

long int vrecko::BaseClass::priority
protected

Priority.

The default priority is 0, but can be changed (even to a negative number).

See setPriority() for more information.

PinList vrecko::BaseClass::requestInputPinsList
protected

List of all input pins for this object... we know that all of them are of type RequestInputPinBase, but the ancestor class is used, so the same methods can be used to manipulate with similar lists.

PinList vrecko::BaseClass::requestOutputPinsList
protected

List of all input pins for this object... we know that all of them are of type RequestOutputPinBase, but the ancestor class is used, so the same methods can be used to manipulate with similar lists.

const std::string* vrecko::BaseClass::sceneFile
protected

Name of the scene file this component was in (and will be saved to). This will be a pointer to the shared memory pool, so don't deallocate it. (variable pointer to a const string)

std::string vrecko::BaseClass::senderString
protected

Pre-constructed sender string to be returned by the getSenderString() method.


The documentation for this class was generated from the following files: