![]() |
http://www.sim.no http://www.coin3d.org |
#include <Inventor/SoDB.h>
This class collects various methods for initializing, setting and accessing common global data from the Coin library.
All methods on SoDB are static.
Make sure you call SoDB::init() (either directly or indirectly through the init() method of the GUI glue library) before you use any of the other Coin classes.
Public Types | |
typedef SbBool | ProgressCallbackType (const SbName &itemid, float fraction, SbBool interruptible, void *userdata) |
Static Public Member Functions | |
void | init (void) |
void | cleanup (void) |
const char * | getVersion (void) |
SbBool | read (SoInput *in, SoPath *&path) |
SbBool | read (SoInput *in, SoBase *&base) |
SbBool | read (SoInput *in, SoNode *&rootnode) |
SoSeparator * | readAll (SoInput *in) |
SoVRMLGroup * | readAllVRML (SoInput *in) |
SbBool | isValidHeader (const char *teststring) |
SbBool | registerHeader (const SbString &headerstring, SbBool isbinary, float ivversion, SoDBHeaderCB *precallback, SoDBHeaderCB *postcallback, void *userdata=NULL) |
SbBool | getHeaderData (const SbString &headerstring, SbBool &isbinary, float &ivversion, SoDBHeaderCB *&precallback, SoDBHeaderCB *&postcallback, void *&userdata, SbBool substringok=0) |
int | getNumHeaders (void) |
SbString | getHeaderString (const int i) |
SoField * | createGlobalField (const SbName &name, SoType type) |
SoField * | getGlobalField (const SbName &name) |
void | renameGlobalField (const SbName &from, const SbName &to) |
void | setRealTimeInterval (const SbTime &interval) |
const SbTime & | getRealTimeInterval (void) |
void | enableRealTimeSensor (SbBool on) |
SoSensorManager * | getSensorManager (void) |
void | setDelaySensorTimeout (const SbTime &t) |
const SbTime & | getDelaySensorTimeout (void) |
int | doSelect (int nfds, void *readfds, void *writefds, void *exceptfds, struct timeval *usertimeout) |
void | addConverter (SoType from, SoType to, SoType converter) |
SoType | getConverter (SoType from, SoType to) |
SbBool | isInitialized (void) |
void | startNotify (void) |
SbBool | isNotifying (void) |
void | endNotify (void) |
void | addProgressCallback (ProgressCallbackType *func, void *userdata) |
void | removeProgressCallback (ProgressCallbackType *func, void *userdata) |
SbBool | isMultiThread (void) |
void | readlock (void) |
void | readunlock (void) |
void | writelock (void) |
void | writeunlock (void) |
|
Client code progress callback function must be static functions of this type. The itemid argument is a unique text identifier which says what is being processed (use this for any GUI progress bar informational text), and fraction is a value in the range [0, 1] which indicates how far the process has got. If the task is successfully aborted, the callback will be invoked a last time with fraction set to -1.0. The return value is an abort flag indication from the client code. Note that the process that is being run can only be aborted if the interruptible flag is set. See SoDB::addProgressCallback() for full documentation of how the progress notification mechanism works. |
|
Initialize the Coin system. This needs to be done as the first thing before you start using the library, or you'll probably see an early crash. |
|
Invoke this method as the last call of the application code, to trigger a clean-up of all static resources used by the Coin library. This is usually not necessary for stand-alone executable applications, as the operating system will take care of cleaning up after the process as it exits. It may be necessary to invoke this method to avoid leaks for "special" execution environments, though, like if the Coin library is used as e.g. a browser plug-in, or some other type of component which can be started, shut down and restarted multiple times. |
|
Returns a text string containing the name of the library and version information. |
|
Instantiates and reads an SoPath object from in and returns a pointer to it in path. The reference count of the SoPath object will initially be zero.
Returns |
|
Instantiates and reads an object of type SoBase from in and returns a pointer to it in base. base will be The reference count of the base object will initially be zero.
Returns |
|
Instantiates and reads an object of type SoNode from in and returns a pointer to it in rootnode. The reference count of the node will initially be zero.
Returns |
|
Reads all graphs from in and returns them under an SoSeparator node. If the file contains only a single graph under an SoSeparator node (which is the most common way of constructing and exporting scene graphs), no extra SoSeparator root node will be made, but the returned root node will be the top-most node from the file. The reference count of the root separator returned from this method will be zero. Other nodes in the returned scene graph will have reference counts according to the number of parent-child relationships, as usual. The common layout for how to load, work with and then finally destruct and return memory resources of scenegraphs usually goes like this:
Returns Tip: a common operation to do after importing a scene graph is to pick out the memory pointers to one or more of the imported nodes for further handling. This can be accomplished by using either the SoNode::getByName() function (which is the easier approach) or by using an instance of the SoSearchAction class (which is the more complex but also more flexible approach). |
|
Same as SoDB::readAll(), except it return an SoVRMLGroup instead of an SoSeparator.
|
|
Check if testString is a valid file format header identifier string.
|
|
Register a header string which should be recognized by SoInput upon file import. This is a convenient way for library users to register their own VRML or Coin derived file formats.
Set isbinary to Callbacks precallback and postcallback will be called before and after importing the custom format.
If headerstring can not be accepted as a valid file format header for Coin files,
|
|
Returns the settings for the given headerstring, if headerstring is a valid header.
If substringok is
If no valid header string by this name is found,
|
|
Returns number of registered file headers.
|
|
Returns the identifier header string of index i.
|
|
Create a new global field by the given type, and identified in subsequent accesses to getGlobalField() by name. If a global field by the name and type already exists, returns a pointer to it. If a global field with the same name but a different type exists, returns A global field can be deallocated by calling SoDB::renameGlobalField(), with the second argument set to an empty string.
|
|
If there exist a global field with the given name, return a pointer to it. If there is no field with this name, return
Of particular interest is the If you want to control the speed of "action" of a scene with animating / moving components (for instance for doing fixed frame-time snapshots for generating a movie), grab the global field named "realTime" and use it in the manner depicted in the class documentation of the SoOffscreenRenderer class.
|
|
Rename a global field. If to is an empty name, the from field gets deleted. If another global field already goes by the name to, that field will get deleted before the rename operation.
|
|
Set the time interval between updates for the Setting the interval to a zero time will disable automatic updates of the realTime field.
|
|
Returns the current trigger interval for the global realTime SbTime field.
|
|
Turn on or off the realtime sensor. The most common use for turning the realtime sensor off is to control the realTime global field from the user application. This is for instance handy when you want to take screen snapshots at fixed intervals. See the class documentation of SoOffscreenRenderer for further information.
|
|
Returns a pointer to the global sensor manager. The sensor manager keeps track of the sensor queues. |
|
This is just a wrapper for the method in SoSensorManager by the same name.
|
|
This is just a wrapper for the method in SoSensorManager by the same name.
|
|
NOTE: THIS METHOD IS OBSOLETED. DON'T USE IT.
This is a wrapper around the POSIX The void* arguments must be valid pointers to fd_set structures. We've changed this from the original SGI Inventor API to avoid messing up the header file with system-specific includes. NOTE: THIS METHOD IS OBSOLETED. DON'T USE IT. |
|
Notify SoDB that there exists a way to convert data from the from SoField type to the to SoField type, by connecting them with an instance of the converter SoFieldConverter type. By doing this, SoDB::getConverter() will later be able to automatically return the type of the correct conversion class when requested. Coin internally provides conversion between most field types, so application programmers should usually not need to use this function. The exception is if you are writing your own field type classes, and want to be able to connect them to the internal field types (or other extensions field types).
|
|
Return the type of an SoFieldConverter class which is able to convert data between fields of type from to the data field(s) of field type to. If no conversion between the given field types is possible, returns SoType::badType().
|
|
Returns
|
|
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. |
|
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. |
|
This API member is considered internal to the library, as it is not likely to be of interest to the application programmer. |
|
The concept behind progress information in Coin is that any internal process which may take a long time to complete (like e.g. file import for huge scenes) can pass on progress information by calling back to a progress callback set up by the code of the client application. The client's progress callback's function signature must match the SoDB::ProgressCallbackType. The mechanism works by enforcing that all progress notification from within Coin must
One important thing to note about the mechanism is that processes with progress callbacks can be running within other processes using the progress callback functionality. Progress information will then have to be considered to be "stacked", and client code must be aware of and treat this properly. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.
|
|
Removes a progress callback function, which will no longer be invoked. |
|
Returns |
|
Places a read lock on the global SoDB mutex. This can be used to synchronize between threads that are reading/writing Coin scene graphs. If you call this function, you must make sure that you also call SoDB::readunlock(). If you fail to do this, you might experience that your application locks up. All Coin actions has a read-lock on the global SoDB mutex while traversing the scene graph. The function name needs to be lowercase-only to be compatible with TGS Inventor.
|
|
Unlocks the read lock on the global SoDB mutex. The function name needs to be lowercase-only to be compatible with TGS Inventor.
|
|
Places a write lock on the global SoDB mutex. This can be used to prevent that the scene graph is read or traversed while you modify the scene graph. If you call this function, you must make sure that you also call SoDB::writeunlock(). If you fail to do this, you might experience that your application locks up. The function name needs to be lowercase-only to be compatible with TGS Inventor.
|
|
Unlocks the write lock on the global SoDB mutex. The function name needs to be lowercase-only to be compatible with TGS Inventor.
|
Copyright © 1998-2004 by Systems in Motion AS. All rights reserved.
Generated on Wed Jul 28 00:04:26 2004 for Coin by Doxygen. 1.3.7