Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoDB.h
Go to the documentation of this file.
1 #ifndef COIN_SODB_H
2 #define COIN_SODB_H
3 
4 /**************************************************************************\
5  * Copyright (c) Kongsberg Oil & Gas Technologies AS
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met:
11  *
12  * Redistributions of source code must retain the above copyright notice,
13  * this list of conditions and the following disclaimer.
14  *
15  * Redistributions in binary form must reproduce the above copyright
16  * notice, this list of conditions and the following disclaimer in the
17  * documentation and/or other materials provided with the distribution.
18  *
19  * Neither the name of the copyright holder nor the names of its
20  * contributors may be used to endorse or promote products derived from
21  * this software without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 \**************************************************************************/
35 
36 #include <Inventor/SbBasic.h>
37 #include <Inventor/SbString.h>
38 #include <Inventor/SoType.h>
39 #include <Inventor/sensors/SoSensorManager.h>
40 
41 class SbName;
42 class SbTime;
43 class SoBase;
44 class SoField;
45 class SoInput;
46 class SoNode;
47 class SoPath;
48 class SoSeparator;
49 class SoVRMLGroup;
50 class SoGroup;
51 
52 typedef void SoDBHeaderCB(void * data, SoInput * input);
53 
54 
55 class COIN_DLL_API SoDB {
56 public:
57  static void init(void);
58  static void finish(void);
59  static void cleanup(void);
60 
61  static const char * getVersion(void);
62  static SbBool read(SoInput * input, SoPath *& path);
63  static SbBool read(SoInput * input, SoBase *& base);
64  static SbBool read(SoInput * input, SoNode *& rootnode);
65  static SoSeparator * readAll(SoInput * input);
66  static SoVRMLGroup * readAllVRML(SoInput * input);
67  static SbBool isValidHeader(const char * teststring);
68  static SbBool registerHeader(const SbString & headerstring,
69  SbBool isbinary,
70  float ivversion,
71  SoDBHeaderCB * precallback,
72  SoDBHeaderCB * postcallback,
73  void * userdata = NULL);
74  static SbBool getHeaderData(const SbString & headerstring,
75  SbBool & isbinary,
76  float & ivversion,
77  SoDBHeaderCB *& precallback,
78  SoDBHeaderCB *& postcallback,
79  void *& userdata,
80  SbBool substringok = FALSE);
81  static int getNumHeaders(void);
82  static SbString getHeaderString(const int i);
83  static SoField * createGlobalField(const SbName & name, SoType type);
84  static SoField * getGlobalField(const SbName & name);
85  static void renameGlobalField(const SbName & from, const SbName & to);
86 
87  static void setRealTimeInterval(const SbTime & interval);
88  static const SbTime & getRealTimeInterval(void);
89  static void enableRealTimeSensor(SbBool on);
90 
91  static SoSensorManager * getSensorManager(void);
92  static void setDelaySensorTimeout(const SbTime & t);
93  static const SbTime & getDelaySensorTimeout(void);
94  static int doSelect(int nfds, void * readfds, void * writefds,
95  void * exceptfds, struct timeval * usertimeout);
96 
97  static void addConverter(SoType from, SoType to, SoType converter);
98  static SoType getConverter(SoType from, SoType to);
99 
100  static SbBool isInitialized(void);
101 
102  static void startNotify(void);
103  static SbBool isNotifying(void);
104  static void endNotify(void);
105 
106  typedef SbBool ProgressCallbackType(const SbName & itemid, float fraction,
107  SbBool interruptible, void * userdata);
108  static void addProgressCallback(ProgressCallbackType * func, void * userdata);
109  static void removeProgressCallback(ProgressCallbackType * func, void * userdata);
110 
111  static SbBool isMultiThread(void);
112  static void readlock(void);
113  static void readunlock(void);
114  static void writelock(void);
115  static void writeunlock(void);
116 
117  static void createRoute(SoNode * from, const char * eventout,
118  SoNode * to, const char * eventin);
119  static void removeRoute(SoNode * from, const char * eventout,
120  SoNode * to, const char * eventin);
121 
122 private:
123  static SoGroup * readAllWrapper(SoInput * input, const SoType & grouptype);
124 };
125 
126 #endif // !COIN_SODB_H
The SoBase class is the top-level superclass for a number of class-hierarchies.SoBase provides the ba...
Definition: SoBase.h:45
The SoDB class keeps track of internal global data.This class collects various methods for initializi...
Definition: SoDB.h:55
The SoField class is the top-level abstract base class for fields.Fields is the mechanism used throug...
Definition: SoField.h:47
The SoNode class is the base class for nodes used in scene graphs.Coin is a retained mode 3D visualiz...
Definition: SoNode.h:56
The SoPath class is a container class for traversal path descriptions.SoPath objects contain a list o...
Definition: SoPath.h:52
The SoGroup class is a node which managed other node instances.The internal scene data structures in ...
Definition: SoGroup.h:40
void SoDBHeaderCB(void *data, SoInput *input)
Definition: SoDB.h:52
The SbTime class instances represents time values.SbTime is a convenient way of doing system independ...
Definition: SbTime.h:50
SbBool ProgressCallbackType(const SbName &itemid, float fraction, SbBool interruptible, void *userdata)
Definition: SoDB.h:106
The SoInput class is an abstraction of file import functionality.This class takes care of most of the...
Definition: SoInput.h:61
The SoSensorManager class handles the sensor queues.There are two major sensor types in Coin...
Definition: SoSensorManager.h:43
The SoVRMLGroup class is used for grouping VRML nodes.The detailed class documentation is taken verba...
Definition: SoVRMLGroup.h:44
The SbString class is a string class with convenience functions for string operations.This is the class used for storing and working with character strings. It automatically takes care of supporting all the "bookkeeping" tasks usually associated with working with character strings, like memory allocation and deallocation etc.
Definition: SbString.h:52
The SoSeparator class is a state-preserving group node.Subgraphs parented by SoSeparator nodes will n...
Definition: SoSeparator.h:44
The SoType class is the basis for the run-time type system in Coin.Many of the classes in the Coin li...
Definition: SoType.h:59
The SbName class stores strings by reference.The class is used by Coin for storing keywords...
Definition: SbName.h:40