Changeset 2485 for code/branches/presentation/src/util
- Timestamp:
- Dec 16, 2008, 6:01:13 PM (16 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
-
code/branches/presentation/src/util
- Property svn:mergeinfo changed
/code/branches/objecthierarchy2/src/util (added) merged: 2257,2259,2343-2345,2361
- Property svn:mergeinfo changed
-
code/branches/presentation/src/util/Convert.h
r2171 r2485 460 460 else 461 461 *output = "false"; 462 return false;462 return true; 463 463 } 464 464 }; -
code/branches/presentation/src/util/Exception.cc
- Property svn:mergeinfo changed (with no actual effect on merging)
-
code/branches/presentation/src/util/Exception.h
- Property svn:mergeinfo changed
/code/branches/objecthierarchy2/src/util/Exception.h (added) merged: 2257,2259
- Property svn:mergeinfo changed
-
code/branches/presentation/src/util/OutputHandler.cc
r2171 r2485 100 100 @param buffer The OutputBuffer 101 101 */ 102 void OutputHandler::setOutputBuffer(OutputBuffer& buffer) 103 { 104 buffer.getStream() >> this->outputBuffer_->getStream().rdbuf(); 105 this->outputBuffer_ = &buffer; 102 void OutputHandler::setOutputBuffer(OutputBuffer* buffer) 103 { 104 if (buffer == NULL) 105 this->outputBuffer_ = &this->fallbackBuffer_; 106 else 107 { 108 buffer->getStream() >> this->outputBuffer_->getStream().rdbuf(); 109 this->outputBuffer_ = buffer; 110 } 106 111 } 107 112 -
code/branches/presentation/src/util/OutputHandler.h
r2171 r2485 101 101 static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All); 102 102 103 void setOutputBuffer(OutputBuffer &buffer);103 void setOutputBuffer(OutputBuffer* buffer); 104 104 105 105 template <class T> -
code/branches/presentation/src/util/SignalHandler.cc
- Property svn:mergeinfo changed
/code/branches/objecthierarchy2/src/util/SignalHandler.cc (added) merged: 2344-2345 /code/trunk/src/util/SignalHandler.cc merged: 2-1912
r2459 r2485 35 35 #include "Debug.h" 36 36 37 #include <cassert>38 37 #include <iostream> 39 38 #include <cstdlib> … … 42 41 namespace orxonox 43 42 { 44 SignalHandler * SignalHandler::singletonRef= NULL;43 SignalHandler* SignalHandler::singletonRef_s = NULL; 45 44 } 46 45 … … 55 54 { 56 55 bool SignalHandler::bXAutoKeyRepeatOn_ = false; 57 58 SignalHandler::SignalHandler()59 {60 }61 56 62 57 /** … … 133 128 void SignalHandler::sigHandler( int sig ) 134 129 { 135 for ( SignalCallbackList::iterator it = SignalHandler::getInstance() ->callbackList.begin(); it != SignalHandler::getInstance()->callbackList.end(); it++ )130 for ( SignalCallbackList::iterator it = SignalHandler::getInstance().callbackList.begin(); it != SignalHandler::getInstance().callbackList.end(); it++ ) 136 131 { 137 132 (*(it->cb))( it->someData ); … … 184 179 if ( sigPid == 0 ) 185 180 { 186 getInstance() ->dontCatch();181 getInstance().dontCatch(); 187 182 // wait for message from parent when it has attached gdb 188 183 int someData; … … 237 232 238 233 char cmd[256]; 239 snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance() ->appName.c_str(), sigPid );234 snprintf( cmd, 256, "file %s\nattach %d\nc\n", getInstance().appName.c_str(), sigPid ); 240 235 write( gdbIn[1], cmd, strlen(cmd) ); 241 236 … … 331 326 bt.insert(0, timeString); 332 327 333 FILE * f = fopen( getInstance() ->filename.c_str(), "a" );328 FILE * f = fopen( getInstance().filename.c_str(), "a" ); 334 329 335 330 if ( !f ) 336 331 { 337 perror( ( std::string( "could not append to " ) + getInstance() ->filename ).c_str() );332 perror( ( std::string( "could not append to " ) + getInstance().filename ).c_str() ); 338 333 exit(EXIT_FAILURE); 339 334 } … … 341 336 if ( fwrite( bt.c_str(), 1, bt.length(), f ) != bt.length() ) 342 337 { 343 COUT(0) << "could not write " << bt.length() << " byte to " << getInstance() ->filename << std::endl;338 COUT(0) << "could not write " << bt.length() << " byte to " << getInstance().filename << std::endl; 344 339 exit(EXIT_FAILURE); 345 340 } - Property svn:mergeinfo changed
-
code/branches/presentation/src/util/SignalHandler.h
- Property svn:mergeinfo changed
/code/branches/objecthierarchy2/src/util/SignalHandler.h (added) merged: 2344 /code/trunk/src/util/SignalHandler.h merged: 2-1912
r2459 r2485 37 37 #include "UtilPrereqs.h" 38 38 39 #include <cassert> 39 40 #include <list> 40 41 #include <string> … … 68 69 class SignalHandler 69 70 { 70 private:71 SignalHandler();72 71 public: 73 inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; } 74 ~SignalHandler(){ SignalHandler::singletonRef = NULL; } 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; } 75 75 76 76 void registerCallback( SignalCallback cb, void * someData ); … … 87 87 SignalCallbackList callbackList; 88 88 89 static SignalHandler * singletonRef;89 static SignalHandler* singletonRef_s; 90 90 91 91 std::string appName; … … 104 104 { 105 105 public: 106 inline static SignalHandler* getInstance() { if (!SignalHandler::singletonRef) SignalHandler::singletonRef = new SignalHandler(); return SignalHandler::singletonRef; }; 107 void doCatch( const std::string & appName, const std::string & filename ) {}; 108 void dontCatch() {}; 109 void registerCallback( SignalCallback cb, void * someData ) {}; 106 SignalHandler() { assert(SignalHandler::singletonRef_s == 0); SignalHandler::singletonRef_s = this; } 107 ~SignalHandler() { assert(SignalHandler::singletonRef_s != 0); SignalHandler::singletonRef_s = 0; } 108 inline static SignalHandler& getInstance() { assert(SignalHandler::singletonRef_s); return *SignalHandler::singletonRef_s; } 109 void doCatch( const std::string & appName, const std::string & filename ) {} 110 void dontCatch() {} 111 void registerCallback( SignalCallback cb, void * someData ) {} 110 112 111 113 private: 112 static SignalHandler * singletonRef;114 static SignalHandler* singletonRef_s; 113 115 }; 114 116 } - Property svn:mergeinfo changed
Note: See TracChangeset
for help on using the changeset viewer.