Changeset 3370 for code/trunk/src/util
- Timestamp:
- Jul 30, 2009, 2:10:44 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 4 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/resource (added) merged: 3328,3336-3340,3342-3350,3352-3366
- Property svn:mergeinfo changed
-
code/trunk/src/util/ScopeGuard.h
r3280 r3370 124 124 } 125 125 126 protected:127 126 ScopeGuardImpl0(F fun) : fun_(fun) 128 127 {} 129 128 129 protected: 130 130 F fun_; 131 131 }; … … 171 171 } 172 172 173 protected:174 173 ScopeGuardImpl1(F fun, P1 p1) : fun_(fun), p1_(p1) 175 174 {} 176 175 176 protected: 177 177 F fun_; 178 178 const P1 p1_; … … 219 219 } 220 220 221 protected:222 221 ScopeGuardImpl2(F fun, P1 p1, P2 p2) : fun_(fun), p1_(p1), p2_(p2) 223 222 {} 224 223 224 protected: 225 225 F fun_; 226 226 const P1 p1_; … … 268 268 } 269 269 270 protected:271 270 ScopeGuardImpl3(F fun, P1 p1, P2 p2, P3 p3) : fun_(fun), p1_(p1), p2_(p2), p3_(p3) 272 271 {} 273 272 273 protected: 274 274 F fun_; 275 275 const P1 p1_; … … 319 319 } 320 320 321 protected:322 321 ScopeGuardImpl4( F fun, P1 p1, P2 p2, P3 p3, P4 p4 ) : 323 322 fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ) 324 323 {} 325 324 325 protected: 326 326 F fun_; 327 327 const P1 p1_; … … 372 372 } 373 373 374 protected:375 374 ScopeGuardImpl5( F fun, P1 p1, P2 p2, P3 p3, P4 p4, P5 p5 ) : 376 375 fun_( fun ), p1_( p1 ), p2_( p2 ), p3_( p3 ), p4_( p4 ), p5_( p5 ) 377 376 {} 378 377 378 protected: 379 379 F fun_; 380 380 const P1 p1_; … … 426 426 } 427 427 428 protected:429 428 ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) 430 429 {} 431 430 431 protected: 432 432 Obj& obj_; 433 433 MemFun memFun_; … … 488 488 } 489 489 490 protected:491 490 ObjScopeGuardImpl1(Obj& obj, MemFun memFun, P1 p1) : obj_(obj), memFun_(memFun), p1_(p1) 492 491 {} 493 492 493 protected: 494 494 Obj& obj_; 495 495 MemFun memFun_; … … 551 551 } 552 552 553 protected:554 553 ObjScopeGuardImpl2(Obj& obj, MemFun memFun, P1 p1, P2 p2) : obj_(obj), memFun_(memFun), p1_(p1), p2_(p2) 555 554 {} 556 555 556 protected: 557 557 Obj& obj_; 558 558 MemFun memFun_; … … 616 616 } 617 617 618 protected:619 618 ObjScopeGuardImpl3( Obj & obj, MemFun memFun, P1 p1, P2 p2, P3 p3 ) : 620 619 obj_( obj ), memFun_( memFun ), p1_( p1 ), p2_( p2 ), p3_( p3 ) 621 620 {} 622 621 622 protected: 623 623 Obj& obj_; 624 624 MemFun memFun_; -
code/trunk/src/util/SignalHandler.cc
r3301 r3370 41 41 namespace orxonox 42 42 { 43 SignalHandler* SignalHandler::singleton Ref_s = NULL;43 SignalHandler* SignalHandler::singletonPtr_s = NULL; 44 44 } 45 45 … … 122 122 } 123 123 // if the signalhandler has already been destroyed then don't do anything 124 if( SignalHandler::singleton Ref_s == 0 )124 if( SignalHandler::singletonPtr_s == 0 ) 125 125 { 126 126 COUT(0) << "recieved signal " << sigName.c_str() << std::endl << "can't write backtrace because SignalHandler already destroyed" << std::endl; -
code/trunk/src/util/SignalHandler.h
r3068 r3370 40 40 #include <list> 41 41 #include <string> 42 #include "Singleton.h" 42 43 43 44 namespace orxonox … … 67 68 typedef std::list<SignalCallbackRec> SignalCallbackList; 68 69 69 class SignalHandler 70 class SignalHandler : public Singleton<SignalHandler> 70 71 { 72 friend class Singleton<SignalHandler>; 71 73 public: 72 SignalHandler() { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; } 73 ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = NULL; } 74 inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; } 74 SignalHandler() { } 75 ~SignalHandler() { } 75 76 76 77 void registerCallback( SignalCallback cb, void * someData ); … … 87 88 SignalCallbackList callbackList; 88 89 89 static SignalHandler* singleton Ref_s;90 static SignalHandler* singletonPtr_s; 90 91 91 92 std::string appName; … … 98 99 namespace orxonox 99 100 { 100 class _UtilExport SignalHandler 101 class _UtilExport SignalHandler : public Singleton<SignalHandler> 101 102 { 103 friend class Singleton<SignalHandler>; 102 104 public: 103 SignalHandler() { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; } 104 ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = 0; } 105 inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; } 105 SignalHandler() { } 106 ~SignalHandler() { } 106 107 void doCatch( const std::string & appName, const std::string & filename ) {} 107 108 void dontCatch() {} … … 109 110 110 111 private: 111 static SignalHandler* singleton Ref_s;112 static SignalHandler* singletonPtr_s; 112 113 }; 113 114 }
Note: See TracChangeset
for help on using the changeset viewer.