![]() |
TAPs 0.7.7.3
|
00001 /****************************************************************************** 00002 TAPsGlobalFnsAndResources.cpp 00003 ******************************************************************************/ 00004 // A collection of global functions and resources. 00005 /****************************************************************************** 00006 SUKITTI PUNAK (08/18/2009) 00007 ******************************************************************************/ 00008 #include "TAPsGlobalFnsAndResources.hpp" 00009 // Using Inclusion Model (i.e. definitions are included in declarations) 00010 // (this name.cpp is included in name.hpp) 00011 // Each friend is defined directly inside its declaration. 00012 00013 BEGIN_NAMESPACE_TAPs 00014 //============================================================================= 00015 bool Global::m_isInitialized = false; 00016 std::string Global::m_GL_TAPsResourcePath = ""; 00017 //----------------------------------------------------------------------------- 00018 00019 // Get the path to TAPs resource 00020 std::string Global::GetTAPsResourcePath () 00021 { 00022 if ( !m_isInitialized ) { 00023 try { 00024 Initialize(); 00025 } 00026 catch ( char * e ) { 00027 std::cout << "Initialization Failed: " << e << std::endl; 00028 } 00029 } 00030 return m_GL_TAPsResourcePath; 00031 } 00032 00033 // Set the path to TAPs resource 00034 void Global::SetTAPsResourcePath () 00035 { 00036 // Look for the path in the environment variable named "TAPsResource". 00037 char * TAPsResourcePath = getenv( "TAPsResource" ); 00038 if ( TAPsResourcePath ) { 00039 m_GL_TAPsResourcePath += TAPsResourcePath + std::string("/"); 00040 } 00041 else { // If "TAPsResource" doesn't exist, then use this path. 00042 m_GL_TAPsResourcePath = "TAPsResource/"; 00043 } 00044 //std::cout << "The path to TAPs resource: " << m_GL_TAPsResourcePath << "\n"; 00045 } 00046 00047 // Initialize 00048 bool Global::Initialize () throw(...) 00049 { 00050 SetTAPsResourcePath(); 00051 //throw "Initialization failed!"; 00052 00053 m_isInitialized = true; 00054 return m_isInitialized; 00055 } 00056 //----------------------------------------------------------------------------- 00057 //============================================================================= 00058 END_NAMESPACE_TAPs 00059 //34567890123456789012345678901234567890123456789012345678901234567890123456789 00060 //--+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----