Bike-X  0.8
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
OVR_System.cpp
Go to the documentation of this file.
1 /************************************************************************************
2 
3 Filename : OVR_System.cpp
4 Content : General kernel initialization/cleanup, including that
5  of the memory allocator.
6 Created : September 19, 2012
7 Notes :
8 
9 Copyright : Copyright 2014 Oculus VR, Inc. All Rights reserved.
10 
11 Licensed under the Oculus VR Rift SDK License Version 3.1 (the "License");
12 you may not use the Oculus VR Rift SDK except in compliance with the License,
13 which is provided at the time of installation or download, or which
14 otherwise accompanies this software in either electronic or hard copy form.
15 
16 You may obtain a copy of the License at
17 
18 http://www.oculusvr.com/licenses/LICENSE-3.1
19 
20 Unless required by applicable law or agreed to in writing, the Oculus VR SDK
21 distributed under the License is distributed on an "AS IS" BASIS,
22 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
23 See the License for the specific language governing permissions and
24 limitations under the License.
25 
26 ************************************************************************************/
27 
28 #include "OVR_System.h"
29 #include "OVR_Threads.h"
30 #include "OVR_Timer.h"
31 
32 namespace OVR {
33 
34 // ***** OVR::System Implementation
35 
36 // Initializes System core, installing allocator.
37 void System::Init(Log* log, Allocator *palloc)
38 {
40  {
41  Log::SetGlobalLog(log);
43  Allocator::setInstance(palloc);
44  }
45  else
46  {
47  OVR_DEBUG_LOG(("System::Init failed - duplicate call."));
48  }
49 }
50 
52 {
54  {
55  // Wait for all threads to finish; this must be done so that memory
56  // allocator and all destructors finalize correctly.
57 #ifdef OVR_ENABLE_THREADS
59 #endif
60 
61  // Shutdown heap and destroy SysAlloc singleton, if any.
64 
67  }
68  else
69  {
70  OVR_DEBUG_LOG(("System::Destroy failed - System not initialized."));
71  }
72 }
73 
74 // Returns 'true' if system was properly initialized.
76 {
77  return Allocator::GetInstance() != 0;
78 }
79 
80 } // OVR
81 
static void OVR_CDECL Init(Log *log=Log::ConfigureDefaultLog(LogMask_Debug), Allocator *palloc=DefaultAllocator::InitSystemSingleton())
Definition: OVR_System.cpp:37
static void OVR_CDECL FinishAllThreads()
static void OVR_CDECL Destroy()
Definition: OVR_System.cpp:51
static void SetGlobalLog(Log *log)
Definition: OVR_Log.cpp:138
static void setInstance(Allocator *palloc)
virtual void onSystemShutdown()
static bool OVR_CDECL IsInitialized()
Definition: OVR_System.cpp:75
static Log * GetDefaultLog()
Definition: OVR_Log.cpp:152
static void initializeTimerSystem()
Definition: OVR_Timer.cpp:63
#define OVR_DEBUG_LOG(args)
Definition: OVR_Log.h:196
static void shutdownTimerSystem()
Definition: OVR_Timer.cpp:66
static Allocator * GetInstance()