# SoDB.h

    00001 #ifndef COIN_SODB_H
    00002 #define COIN_SODB_H
    00003
    00004 /**************************************************************************\
    00005  *
    00006  *  This file is part of the Coin 3D visualization library.
    00007  *  Copyright (C) 1998-2003 by Systems in Motion.  All rights reserved.
    00008  *
    00009  *  This library is free software; you can redistribute it and/or
    00010  *  modify it under the terms of the GNU General Public License
    00011  *  ("GPL") version 2 as published by the Free Software Foundation.
    00012  *  See the file LICENSE.GPL at the root directory of this source
    00013  *  distribution for additional information about the GNU GPL.
    00014  *
    00015  *  For using Coin with software that can not be combined with the GNU
    00016  *  GPL, and for taking advantage of the additional benefits of our
    00017  *  support services, please contact Systems in Motion about acquiring
    00018  *  a Coin Professional Edition License.
    00019  *
    00020  *  See <URL:http://www.coin3d.org> for  more information.
    00021  *
    00022  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00023  *  <URL:http://www.sim.no>.
    00024  *
    00025 \**************************************************************************/
    00026
    00027 #include <Inventor/SbBasic.h>
    00028 #include <Inventor/SbString.h>
    00029 #include <Inventor/SoType.h>
    00030 #include <Inventor/sensors/SoSensorManager.h>
    00031
    00032 class SbName;
    00033 class SbTime;
    00034 class SoBase;
    00035 class SoField;
    00036 class SoInput;
    00037 class SoNode;
    00038 class SoPath;
    00039 class SoSeparator;
    00040 class SoVRMLGroup;
    00041 class SoGroup;
    00042
    00043 typedef void SoDBHeaderCB(void * data, SoInput * in);
    00044
    00045
    00046 class COIN_DLL_API SoDB {
    00047 public:
    00048   static void init(void);
    00049   static void cleanup(void);
    00050
    00051   static const char * getVersion(void);
    00052   static SbBool read(SoInput * in, SoPath *& path);
    00053   static SbBool read(SoInput * in, SoBase *& base);
    00054   static SbBool read(SoInput * in, SoNode *& rootnode);
    00055   static SoSeparator * readAll(SoInput * in);
    00056   static SoVRMLGroup * readAllVRML(SoInput * in);
    00057   static SbBool isValidHeader(const char * teststring);
    00058   static SbBool registerHeader(const SbString & headerstring,
    00059                                SbBool isbinary,
    00060                                float ivversion,
    00061                                SoDBHeaderCB * precallback,
    00062                                SoDBHeaderCB * postcallback,
    00063                                void * userdata = NULL);
    00064   static SbBool getHeaderData(const SbString & headerstring,
    00065                               SbBool & isbinary,
    00066                               float & ivversion,
    00067                               SoDBHeaderCB *& precallback,
    00068                               SoDBHeaderCB *& postcallback,
    00069                               void *& userdata,
    00070                               SbBool substringok = FALSE);
    00071   static int getNumHeaders(void);
    00072   static SbString getHeaderString(const int i);
    00073   static SoField * createGlobalField(const SbName & name, SoType type);
    00074   static SoField * getGlobalField(const SbName & name);
    00075   static void renameGlobalField(const SbName & from, const SbName & to);
    00076
    00077   static void setRealTimeInterval(const SbTime & interval);
    00078   static const SbTime & getRealTimeInterval(void);
    00079   static void enableRealTimeSensor(SbBool on);
    00080
    00081   static SoSensorManager * getSensorManager(void);
    00082   static void setDelaySensorTimeout(const SbTime & t);
    00083   static const SbTime & getDelaySensorTimeout(void);
    00084   static int doSelect(int nfds, void * readfds, void * writefds,
    00085                       void * exceptfds, struct timeval * usertimeout);
    00086
    00087   static void addConverter(SoType from, SoType to, SoType converter);
    00088   static SoType getConverter(SoType from, SoType to);
    00089
    00090   static SbBool isInitialized(void);
    00091
    00092   static void startNotify(void);
    00093   static SbBool isNotifying(void);
    00094   static void endNotify(void);
    00095
    00096 private:
    00097   static SoGroup * readAllWrapper(SoInput * in, const SoType & grouptype);
    00098 };
    00099
    00100 #endif // !COIN_SODB_H