Blender V2.61 - r43446
|
00001 00004 /***************************************************************************** 00005 * \author 00006 * Erwin Aertbelien, Div. PMA, Dep. of Mech. Eng., K.U.Leuven 00007 * 00008 * \version 00009 * ORO_Geometry V0.2 00010 * 00011 * \par History 00012 * - $log$ 00013 * 00014 * \par Release 00015 * $Name: $ 00016 ****************************************************************************/ 00017 00018 00019 #include "error_stack.h" 00020 #include <stack> 00021 #include <vector> 00022 #include <string> 00023 #include <cstring> 00024 00025 namespace KDL { 00026 00027 // Trace of the call stack of the I/O routines to help user 00028 // interprete error messages from I/O 00029 typedef std::stack<std::string> ErrorStack; 00030 00031 ErrorStack errorstack; 00032 // should be in Thread Local Storage if this gets multithreaded one day... 00033 00034 00035 void IOTrace(const std::string& description) { 00036 errorstack.push(description); 00037 } 00038 00039 00040 void IOTracePop() { 00041 errorstack.pop(); 00042 } 00043 00044 void IOTraceOutput(std::ostream& os) { 00045 while (!errorstack.empty()) { 00046 os << errorstack.top().c_str() << std::endl; 00047 errorstack.pop(); 00048 } 00049 } 00050 00051 00052 void IOTracePopStr(char* buffer,int size) { 00053 if (errorstack.empty()) { 00054 *buffer = 0; 00055 return; 00056 } 00057 strncpy(buffer,errorstack.top().c_str(),size); 00058 errorstack.pop(); 00059 } 00060 00061 }