H3D API  2.4.1
TimeTrigger.h
Go to the documentation of this file.
1 // Copyright 2004-2019, SenseGraphics AB
3 //
4 // This file is part of H3D API.
5 //
6 // H3D API is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 2 of the License, or
9 // (at your option) any later version.
10 //
11 // H3D API is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with H3D API; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 //
20 // A commercial license is also available. Please contact us at
21 // www.sensegraphics.com for more information.
22 //
23 //
27 //
29 #ifndef __TIMETRIGGER_H__
30 #define __TIMETRIGGER_H__
31 
32 #include <H3D/X3DTriggerNode.h>
33 #include <H3D/SFBool.h>
34 #include <H3D/SFTime.h>
35 
36 namespace H3D {
37 
53 
54  class TimeTrigger : public X3DTriggerNode {
55  public:
56 
59  class SetTriggerTime: public AutoUpdate< TypedField < SFTime, SFBool > > {
60  protected:
61  virtual void update() {
62  TimeStamp theTime;
63  value = theTime;
64  }
65  };
66 #ifdef __BORLANDC__
67  friend class SetTriggerTime;
68 #endif
69 
71  TimeTrigger( Inst< SFNode > _metadata = 0,
72  Inst< SFBool > _set_boolean = 0,
73  Inst< SetTriggerTime > _triggerTime = 0 );
74 
81  H3DUniquePtr< SFBool > set_boolean;
82 
88  H3DUniquePtr< SetTriggerTime > triggerTime;
89 
92  };
93 }
94 
95 #endif
Contains the SFBool field class.
Contains the SFTime field class.
Header file for X3DTriggerNode, X3D scene-graph node.
The SetTriggerTime class is specialize to set the vaule of the triggerTime field to the current time.
Definition: TimeTrigger.h:59
TimeTrigger is a trigger node that generates time events upon receiving boolean events.
Definition: TimeTrigger.h:54
H3DUniquePtr< SFBool > set_boolean
When an event is received store the current time in triggerTime.
Definition: TimeTrigger.h:81
static H3DNodeDatabase database
The H3DNodedatabase for this node.
Definition: TimeTrigger.h:91
H3DUniquePtr< SetTriggerTime > triggerTime
Contains the current time when an event has been generated.
Definition: TimeTrigger.h:88
TimeTrigger(Inst< SFNode > _metadata=0, Inst< SFBool > _set_boolean=0, Inst< SetTriggerTime > _triggerTime=0)
Constructor.
Definition: TimeTrigger.cpp:47
This abstract node type is the base node type from which all Triggers are derived.
Definition: X3DTriggerNode.h:41
H3D API namespace.
Definition: Anchor.h:38
The AutoUpdate field is a template to force the BaseField to update itself as soon as an event is rec...
Definition: FieldTemplates.h:130
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194