ErrorSource.h

Go to the documentation of this file.
00001 /*
00002 // $Id: //open/dev/fennel/exec/ErrorSource.h#7 $
00003 // Fennel is a library of data storage and processing components.
00004 // Copyright (C) 2005-2009 The Eigenbase Project
00005 // Copyright (C) 2005-2009 SQLstream, Inc.
00006 // Copyright (C) 2005-2009 LucidEra, Inc.
00007 // Portions Copyright (C) 1999-2009 John V. Sichi
00008 //
00009 // This program is free software; you can redistribute it and/or modify it
00010 // under the terms of the GNU General Public License as published by the Free
00011 // Software Foundation; either version 2 of the License, or (at your option)
00012 // any later version approved by The Eigenbase Project.
00013 //
00014 // This program is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with this program; if not, write to the Free Software
00021 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
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 <sstream>
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<FixedBuffer> 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 // End ErrorSource.h

Generated on Mon Jun 22 04:00:18 2009 for Fennel by  doxygen 1.5.1