NEOCCA bindings Specification  0.2.8
Exception.hh
Go to the documentation of this file.
00001 #ifndef neo_Exception_hh_seen
00002 #define neo_Exception_hh_seen
00003 
00004 /* A file of auxiliaries that mainly distract the new reader.  */
00005 
00006 namespace neo {
00007 namespace cca {
00008 
00009 //===================================================================
00017 enum ExceptionType {
00018   Unexpected          = -1,
00019   Nonstandard         = 1,
00020   PortNotDefined      = 2,
00021   PortAlreadyDefined  = 3,
00022   PortNotConnected    = 4,
00023   PortNotInUse        = 5,
00024   UsesPortNotReleased = 6,
00025   BadPortName         = 7,
00026   BadPortType         = 8,
00027   BadProperties       = 9,
00028   BadPortInfo         = 10,
00029   OutOfMemory         = 11,
00030   NetworkError        = 12
00031 };
00032 
00033 //===================================================================
00034 
00048 class Exception : public ::std::exception
00049 {
00050 private:
00051         enum ExceptionType ccaType;
00052         ::std::string  ccaMessage;
00053 
00054 public:
00055         virtual ~Exception() throw (){}
00056         virtual const char *what() { return ccaMessage.c_str(); }
00057 
00058         Exception(enum ExceptionType t, const ::std::string & message) throw ()
00059         { ccaType = t; ccaMessage = message; }
00060 
00061         Exception(enum ExceptionType t) throw ()
00062         { ccaType = t; ccaMessage = ::std::string(""); }
00063 
00064         Exception() throw ()
00065         { ccaType = Nonstandard; ccaMessage = ::std::string(""); }
00066 
00067         Exception(const ::std::string& message) throw ()
00068         { ccaType = Nonstandard; ccaMessage = message; }
00069 
00070         enum ExceptionType getType() { return ccaType; }
00071 
00073         ::std::string getMessage() {return ccaMessage; }
00074 
00075         void setType( enum ExceptionType t) { ccaType = t; }
00076 
00077         void setMessage(const ::std::string & message) { ccaMessage = message; }
00078 
00079 };
00080 
00081 
00082 }  // end namespace cca
00083 }  // end namespace neo
00084 
00085 #endif // neo_Exception_hh_seen
00086