H3D API  2.4.1
DeviceInfo.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 __DEVICEINFO_H__
30 #define __DEVICEINFO_H__
31 
32 #include <H3D/X3DBindableNode.h>
33 #include <H3D/H3DHapticsDevice.h>
34 #include <H3D/MFNode.h>
35 
36 namespace H3D {
46  class H3DAPI_API DeviceInfo : public X3DBindableNode {
47  public:
49 
51  DeviceInfo( Inst< SFSetBind > _set_bind = 0,
52  Inst< SFNode > _metadata = 0,
53  Inst< SFTime > _bindTime = 0,
54  Inst< SFBool > _isBound = 0,
55  Inst< MFDevice > _device = 0 );
56 
57  virtual ~DeviceInfo() {
58  removeFromStack();
59  deviceinfos.remove( this );
60  }
61 
63  static inline DeviceInfo *getActive() {
64  return static_cast< DeviceInfo * >( X3DBindableNode::getActive( "DeviceInfo" ) );
65  }
66 
68  virtual void initialize();
69 
71  virtual void toStackTop();
72 
74  virtual void removeFromStack();
75 
77  virtual void renderStyli();
78 
82  H3DUniquePtr< MFDevice > device;
83 
84  typedef list< DeviceInfo * > DeviceInfoList;
85 
87  static const DeviceInfoList &getAllDeviceInfos() {
88  return deviceinfos;
89  }
90 
91  static H3DNodeDatabase database;
92 
93  protected:
94  static DeviceInfoList deviceinfos;
95  };
96 }
97 
98 #endif
Header file for H3DHapticsDevice.
Contains the MFNode class.
Header file for X3DBindableNode, X3D scene-graph node.
DeviceInfo is a X3DBindableNode that contains the devices that are used with the API.
Definition: DeviceInfo.h:46
static const DeviceInfoList & getAllDeviceInfos()
Returns a list of all current DeviceInfo instances.
Definition: DeviceInfo.h:87
static DeviceInfo * getActive()
Convenience function to get the top of the DeviceInfo stack.
Definition: DeviceInfo.h:63
H3DUniquePtr< MFDevice > device
Contains the devices in this DeviceInfo instance.
Definition: DeviceInfo.h:82
Template to make sure that the Nodes that are added to a MFNode are of a specified Node type.
Definition: MFNode.h:221
X3DBindableNode is the abstract base type for all bindable children nodes, including Background,...
Definition: X3DBindableNode.h:108
static X3DBindableNode * getActive(const string &bindable_stack_name)
Returns the active bindable instance, i.e.
Definition: X3DBindableNode.h:149
H3D API namespace.
Definition: Anchor.h:38
The H3DNodeDatabase contains a mapping between a name of a Node and the constructor for the Node with...
Definition: H3DNodeDatabase.h:194