FDO API Reference | Feature Data Objects |
00001 #ifndef FDO_CONTEXT_H 00002 #define FDO_CONTEXT_H 00003 // 00004 00005 // 00006 // Copyright (C) 2004-2006 Autodesk, Inc. 00007 // 00008 // This library is free software; you can redistribute it and/or 00009 // modify it under the terms of version 2.1 of the GNU Lesser 00010 // General Public License as published by the Free Software Foundation. 00011 // 00012 // This library is distributed in the hope that it will be useful, 00013 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 // Lesser General Public License for more details. 00016 // 00017 // You should have received a copy of the GNU Lesser General Public 00018 // License along with this library; if not, write to the Free Software 00019 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00020 // 00021 00022 #include <FdoCommon.h> 00023 00024 /// \brief 00025 /// FdoContext is a common base for all FDO context classes. A context class is used in 00026 /// complex operations involving multiple functions. It providers a convenient container for 00027 /// passing information between these functions. This class provides an error list where 00028 /// errors that occur during processing can be logged and reported when the processing completes. 00029 /// Sub-classes can add more specific information to pass around 00030 class FdoContext : public FdoDisposable 00031 { 00032 public: 00033 /// \brief 00034 /// Constructs the context 00035 /// 00036 /// \return 00037 /// Returns FdoContext 00038 /// 00039 FDO_API_COMMON static FdoContext* Create(); 00040 00041 /// \brief 00042 /// Adds an error to the error list. 00043 /// 00044 /// \param ex 00045 /// Input the error to add. 00046 /// \warning 00047 /// If this error has a 00048 /// cause, it will be overridden when thrown (see ThrowErrors()). 00049 /// 00050 FDO_API_COMMON void AddError( FdoException* ex ); 00051 00052 /// \brief 00053 /// Throws all errors in the error list. 00054 /// The errors are thrown as a chain. The first error is one thrown. The 00055 /// second error is set to be the cause of the first error, the third 00056 /// the cause of the second and so on. 00057 /// 00058 FDO_API_COMMON virtual void ThrowErrors(); 00059 00060 protected: 00061 FDO_API_COMMON FdoContext(); 00062 FDO_API_COMMON virtual ~FdoContext(); 00063 00064 private: 00065 /// Error Collection definition 00066 class Errors : public FdoCollection<FdoException,FdoException> 00067 { 00068 protected: 00069 virtual void Dispose(); 00070 00071 Errors() {} 00072 00073 public: 00074 static Errors* Create() 00075 { 00076 return new Errors(); 00077 } 00078 }; 00079 00080 /// Error collection 00081 FdoPtr<Errors> mErrors; 00082 }; 00083 00084 /// \ingroup (typedefs) 00085 /// \brief 00086 /// FdoContextP is a FdoPtr on FdoContext, provided for convenience. 00087 typedef FdoPtr<FdoContext> FdoContextP; 00088 00089 #endif 00090 00091
Comments or suggestions? Send us feedback. |