Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoDB.h
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
41class SbName;
42class SbTime;
43class SoBase;
44class SoField;
45class SoInput;
46class SoNode;
47class SoPath;
48class SoSeparator;
49class SoVRMLGroup;
50class SoGroup;
51
52typedef void SoDBHeaderCB(void * data, SoInput * input);
53
54
56public:
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
122private:
123 static SoGroup * readAllWrapper(SoInput * input, const SoType & grouptype);
124};
125
126#endif // !COIN_SODB_H
The SbList class is a template container class for lists.
Definition SbList.h:70
The SbName class stores strings by reference.
Definition SbName.h:40
The SbString class is a string class with convenience functions for string operations.
Definition SbString.h:52
The SbTime class instances represents time values.
Definition SbTime.h:50
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition SoBase.h:45
The SoDB class keeps track of internal global data.
Definition SoDB.h:55
SbBool ProgressCallbackType(const SbName &itemid, float fraction, SbBool interruptible, void *userdata)
Definition SoDB.h:106
The SoField class is the top-level abstract base class for fields.
Definition SoField.h:47
The SoGroup class is a node which managed other node instances.
Definition SoGroup.h:40
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:61
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
The SoSensorManager class handles the sensor queues.
Definition SoSensorManager.h:43
The SoSeparator class is a state-preserving group node.
Definition SoSeparator.h:44
The SoType class is the basis for the runtime type system in Coin.
Definition SoType.h:59
The SoVRMLGroup class is used for grouping VRML nodes.
Definition SoVRMLGroup.h:45