H3D API  2.4.1
IntegerTrigger.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 __INTEGERTRIGGER_H__
30 #define __INTEGERTRIGGER_H__
31 
32 #include <H3D/X3DTriggerNode.h>
33 #include <H3D/SFBool.h>
34 #include <H3D/SFInt32.h>
35 
36 namespace H3D {
37 
54 
55  class H3DAPI_API IntegerTrigger : public X3DTriggerNode {
56  public:
57 
60  class H3DAPI_API SetTriggerValue: public AutoUpdate< TypedField < SFInt32, SFBool > > {
61  protected:
62  virtual void update() {
63  IntegerTrigger *bf =
64  static_cast< IntegerTrigger * >( getOwner() );
65  value = bf->integerKey->getValue();
66  }
67  };
68 #ifdef __BORLANDC__
69  friend class SetTriggerValue;
70 #endif
71 
73  IntegerTrigger( Inst< SFNode > _metadata = 0,
74  Inst< SFBool > _set_boolean = 0,
75  Inst< SFInt32 > _integerKey = 0,
76  Inst< SetTriggerValue > _triggerValue = 0);
77 
84  H3DUniquePtr< SFBool > set_boolean;
85 
91  H3DUniquePtr< SFInt32 > integerKey;
92 
98  H3DUniquePtr< SetTriggerValue > triggerValue;
99 
102  };
103 }
104 
105 #endif
Contains the SFBool field class.
Contains the SFInt32 field class.
Header file for X3DTriggerNode, X3D scene-graph node.
The SetTriggerValue class is specialize to set the vaule of the triggerValue field to the value of th...
Definition: IntegerTrigger.h:60
IntegerTrigger handles single field Boolean events to set an integer value for the output event.
Definition: IntegerTrigger.h:55
static H3DNodeDatabase database
The H3DNodedatabase for this node.
Definition: IntegerTrigger.h:101
H3DUniquePtr< SetTriggerValue > triggerValue
TriggerValue will be set if a set_boolean event is recieved.
Definition: IntegerTrigger.h:98
H3DUniquePtr< SFInt32 > integerKey
Contains the value triggerValue will be set to.
Definition: IntegerTrigger.h:91
H3DUniquePtr< SFBool > set_boolean
When an event is recieved generate triggerValue event with current value of integerKey.
Definition: IntegerTrigger.h:84
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