Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

SoDB Class Reference

The SoDB class keeps track of internal global data. More...

#include <Inventor/SoDB.h>

List of all members.

Static Public Methods

void init (void)
const char * getVersion (void)
SbBool read (SoInput *in, SoPath *&path)
SbBool read (SoInput *in, SoBase *&base)
SbBool read (SoInput *in, SoNode *&rootnode)
SoSeparatorreadAll (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=FALSE)
int getNumHeaders (void)
SbString getHeaderString (const int i)
SoFieldcreateGlobalField (const SbName &name, SoType type)
SoFieldgetGlobalField (const SbName &name)
void renameGlobalField (const SbName &from, const SbName &to)
void setRealTimeInterval (const SbTime &interval)
const SbTimegetRealTimeInterval (void)
void enableRealTimeSensor (SbBool on)
SoSensorManagergetSensorManager (void)
void setDelaySensorTimeout (const SbTime &t)
const SbTimegetDelaySensorTimeout (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)


Detailed Description

The SoDB class keeps track of internal global data.

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.


Member Function Documentation

void SoDB::init void [static]
 

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.

const char * SoDB::getVersion void [static]
 

Returns a text string containing the name of the library and version information.

SbBool SoDB::read SoInput * in,
SoPath *& path
[static]
 

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 FALSE on error. Returns TRUE with path equal to NULL if we hit end of file instead of a new path specification in the file.

SbBool SoDB::read SoInput * in,
SoBase *& base
[static]
 

Instantiates and reads an object of type SoBase from in and returns a pointer to it in base. base will be NULL on return if we hit end of file.

The reference count of the base object will initially be zero.

Returns FALSE on error.

SbBool SoDB::read SoInput * in,
SoNode *& rootnode
[static]
 

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 FALSE on error. Returns TRUE with rootnode equal to NULL if we hit end of file instead of a new node specification in the file.

SoSeparator * SoDB::readAll SoInput * in [static]
 

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:

  // [snip]
  SoSeparator * root = SoDB::readAll(&input); 
  if (!root) { exit(1); }

  // root-node returned from SoDB::readAll() has initial zero
  // ref-count, so reference it before we start using it to
  // avoid premature destruction.
  root->ref();

  // [do your thing here -- rendering of the scene, whatever]

  // Bring ref-count of root-node back to zero to cause the
  // destruction of the scene.
  root->unref();
  // (Upon self-destructing, the root-node will also de-reference
  // it's children nodes, so they also self-destruct, and so on
  // recursively down the scenegraph hierarchy until the complete
  // scenegraph has self-destructed and thereby returned all
  // memory resources it was using up.)

Returns NULL on any error.

SbBool SoDB::isValidHeader const char * teststring [static]
 

Check if testString is a valid file format header identifier string.

See also:
getHeaderData(), registerHeader()

SbBool SoDB::registerHeader const SbString & headerstring,
SbBool isbinary,
float ivversion,
SoDBHeaderCB * precallback,
SoDBHeaderCB * postcallback,
void * userdata = NULL
[static]
 

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 TRUE if the file should be read as binary data, and set ivversion to indicate which Coin library version is needed to read the file.

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, FALSE will be returned. A valid header must start with a '#' character, and not be more than 80 characters long.

See also:
getHeaderData()

SbBool SoDB::getHeaderData const SbString & headerstring,
SbBool & isbinary,
float & ivversion,
SoDBHeaderCB *& precallback,
SoDBHeaderCB *& postcallback,
void *& userdata,
SbBool substringok = FALSE
[static]
 

Returns the settings for the given headerstring, if headerstring is a valid header.

If substringok is TRUE, ignore trailing characters in headerstring when checking for validity.

If no valid header string by this name is found, FALSE is returned, otherwise TRUE will be returned, and the other input arguments will be set to their respective values.

See also:
isValidHeader(), registerHeader()

int SoDB::getNumHeaders void [static]
 

Returns number of registered file headers.

See also:
getHeaderString()

SbString SoDB::getHeaderString const int i [static]
 

Returns the identifier header string of index i.

See also:
getNumHeaders(), getHeaderData()

SoField * SoDB::createGlobalField const SbName & name,
SoType type
[static]
 

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 NULL.

See also:
getGlobalField(), renameGlobalField()

SoField * SoDB::getGlobalField const SbName & name [static]
 

If there exist a global field with the given name, return a pointer to it. If there is no field with this name, return NULL.

See also:
createGlobalField(), renameGlobalField()

void SoDB::renameGlobalField const SbName & from,
const SbName & to
[static]
 

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.

See also:
getGlobalField(), createGlobalField()

void SoDB::setRealTimeInterval const SbTime & interval [static]
 

Set the time interval between updates for the realTime global field to interval. Default value is 1/12 s.

See also:
getRealTimeInterval(), getGlobalField()

const SbTime & SoDB::getRealTimeInterval void [static]
 

Returns the current trigger interval for the global realTime SbTime field.

See also:
setRealTimeInterval(), getGlobalField()

void SoDB::enableRealTimeSensor SbBool on [static]
 

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 also:
setRealTimeInterval()

SoSensorManager * SoDB::getSensorManager void [static]
 

Returns a pointer to the global sensor manager. The sensor manager keeps track of the sensor queues.

void SoDB::setDelaySensorTimeout const SbTime & t [static]
 

This is just a wrapper for the method in SoSensorManager by the same name.

See also:
getDelaySensorTimeout(), SoSensorManager

const SbTime & SoDB::getDelaySensorTimeout void [static]
 

This is just a wrapper for the method in SoSensorManager by the same name.

See also:
setDelaySensorTimeout(), SoSensorManager

int SoDB::doSelect int nfds,
void * readfds,
void * writefds,
void * exceptfds,
struct timeval * usertimeout
[static]
 

This is a wrapper around the POSIX select() call. It is provided so you can do synchronous I/O while Coin continous to handle sensor events, rendering, etc. The parameters are the same as for select(), so check your system documentation on how to use them.

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.

void SoDB::addConverter SoType from,
SoType to,
SoType converter
[static]
 

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).

See also:
createConverter(), SoFieldConverter

SoType SoDB::getConverter SoType from,
SoType to
[static]
 

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().

See also:
addConverter()

SbBool SoDB::isInitialized void [static]
 

Returns TRUE if init() has been called.

See also:
init()

void SoDB::startNotify void [static]
 

For internal use only.

SbBool SoDB::isNotifying void [static]
 

For internal use only.

void SoDB::endNotify void [static]
 

For internal use only.


The documentation for this class was generated from the following files:
Generated at Tue Mar 5 03:31:23 2002 for Coin by doxygen1.2.9 written by Dimitri van Heesch, © 1997-2001