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 00016 using namespace std; 00017 00021 struct CAFEException_pv 00022 { 00023 char pv [PVNAME_SIZE]; 00024 char pvAlias[PVNAME_SIZE]; 00025 unsigned int handle; 00026 CAFE_DATATYPE dataTypeNative; 00027 const char * dataTypeNativeText; 00028 int statusCode; 00029 const char * statusCodeText; 00030 const char * statusMessage; 00031 const char * source; 00032 unsigned int ln; 00033 }; 00034 00035 00039 struct CAFEException_group 00040 { 00041 char groupName [PVNAME_SIZE]; 00042 unsigned int groupHandle; 00043 int statusCode; 00044 const char * statusCodeText; 00045 const char * statusMessage; 00046 const char * source; 00047 unsigned int ln; 00048 }; 00049 00050 00054 class CAFEException_open : public exception 00055 { 00056 public: 00057 virtual const char* what() const throw() 00058 { 00059 return "CAFEException_open exception: Could not establish link to pv"; 00060 }; 00061 00062 CAFEException_pv pvEx; 00063 }; 00064 00068 class CAFEException_groupOpen : public exception 00069 { 00070 public: 00071 virtual const char* what() const throw() 00072 { 00073 return "CAFEException_groupOpen exception: Could not establish link to group"; 00074 }; 00075 00076 CAFEException_group groupEx; 00077 }; 00078 00079 00083 class CAFEException_init: public exception 00084 { 00085 public: 00086 virtual const char* what() const throw() 00087 { 00088 return "CAFEException_init exception: \nChannel Access Error: ECA_ALLOCMEM when calling ca_context_create"; 00089 }; 00090 }; 00091 00092 00096 class CAFEException_allocBufferMem: public exception 00097 { 00098 public: 00099 virtual const char* what() const throw() 00100 { 00101 return "CAFEException_allocBufferMem exception: \nCAFE ERROR: Cannot create space for pv data/ctrl buffer"; 00102 }; 00103 }; 00104 00105 00106 #endif // EXCEPTION_H