00001 #ifndef EDG_WORKLOAD_COMMON_CONFIGURATION_EXCEPTIONS_H
00002 #define EDG_WORKLOAD_COMMON_CONFIGURATION_EXCEPTIONS_H
00003
00004 #include <string>
00005 #include <vector>
00006 #include <iostream>
00007 #include <exception>
00008
00009 #include "edg/workload/common/common_namespace.h"
00010
00011 #include "ModuleType.h"
00012
00013 COMMON_NAMESPACE_BEGIN {
00014
00015 namespace configuration {
00016
00017 class CannotConfigure : public std::exception {
00018 public:
00019 CannotConfigure( void );
00020 virtual ~CannotConfigure( void ) throw();
00021
00022 virtual std::string reason( void ) const;
00023 virtual const char *what( void ) const throw();
00024
00025 private:
00026 mutable std::string cc_what;
00027 };
00028
00029 class OtherErrors : public CannotConfigure {
00030 public:
00031 OtherErrors( const char *reason );
00032 virtual ~OtherErrors( void ) throw();
00033
00034 virtual std::string reason( void ) const;
00035
00036 private:
00037 std::string oe_error;
00038 };
00039
00040 class InvalidExpression : public CannotConfigure {
00041 public:
00042 InvalidExpression( const std::string &expr );
00043 virtual ~InvalidExpression( void ) throw();
00044
00045 virtual std::string reason( void ) const;
00046
00047 inline const std::string &expression( void ) const { return this->ie_expr; }
00048
00049 private:
00050 std::string ie_expr;
00051 };
00052
00053 class CannotReadFile : public CannotConfigure {
00054 public:
00055 CannotReadFile( const std::string &file );
00056 virtual ~CannotReadFile( void ) throw();
00057
00058 virtual std::string reason( void ) const;
00059
00060 inline const std::string &filename( void ) const { return this->crf_file; }
00061
00062 private:
00063 std::string crf_file;
00064 };
00065
00066 class UndefinedParameter : public CannotConfigure {
00067 public:
00068 UndefinedParameter( const char *name );
00069 virtual ~UndefinedParameter( void ) throw();
00070
00071 virtual std::string reason( void ) const;
00072
00073 inline const std::string ¶meter( void ) const { return this->up_param; }
00074
00075 private:
00076 std::string up_param;
00077 };
00078
00079 class UndefinedVariable : public CannotConfigure {
00080 public:
00081 UndefinedVariable( const std::string &name );
00082 virtual ~UndefinedVariable( void ) throw();
00083
00084 virtual std::string reason( void ) const;
00085
00086 inline const std::string &variable( void ) const { return this->uv_variable; }
00087
00088 private:
00089 std::string uv_variable;
00090 };
00091
00092 class CannotOpenFile : public CannotConfigure {
00093 public:
00094 CannotOpenFile( const char *name );
00095 virtual ~CannotOpenFile( void ) throw();
00096
00097 virtual std::string reason( void ) const;
00098
00099 inline const std::string &file( void ) const { return this->cof_file; }
00100
00101 private:
00102 std::string cof_file;
00103 };
00104
00105 class CannotFindFile : public CannotConfigure {
00106 public:
00107 CannotFindFile( const std::string &name, const std::vector<std::string> &paths );
00108 virtual ~CannotFindFile( void ) throw();
00109
00110 virtual std::string reason( void ) const;
00111
00112 inline const std::vector<std::string> &paths( void ) const { return( this->cff_paths ); }
00113
00114 private:
00115 std::string cff_file;
00116 std::vector<std::string> cff_paths;
00117 };
00118
00119 class ModuleMismatch : public CannotConfigure {
00120 public:
00121 ModuleMismatch( const ModuleType &type );
00122 virtual ~ModuleMismatch( void ) throw();
00123
00124 virtual std::string reason( void ) const;
00125
00126 inline ModuleType type( void ) { return( this->mm_etype ); }
00127
00128 private:
00129 ModuleType mm_etype;
00130 };
00131
00132 inline std::ostream &operator<<( std::ostream &os, const CannotConfigure &cc ) { os << cc.reason(); return os; }
00133
00134 };
00135
00136 } COMMON_NAMESPACE_END;
00137
00138 #endif
00139
00140
00141
00142