|
Blender
V2.59
|
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 * $Id: error_stack.cpp 35155 2011-02-25 11:45:16Z jesterking $ 00016 * $Name: $ 00017 ****************************************************************************/ 00018 00019 00020 #include "error_stack.h" 00021 #include <stack> 00022 #include <vector> 00023 #include <string> 00024 #include <cstring> 00025 00026 namespace KDL { 00027 00028 // Trace of the call stack of the I/O routines to help user 00029 // interprete error messages from I/O 00030 typedef std::stack<std::string> ErrorStack; 00031 00032 ErrorStack errorstack; 00033 // should be in Thread Local Storage if this gets multithreaded one day... 00034 00035 00036 void IOTrace(const std::string& description) { 00037 errorstack.push(description); 00038 } 00039 00040 00041 void IOTracePop() { 00042 errorstack.pop(); 00043 } 00044 00045 void IOTraceOutput(std::ostream& os) { 00046 while (!errorstack.empty()) { 00047 os << errorstack.top().c_str() << std::endl; 00048 errorstack.pop(); 00049 } 00050 } 00051 00052 00053 void IOTracePopStr(char* buffer,int size) { 00054 if (errorstack.empty()) { 00055 *buffer = 0; 00056 return; 00057 } 00058 strncpy(buffer,errorstack.top().c_str(),size); 00059 errorstack.pop(); 00060 } 00061 00062 }