added: travMask to csm viewport
[opensg.git] / Source / Base / Base / OSGBaseInitFunctions.h
blobcb1045b4260abb76620e21e9ea885829ba6eff5c
1 /*---------------------------------------------------------------------------*\
2 * OpenSG *
3 * *
4 * *
5 * Copyright (C) 2000-2002 by the OpenSG Forum *
6 * *
7 * www.opensg.org *
8 * *
9 * contact: dirk@opensg.org, gerrit.voss@vossg.org, jbehr@zgdv.de *
10 * *
11 \*---------------------------------------------------------------------------*/
12 /*---------------------------------------------------------------------------*\
13 * License *
14 * *
15 * This library is free software; you can redistribute it and/or modify it *
16 * under the terms of the GNU Library General Public License as published *
17 * by the Free Software Foundation, version 2. *
18 * *
19 * This library is distributed in the hope that it will be useful, but *
20 * WITHOUT ANY WARRANTY; without even the implied warranty of *
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
22 * Library General Public License for more details. *
23 * *
24 * You should have received a copy of the GNU Library General Public *
25 * License along with this library; if not, write to the Free Software *
26 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
27 * *
28 \*---------------------------------------------------------------------------*/
29 /*---------------------------------------------------------------------------*\
30 * Changes *
31 * *
32 * *
33 * *
34 * *
35 * *
36 * *
37 \*---------------------------------------------------------------------------*/
39 #ifndef _OSGBASEINITFUNCTIONS_H_
40 #define _OSGBASEINITFUNCTIONS_H_
41 #ifdef __sgi
42 #pragma once
43 #endif
45 #include "OSGBaseTypes.h"
47 #include <vector>
48 #include <map>
49 #include <string>
50 #include <boost/function.hpp>
52 OSG_BEGIN_NAMESPACE
54 /*---------------------------------------------------------------------*/
55 /* Initialization */
57 /*! \ingroup GrpBaseBaseInitExit
60 enum SystemState
62 Startup = 0x01,
63 Running = 0x02,
64 Shutdown = 0x03,
65 PostShutdown = 0x04
68 extern OSG_BASE_DLLMAPPING SystemState GlobalSystemState;
70 // Init sequence:
72 // * PreMP
73 // * MP internal call
74 // * PreFactories
75 // * Factories internal call
76 // * PostFactories
78 typedef boost::function<bool (void)> InitFuncF;
80 // Shutdown sequence:
82 // * PreFactories
83 // * Factories internal call
84 // * PostFactories
85 // * MP internal call
86 // * PostMP
88 typedef boost::function<bool (void)> ExitFuncF;
90 /*! \ingroup GrpBaseBaseInitExit
91 \ingroup GrpBaseBase
92 \ingroup GrpLibOSGBase
93 \nohierarchy
96 struct OSG_BASE_DLLMAPPING InitFuncWrapper
98 /*---------------------------------------------------------------------*/
99 /*! \name Constructors */
100 /*! \{ */
102 InitFuncWrapper(const InitFuncF func);
104 /*! \} */
107 /*! \ingroup GrpBaseBaseInitExit
108 \ingroup GrpBaseBase
109 \ingroup GrpLibOSGBase
110 \nohierarchy
113 struct OSG_BASE_DLLMAPPING StaticInitFuncWrapper
115 /*---------------------------------------------------------------------*/
116 /*! \name Constructors */
117 /*! \{ */
119 StaticInitFuncWrapper(const InitFuncF func);
121 /*! \} */
125 OSG_BASE_DLLMAPPING
126 void addPreMPInitFunction (OSG::InitFuncF initFunc);
128 OSG_BASE_DLLMAPPING
129 void addPreFactoryInitFunction (OSG::InitFuncF initFunc);
131 OSG_BASE_DLLMAPPING
132 void addPostFactoryInitFunction(OSG::InitFuncF initFunc);
135 OSG_BASE_DLLMAPPING
136 void addPreFactoryExitFunction (OSG::ExitFuncF exitFunc);
138 OSG_BASE_DLLMAPPING
139 void addPostFactoryExitFunction(OSG::ExitFuncF exitFunc);
141 OSG_BASE_DLLMAPPING
142 void addPreMPExitFunction (OSG::ExitFuncF exitFunc);
144 OSG_BASE_DLLMAPPING
145 void addPostMPExitFunction (OSG::ExitFuncF exitFunc);
147 /*---------------------------------------------------------------------*/
148 /*! \name init / exit */
149 /*! \{ */
151 OSG_BASE_DLLMAPPING
152 void preloadSharedObject(const OSG::TChar *szName );
154 OSG_BASE_DLLMAPPING
155 void addLibraryVersion (const std::string &szName,
156 const std::string &szVersion,
157 const std::string &szRevision);
159 OSG_BASE_DLLMAPPING
160 UInt32 getNumLibraries ( void );
162 OSG_BASE_DLLMAPPING
163 std::string getLibraryName ( UInt32 Index );
165 OSG_BASE_DLLMAPPING
166 std::string getLibraryVersion (const std::string &szName );
168 OSG_BASE_DLLMAPPING
169 std::string getLibraryRevision (const std::string &szName );
171 #ifdef _DEBUG
172 # define OSG_INIT_DEBUG true
173 #else
174 # define OSG_INIT_DEBUG false
175 #endif
176 # ifdef WIN32
177 # ifdef _DLL
178 # define OSG_INIT_DLL true
179 # else
180 # define OSG_INIT_DLL false
181 # endif
182 # ifdef _MT
183 # define OSG_INIT_MT true
184 # else
185 # define OSG_INIT_MT false
186 # endif
187 #else
188 # define OSG_INIT_DLL true
189 # define OSG_INIT_MT true
190 #endif
192 // osgInit needs to be inline (at least on windows),
193 // see OSGBaseInitFunctions.inl for an explanation.
195 inline
196 bool osgInit (OSG::Int32 argc,
197 OSG::Char8 **argv,
198 OSG::UInt16 major = OSG_MAJOR_VERSION,
199 OSG::UInt16 minor = OSG_MINOR_VERSION,
200 OSG::UInt16 release = OSG_RELEASE_VERSION,
201 bool debug = OSG_INIT_DEBUG,
202 bool dll = OSG_INIT_DLL,
203 bool mt = OSG_INIT_MT );
205 OSG_BASE_DLLMAPPING
206 bool osgExit(void);
208 /*! \} */
210 OSG_BASE_DLLMAPPING
211 bool osgDoInit(OSG::Int32 argc,
212 OSG::Char8 **argv,
213 OSG::UInt16 major = OSG_MAJOR_VERSION,
214 OSG::UInt16 minor = OSG_MINOR_VERSION,
215 OSG::UInt16 release = OSG_RELEASE_VERSION,
216 bool debug = OSG_INIT_DEBUG,
217 bool dll = OSG_INIT_DLL,
218 bool mt = OSG_INIT_MT );
220 OSG_BASE_DLLMAPPING
221 void osgExitWrapper(void);
223 OSG_END_NAMESPACE
225 #include "OSGBaseInitFunctions.inl"
227 #endif /* OSGBASEINITFUNCTIONS_H */