Fennel: /home/pub/open/dev/fennel/exec/ErrorSource.h Source File (original) (raw)

00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 #ifndef Fennel_ErrorSource_Included 00025 #define Fennel_ErrorSource_Included 00026 00027 #include "fennel/exec/ErrorTarget.h" 00028 #include "fennel/tuple/TupleAccessor.h" 00029 00030 #include 00031 00032 FENNEL_BEGIN_NAMESPACE 00033 00042 class FENNEL_EXEC_EXPORT ErrorSource 00043 { 00044 SharedErrorTarget pErrorTarget; 00045 std::string name; 00046 00050 TupleAccessor errorAccessor; 00051 00055 boost::shared_ptr pErrorBuf; 00056 00057 protected: 00061 explicit ErrorSource(); 00062 00072 explicit ErrorSource( 00073 SharedErrorTarget pErrorTarget, 00074 const std::string &name); 00075 00076 public: 00077 virtual ~ErrorSource(); 00078 00086 virtual void initErrorSource( 00087 SharedErrorTarget pErrorTarget, 00088 const std::string &name); 00089 00095 void postError( 00096 ErrorLevel level, const std::string &message, 00097 void *address, long capacity, int index); 00098 00104 void postError( 00105 ErrorLevel level, const std::string &message, 00106 const TupleDescriptor &errorDesc, const TupleData &errorTuple, 00107 int index); 00108 00112 bool hasTarget() const 00113 { 00114 return pErrorTarget.get() ? true : false; 00115 } 00116 00120 ErrorTarget &getErrorTarget() const 00121 { 00122 assert(hasTarget()); 00123 return *(pErrorTarget.get()); 00124 } 00125 00129 SharedErrorTarget getSharedErrorTarget() const 00130 { 00131 return pErrorTarget; 00132 } 00133 00139 std::string getErrorSourceName() const 00140 { 00141 return name; 00142 } 00143 00148 void setErrorSourceName(std::string const& n) 00149 { 00150 name = n; 00151 } 00152 00153 void disableTarget(); 00154 }; 00155 00156 FENNEL_END_NAMESPACE 00157 00158 #endif 00159 00160