00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef COIN_SODB_H
00021 #define COIN_SODB_H
00022
00023 #include <Inventor/SbBasic.h>
00024 #include <Inventor/SbString.h>
00025 #include <Inventor/SoType.h>
00026 #include <Inventor/sensors/SoSensorManager.h>
00027
00028 class SbName;
00029 class SbTime;
00030 class SoBase;
00031 class SoField;
00032 class SoFieldConverter;
00033 class SoInput;
00034 class SoNode;
00035 class SoPath;
00036 class SoSensor;
00037 class SoSeparator;
00038 class SoTimerSensor;
00039 class SoVRMLGroup;
00040
00041 class SoDB_HeaderInfo;
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
00050 static const char * getVersion(void);
00051 static SbBool read(SoInput * in, SoPath *& path);
00052 static SbBool read(SoInput * in, SoBase *& base);
00053 static SbBool read(SoInput * in, SoNode *& rootnode);
00054 static SoSeparator * readAll(SoInput * in);
00055 static SbBool isValidHeader(const char * teststring);
00056 static SbBool registerHeader(const SbString & headerstring,
00057 SbBool isbinary,
00058 float ivversion,
00059 SoDBHeaderCB * precallback,
00060 SoDBHeaderCB * postcallback,
00061 void * userdata = NULL);
00062 static SbBool getHeaderData(const SbString & headerstring,
00063 SbBool & isbinary,
00064 float & ivversion,
00065 SoDBHeaderCB *& precallback,
00066 SoDBHeaderCB *& postcallback,
00067 void *& userdata,
00068 SbBool substringok = FALSE);
00069 static int getNumHeaders(void);
00070 static SbString getHeaderString(const int i);
00071 static SoField * createGlobalField(const SbName & name, SoType type);
00072 static SoField * getGlobalField(const SbName & name);
00073 static void renameGlobalField(const SbName & from, const SbName & to);
00074
00075 static void setRealTimeInterval(const SbTime & interval);
00076 static const SbTime & getRealTimeInterval(void);
00077 static void enableRealTimeSensor(SbBool on);
00078
00079 static SoSensorManager * getSensorManager(void);
00080 static void setDelaySensorTimeout(const SbTime & t);
00081 static const SbTime & getDelaySensorTimeout(void);
00082 static int doSelect(int nfds, void * readfds, void * writefds,
00083 void * exceptfds, struct timeval * usertimeout);
00084
00085 static void addConverter(SoType from, SoType to, SoType converter);
00086 static SoType getConverter(SoType from, SoType to);
00087
00088 static SbBool isInitialized(void);
00089
00090 static void startNotify(void);
00091 static SbBool isNotifying(void);
00092 static void endNotify(void);
00093
00094 private:
00095 static void clean(void);
00096 static void updateRealTimeFieldCB(void * data, SoSensor * sensor);
00097
00098 static SbList<SoDB_HeaderInfo *> * headerlist;
00099 static SoSensorManager * sensormanager;
00100 static SoTimerSensor * globaltimersensor;
00101 static SbTime * realtimeinterval;
00102 static SbDict * converters;
00103 static int notificationcounter;
00104 static SbBool isinitialized;
00105 };
00106
00107 #endif // !COIN_SODB_H