H3D API  2.4.1
Public Member Functions | Protected Attributes | List of all members
H3D::H3DFakeHapticsDevice::GetValueSafeField< BaseField > Class Template Reference

A field which ensure that getValue and only getValue can be called within haptic thread with thread safety. More...

#include <H3D/H3DFakeHapticsDevice.h>

Inheritance diagram for H3D::H3DFakeHapticsDevice::GetValueSafeField< BaseField >:
Inheritance graph

Public Member Functions

 GetValueSafeField ()
 Constructor.
 
virtual const BaseField::value_type & getValue (int _id=0)
 Get the value of the field.
 
virtual void update ()
 update can not happens in non-main thread
 
virtual void upToDate ()
 Make sure that the field is up-to-date, but never in non-main thread.
 
virtual void setValue (const typename BaseField::value_type &v, int _id=0)
 Set the value of the field, also only allowed in main thread.
 
- Public Member Functions inherited from H3D::PeriodicUpdate< BaseField >
 PeriodicUpdate (H3DFloat _period=0, PeriodType _period_type=COUNT)
 Constructor.
 
 ~PeriodicUpdate ()
 Destructor.
 
virtual bool timeToUpdate ()
 Determines if it is time to check that the field is updated. More...
 
void setPeriodType (PeriodType type)
 Set the type of the period.
 
void setPeriod (H3DFloat _period)
 Set the period for the update.
 
- Public Member Functions inherited from H3D::PeriodicUpdateField
virtual ~PeriodicUpdateField ()
 Destructor.
 

Protected Attributes

BaseField::value_type value_for_haptic
 value to be used for haptic thread
 
- Protected Attributes inherited from H3D::PeriodicUpdate< BaseField >
PeriodType period_type
 The tye of the period.
 
H3DFloat period
 The period of automatic updates/.
 
TimeStamp last_up_to_date
 The time of the last call to upToDate.
 
unsigned int counter
 The number of calls to timeToUpdate() since the last update.
 

Additional Inherited Members

- Public Types inherited from H3D::PeriodicUpdate< BaseField >
enum  PeriodType
 Type defining how the period should be interpreted.
 

Detailed Description

template<class BaseField>
class H3D::H3DFakeHapticsDevice::GetValueSafeField< BaseField >

A field which ensure that getValue and only getValue can be called within haptic thread with thread safety.


Note: All other function such as setValue, upToDate is not allowed to called within haptic thread. The actual value update happens in main thread either through explicitly calling getValue or upToDate or wait until the end of the main thread loop let PeriodicUpdate update itself. Note2: getValue() can only be called within either in haptic thread or main thread. All other type of threads are not allowed


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