Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR_System.h
Go to the documentation of this file.
1 /************************************************************************************
2 
3 PublicHeader: OVR
4 Filename : OVR_System.h
5 Content : General kernel initialization/cleanup, including that
6  of the memory allocator.
7 Created : September 19, 2012
8 Notes :
9 
10 Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
11 
12 Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
13 you may not use the Oculus VR Rift SDK except in compliance with the License,
14 which is provided at the time of installation or download, or which
15 otherwise accompanies this software in either electronic or hard copy form.
16 
17 You may obtain a copy of the License at
18 
19 http://www.oculusvr.com/licenses/LICENSE-3.1
20 
21 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
22 distributed under the License is distributed on an "AS IS" BASIS,
23 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24 See the License for the specific language governing permissions and
25 limitations under the License.
26 
27 ************************************************************************************/
28 
29 #ifndef OVR_System_h
30 #define OVR_System_h
31 
32 #include "OVR_Allocator.h"
33 #include "OVR_Log.h"
34 
35 namespace OVR {
36 
37 // ***** System Core Initialization class
38 
39 // System initialization must take place before any other OVR_Kernel objects are used;
40 // this is done my calling System::Init(). Among other things, this is necessary to
41 // initialize the memory allocator. Similarly, System::Destroy must be
42 // called before program exist for proper cleanup. Both of these tasks can be achieved by
43 // simply creating System object first, allowing its constructor/destructor do the work.
44 
45 // TBD: Require additional System class for Oculus Rift API?
46 
47 class System
48 {
49 public:
50 
51  // System constructor expects allocator to be specified, if it is being substituted.
54  {
55  Init(log, palloc);
56  }
57 
59  {
60  Destroy();
61  }
62 
63  // Returns 'true' if system was properly initialized.
64  static bool OVR_CDECL IsInitialized();
65 
66  // Initializes System core. Users can override memory implementation by passing
67  // a different Allocator here.
70 
71  // De-initializes System more, finalizing the threading system and destroying
72  // the global memory allocator.
73  static void OVR_CDECL Destroy();
74 };
75 
76 } // OVR
77 
78 #endif
#define OVR_CDECL
System(Log *log=Log::ConfigureDefaultLog(LogMask_Debug), Allocator *palloc=DefaultAllocator::InitSystemSingleton())
Definition: OVR_System.h:52
static void OVR_CDECL Init(Log *log=Log::ConfigureDefaultLog(LogMask_Debug), Allocator *palloc=DefaultAllocator::InitSystemSingleton())
Definition: OVR_System.cpp:37
static void OVR_CDECL Destroy()
Definition: OVR_System.cpp:51
static bool OVR_CDECL IsInitialized()
Definition: OVR_System.cpp:75
static Log * ConfigureDefaultLog(unsigned logMask=LogMask_Debug)
Definition: OVR_Log.h:157