CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_4_5_patch3/src/FWCore/Utilities/interface/ExceptionCollector.h

Go to the documentation of this file.
00001 #ifndef FWCore_Utilities_ExceptionCollector_h
00002 #define FWCore_Utilities_ExceptionCollector_h
00003 
00024 #include "boost/function.hpp"
00025 
00026 #include <memory>
00027 #include <string>
00028 
00029 namespace cms {
00030   class Exception;
00031 }
00032 
00033 namespace edm {
00034   class ExceptionCollector {
00035   public:
00036     ExceptionCollector(std::string const& initialMessage);
00037     ~ExceptionCollector();
00038     bool hasThrown() const;
00039     void rethrow() const;
00040     void call(boost::function<void(void)>);
00041     void addException(cms::Exception const& exception);
00042 
00043   private:
00044     std::string initialMessage_;
00045     std::auto_ptr<cms::Exception> firstException_;
00046     std::auto_ptr<cms::Exception> accumulatedExceptions_;
00047     int nExceptions_;
00048   };
00049 }
00050 
00051 #endif