PSXtcInput/include/Exceptions.h

Go to the documentation of this file.
00001 #ifndef PSXTCINPUT_EXCEPTIONS_H
00002 #define PSXTCINPUT_EXCEPTIONS_H
00003 
00004 //--------------------------------------------------------------------------
00005 // File and Version Information:
00006 //      $Id: Exceptions.h 8222 2014-05-14 03:12:21Z cpo@SLAC.STANFORD.EDU $
00007 //
00008 // Description:
00009 //      Class Exceptions.
00010 //
00011 //------------------------------------------------------------------------
00012 
00013 //-----------------
00014 // C/C++ Headers --
00015 //-----------------
00016 #include <string>
00017 #include <cerrno>
00018 #include <boost/lexical_cast.hpp>
00019 
00020 //----------------------
00021 // Base Class Headers --
00022 //----------------------
00023 #include "ErrSvc/Issue.h"
00024 
00025 //-------------------------------
00026 // Collaborating Class Headers --
00027 //-------------------------------
00028 
00029 //------------------------------------
00030 // Collaborating Class Declarations --
00031 //------------------------------------
00032 
00033 //              ---------------------
00034 //              -- Class Interface --
00035 //              ---------------------
00036 
00037 namespace PSXtcInput {
00038 
00039 /**
00040  *  Exception classes
00041  *
00042  *  This software was developed for the LUSI project.  If you use all or
00043  *  part of it, please give an appropriate acknowledgement.
00044  *
00045  *  @version $Id: Exceptions.h 8222 2014-05-14 03:12:21Z cpo@SLAC.STANFORD.EDU $
00046  *
00047  *  @author Andrei Salnikov
00048  */
00049 
00050 class Exception : public ErrSvc::Issue {
00051 public:
00052 
00053   // Constructor
00054   Exception ( const ErrSvc::Context& ctx, 
00055               const std::string& className, 
00056               const std::string& what ) ;
00057 
00058 };
00059 
00060 // thrown for empty file list
00061 class EmptyFileList : public Exception {
00062 public:
00063 
00064   EmptyFileList(const ErrSvc::Context& ctx)
00065     : Exception( ctx, "EmptyFileList", "No input file names specified" ) {}
00066 
00067 };
00068 
00069 // thrown when xtc file open fails
00070 class IndexSeekFailed : public Exception {
00071 public:
00072 
00073   IndexSeekFailed(const ErrSvc::Context& ctx)
00074     : Exception( ctx, "IndexseekFailed", "Indexing seek failed" ) {}
00075 
00076 };
00077 
00078 // thrown for empty file
00079 class EmptyInput : public Exception {
00080 public:
00081 
00082   EmptyInput(const ErrSvc::Context& ctx)
00083     : Exception( ctx, "EmptyInput", "XTC file(s) is empty" ) {}
00084 
00085 };
00086 
00087 // thrown for unexpected input
00088 class UnexpectedInput : public Exception {
00089 public:
00090 
00091   UnexpectedInput(const ErrSvc::Context& ctx)
00092     : Exception( ctx, "UnexpectedInput", "Number of datagrams received from source is not expected" ) {}
00093 
00094 };
00095 
00096 /// Exception class which extracts error info from errno.
00097 class ExceptionErrno : public Exception {
00098 public:
00099 
00100   /// Constructor takes the reason for an exception
00101   ExceptionErrno ( const ErrSvc::Context& ctx, const std::string& what ) ;
00102 
00103 };
00104 
00105 } // namespace PSXtcInput
00106 
00107 #endif // PSXTCINPUT_EXCEPTIONS_H

Generated on 19 Dec 2016 for PSANAclasses by  doxygen 1.4.7