error_stack.cxx

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

Generated on Wed Nov 23 19:00:10 2011 for FreeCAD by  doxygen 1.6.1