H3D API  2.4.1
DeviceLog.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 //
24 //
27 //
29 #ifndef __H3DAPI_DEVICE_LOG_H__
30 #define __H3DAPI_DEVICE_LOG_H__
31 
32 #include <H3D/H3DForceEffect.h>
33 #include <H3D/X3DUrlObject.h>
34 #include <H3D/SFInt32.h>
35 #include <H3D/SFBool.h>
36 
37 #include <HAPI/DeviceLog.h>
38 
39 namespace H3D {
40 
57  class H3DAPI_API DeviceLog: public H3DForceEffect,
58  public X3DUrlObject {
59  public:
60 
61  class H3DAPI_API OnClose : public OnNewValueSField < AutoUpdate < SFBool > > {
62  virtual void onNewValue( const bool &v );
63  };
64 
66  DeviceLog( Inst< SFNode > _metadata = 0,
67  Inst< MFString > _url = 0,
68  Inst< SFInt32 > _frequency = 0,
69  Inst< MFInt32 > _deviceIndex = 0,
70  Inst< SFBool > _logBinary = 0,
71  Inst< MFString > _logData = 0,
72  Inst< OnClose > _close = 0 );
73 
78  virtual ~DeviceLog ();
79 
83  virtual void traverseSG( TraverseInfo &ti );
84 
89  H3DUniquePtr< SFInt32 > frequency;
90 
128  H3DUniquePtr< SFBool > logBinary;
129 
150  H3DUniquePtr< MFString > logData;
151 
155  H3DUniquePtr< OnClose > close;
156 
159 
160  protected:
163 
166  void createLogForceEffect( int index );
167 
169  virtual HAPI::DeviceLog* createHAPIDeviceLog ( const std::string& _url );
170 
172  HAPI::DeviceLog::LogTypeVector getLogTypes ();
173 
174  void closeFile ();
175 
176  H3DUniquePtr< Field > updateLogForceEffect;
177  };
178 
179 }
180 
181 #endif
Header file for H3DForceEffect.
Contains the SFBool field class.
Contains the SFInt32 field class.
Header file for X3DUrlObject, X3D scene-graph node.
DeviceLog records haptic device data to a binary data file.
Definition: DeviceLog.h:58
static H3DNodeDatabase database
The H3DNodeDatabase for this node.
Definition: DeviceLog.h:158
AutoRefVector< HAPI::DeviceLog > log_force_effect
Internal haptic force effect instance.
Definition: DeviceLog.h:162
H3DUniquePtr< SFInt32 > frequency
The log frequency.
Definition: DeviceLog.h:89
H3DUniquePtr< MFString > logData
Specifies what to log.
Definition: DeviceLog.h:150
H3DUniquePtr< SFBool > logBinary
If true the logging will be done to a binary file.
Definition: DeviceLog.h:128
H3DUniquePtr< OnClose > close
If set to true the log file is closed immediately.
Definition: DeviceLog.h:155
The base class for scenegraph force effects.
Definition: H3DForceEffect.h:39
Template for adding the virtual function onNewValue that can be overridden in subclasses in order to ...
Definition: FieldTemplates.h:79
TraverseInfo is a structure that is passed along when traversing the scene graph.
Definition: TraverseInfo.h:57
This abstract interface is inherited by all nodes that contain data located on the World Wide Web,...
Definition: X3DUrlObject.h:51
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