00001 00002 00003 00004 00005 00006 00007 00008 #ifndef EXCEPTIONS_H 00009 #define EXCEPTIONS_H 00010 00011 #include <exception> 00012 #include <cstring> 00013 #include <defines.h> 00014 #include <cafeDataType.h> 00015 00019 struct CAFEException_pv 00020 { 00021 char pv [PVNAME_SIZE]; 00022 char pvAlias[PVNAME_SIZE]; 00023 unsigned int handle; 00024 CAFE_DATATYPE dataTypeNative; 00025 const char * dataTypeNativeText; 00026 int statusCode; 00027 const char * statusCodeText; 00028 const char * statusMessage; 00029 const char * source; 00030 unsigned int ln; 00031 }; 00032 00033 00037 struct CAFEException_group 00038 { 00039 char groupName [PVNAME_SIZE]; 00040 unsigned int groupHandle; 00041 int statusCode; 00042 const char * statusCodeText; 00043 const char * statusMessage; 00044 const char * source; 00045 unsigned int ln; 00046 }; 00047 00048 00052 class CAFEException_open : public std::exception 00053 { 00054 public: 00055 virtual const char* what() const throw() 00056 { 00057 return "CAFEException_open exception: Could not establish link to pv"; 00058 }; 00059 00060 CAFEException_pv pvEx; 00061 }; 00062 00066 class CAFEException_groupOpen : public std::exception 00067 { 00068 public: 00069 virtual const char* what() const throw() 00070 { 00071 return "CAFEException_groupOpen exception: Could not establish link to group"; 00072 }; 00073 00074 CAFEException_group groupEx; 00075 }; 00076 00077 00081 class CAFEException_init: public std::exception 00082 { 00083 public: 00084 virtual const char* what() const throw() 00085 { 00086 return "CAFEException_init exception: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create"; 00087 }; 00088 }; 00089 00090 00094 class CAFEException_allocBufferMem: public std::exception 00095 { 00096 public: 00097 virtual const char* what() const throw() 00098 { 00099 return "CAFEException_allocBufferMem exception: \nCAFE ERROR: Cannot create space for pv data/ctrl buffer"; 00100 }; 00101 }; 00102 00103 00104 #endif // EXCEPTION_H