Coin Logo http://www.sim.no
http://www.coin3d.org

Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
SoSensor Class Referenceabstract

The SoSensor class is the abstract base class for all sensors.Sensors is a mechanism in Coin for scheduling jobs to be run upon specific events. The events in question could be particular points in time, or changes to entities in the scene graph. More...

#include <Inventor/sensors/SoSensor.h>

Inheritance diagram for SoSensor:
SoDelayQueueSensor SoTimerQueueSensor SoDataSensor SoIdleSensor SoOneShotSensor SoAlarmSensor SoTimerSensor SoFieldSensor SoNodeSensor SoPathSensor

Public Member Functions

 SoSensor (void)
 
 SoSensor (SoSensorCB *func, void *data)
 
virtual ~SoSensor (void)
 
void setFunction (SoSensorCB *callbackfunction)
 
SoSensorCBPtr getFunction (void) const
 
void setData (void *callbackdata)
 
void * getData (void) const
 
virtual void schedule (void)=0
 
virtual void unschedule (void)=0
 
virtual SbBool isScheduled (void) const =0
 
virtual void trigger (void)
 
virtual SbBool isBefore (const SoSensor *s) const =0
 
void setNextInQueue (SoSensor *next)
 
SoSensorgetNextInQueue (void) const
 

Static Public Member Functions

static void initClass (void)
 

Protected Attributes

SoSensorCB * func
 
void * funcData
 

Detailed Description

The SoSensor class is the abstract base class for all sensors.

Sensors is a mechanism in Coin for scheduling jobs to be run upon specific events. The events in question could be particular points in time, or changes to entities in the scene graph.

See documentation of subclasses for insight into exactly for what types of events we can trigger sensor callbacks.

For most tasks where application programmers can use sensors, it is also possible to achieve the same results by using engines. There are a few important differences between sensors and engines, though:

Engines are considered part of the scene graph, and is written to file upon SoWriteAction export operations. Sensors, on the other hand, are not included in export operations.

Engines basically connects fields (and comes with a lot of builtin functionality for combining and converting inputs and outputs), you just decide which engine you want, connect inputs and output and forgets about it. Sensors are a lot more flexible in what you can do when they trigger, as control is transfered internally from Coin to your registered callback functions.

See also
SoSensorManager, SoEngine

Constructor & Destructor Documentation

◆ SoSensor() [1/2]

SoSensor::SoSensor ( void  )

Constructor.

◆ SoSensor() [2/2]

SoSensor::SoSensor ( SoSensorCB *  funcptr,
void *  data 
)

Constructor taking as parameters the sensor callback function func and the user data pointer which will be passed the callback.

See also
setFunction(), setData()

References setData(), and setFunction().

◆ ~SoSensor()

SoSensor::~SoSensor ( void  )
virtual

Destructor.

Member Function Documentation

◆ setFunction()

void SoSensor::setFunction ( SoSensorCB *  callbackfunction)

Set the callback function pointer which will be used when the sensor is triggered.

See also
getFunction(), setData()

References func.

Referenced by SoDB::init(), and SoSensor().

◆ getFunction()

SoSensorCB * SoSensor::getFunction ( void  ) const

Returns the callback function pointer.

See also
setFunction()

References func.

◆ setData()

void SoSensor::setData ( void *  callbackdata)

Set the user-supplied data pointer which will be used as the first argument to the sensor callback function.

See also
getData(), setFunction()

References funcData.

Referenced by SoSensor().

◆ getData()

void * SoSensor::getData ( void  ) const

Returns the user-supplied callback function data pointer.

See also
setData()

References funcData.

◆ schedule()

void SoSensor::schedule ( void  )
pure virtual

Put the sensor in a queue to be triggered at a later time.

See also
unschedule(), isScheduled()

Implemented in SoDelayQueueSensor, SoTimerSensor, SoAlarmSensor, and SoTimerQueueSensor.

◆ unschedule()

void SoSensor::unschedule ( void  )
pure virtual

Remove sensor from queue. The sensor will not be triggered unless it is later rescheduled.

See also
schedule(), isScheduled()

Implemented in SoDelayQueueSensor, SoTimerSensor, and SoTimerQueueSensor.

◆ isScheduled()

SbBool SoSensor::isScheduled ( void  ) const
pure virtual

Check if this sensor is scheduled for triggering.

See also
schedule(), unschedule()

Implemented in SoDelayQueueSensor, and SoTimerQueueSensor.

◆ trigger()

void SoSensor::trigger ( void  )
virtual

◆ isBefore()

SbBool SoSensor::isBefore ( const SoSensor s) const
pure virtual

Returns TRUE if this sensor should precede sensor s in its sensor queue.

◆ setNextInQueue()

void SoSensor::setNextInQueue ( SoSensor next)

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Open Inventor function not implemented in Coin.

◆ getNextInQueue()

SoSensor * SoSensor::getNextInQueue ( void  ) const

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. Open Inventor function not implemented in Coin.

◆ initClass()

void SoSensor::initClass ( void  )
static

Sets up initialization for static data for the sensors. Called by SoDB::init().

Referenced by SoDB::init().

Member Data Documentation

◆ func

SoSensorCB * SoSensor::func
protected

Function to be called when a sensor triggers.

Referenced by getFunction(), setFunction(), and trigger().

◆ funcData

void * SoSensor::funcData
protected

Data passed to the callback function.

Referenced by getData(), setData(), and trigger().


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

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Fri Feb 17 2017 for Coin by Doxygen. 1.8.13