Open Inventor Reference
SoOneShot Class Reference

Timer that runs for a pre-set amount of time. More...

#include <Inventor/engines/SoOneShot.h>

Inheritance diagram for SoOneShot:
SoEngine SoFieldContainer SoBase

List of all members.

Public Types

enum  Flags { RETRIGGERABLE = (1<<0), HOLD_FINAL = (1<<1) }

Public Member Functions

 SoOneShot ()
 Constructor.

Static Public Member Functions

static void initClass ()
 Initializes base engine class.

Public Attributes

Inputs
SoSFTime duration
 Duration of the active cycle.
SoSFTrigger trigger
 Start the cycle.
SoSFBitMask flags
 Control flags.
SoSFBool disable
 If TRUE, the timer is disabled.
SoSFTime timeIn
 Running time.
Outputs
SoEngineOutput timeOut
 Elapsed time from the start.
SoEngineOutput isActive
 Is TRUE during the active cycle.
SoEngineOutput ramp
 Ramps linearly from 0.0 to 1.0.

Protected Member Functions

virtual void inputChanged (SoField *whichInput)
 This is called whenever the value of an input is changed.
virtual void writeInstance (SoOutput *out)
 Writes instance to SoOutput.
virtual SbBool readInstance (SoInput *in, unsigned short flags)
 Reads stuff into instance.

Detailed Description

This engine is a timer that runs for a pre-set amount of time and then stops. By default, the timeIn input is connected to the realTime global field. It can, however, by connected to any other time source.

The timer is started when the trigger input is touched. It then runs for the specified duration , and updates the timeOut output with the time that has elapsed. During that time, the ramp output is also updated. The ramp output starts at 0.0 at the beginning of the cycle, and linearly increases until it reaches 1.0 at the end of the cycle.

You can disable the timer by setting the disable input to TRUE. The output value remains 0.0 while the timer is disabled. If the timer is disabled in the middle of a cycle the output values will be set to 0.0.

The flags input contains control flags. Using the flags you can set the timer to be retriggerable in the middle of a cycle, and set the output values to stay high after the cycle has been completed. By default, these flags are not set.

File Format/Default
OneShot {
  duration 1
  flags ()
  disable FALSE
  timeIn 1316437066.408
}
See Also
SoElapsedTime, SoEngineOutput

Definition at line 114 of file SoOneShot.h.


Member Enumeration Documentation

Enumerator:
RETRIGGERABLE 

can start over during cycle?

HOLD_FINAL 

ramp & timeOut stay high after cycle?

Definition at line 119 of file SoOneShot.h.


Constructor & Destructor Documentation

SoOneShot::SoOneShot ( )

Member Function Documentation

static void SoOneShot::initClass ( ) [static]

Reimplemented from SoEngine.

virtual void SoOneShot::inputChanged ( SoField whichField) [protected, virtual]

The default method does nothing. Subclasses can override this to detect when a specific field is changed.

Reimplemented from SoEngine.

virtual SbBool SoOneShot::readInstance ( SoInput in,
unsigned short  flags 
) [protected, virtual]

Works around a problem with old files that contain explicit references to the default connection to realTime.

Reimplemented from SoEngine.

virtual void SoOneShot::writeInstance ( SoOutput out) [protected, virtual]

Takes care of not writing out connection to realTime that is created in constructor.

Reimplemented from SoEngine.


Member Data Documentation

Definition at line 139 of file SoOneShot.h.

Definition at line 128 of file SoOneShot.h.

Definition at line 136 of file SoOneShot.h.

Definition at line 153 of file SoOneShot.h.

Definition at line 156 of file SoOneShot.h.

Definition at line 142 of file SoOneShot.h.

Definition at line 150 of file SoOneShot.h.

The trigger will be ignored if it is touched in the middle of a cycle and the RETRIGGERABLE flag is not set.

Definition at line 133 of file SoOneShot.h.


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