Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #include "opensplice_dds_comm/check_status.h"
00025
00026
00027 const char *RetCodeName[13] = {
00028 "DDS_RETCODE_OK",
00029 "DDS_RETCODE_ERROR",
00030 "DDS_RETCODE_UNSUPPORTED",
00031 "DDS_RETCODE_BAD_PARAMETER",
00032 "DDS_RETCODE_PRECONDITION_NOT_MET",
00033 "DDS_RETCODE_OUT_OF_RESOURCES",
00034 "DDS_RETCODE_NOT_ENABLED",
00035 "DDS_RETCODE_IMMUTABLE_POLICY",
00036 "DDS_RETCODE_INCONSISTENT_POLICY",
00037 "DDS_RETCODE_ALREADY_DELETED",
00038 "DDS_RETCODE_TIMEOUT",
00039 "DDS_RETCODE_NO_DATA",
00040 "DDS_RETCODE_ILLEGAL_OPERATION" };
00041
00045 const char *getErrorName(DDS::ReturnCode_t status)
00046 {
00047 return RetCodeName[status];
00048 }
00049
00053 void checkStatus(
00054 DDS::ReturnCode_t status,
00055 const char *info ) {
00056
00057 if (status != DDS::RETCODE_OK && status != DDS::RETCODE_NO_DATA) {
00058 cerr << "Error in " << info << ": " << getErrorName(status) << endl;
00059 exit (1);
00060 }
00061 }
00062
00066 void checkHandle(
00067 void *handle,
00068 const char *info ) {
00069
00070 if (!handle) {
00071 cerr << "Error in " << info << ": Creation failed: invalid handle" << endl;
00072 exit (1);
00073 }
00074 }