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
00025 #include "checkStatus.h"
00026
00027
00028 string RetCodeName[13] =
00029 {
00030 "DDS_RETCODE_OK", "DDS_RETCODE_ERROR", "DDS_RETCODE_UNSUPPORTED",
00031 "DDS_RETCODE_BAD_PARAMETER", "DDS_RETCODE_PRECONDITION_NOT_MET",
00032 "DDS_RETCODE_OUT_OF_RESOURCES", "DDS_RETCODE_NOT_ENABLED",
00033 "DDS_RETCODE_IMMUTABLE_POLICY", "DDS_RETCODE_INCONSISTENT_POLICY",
00034 "DDS_RETCODE_ALREADY_DELETED", "DDS_RETCODE_TIMEOUT", "DDS_RETCODE_NO_DATA",
00035 "DDS_RETCODE_ILLEGAL_OPERATION"
00036 };
00037
00041 string getErrorName(DDS::ReturnCode_t status)
00042 {
00043 return RetCodeName[status];
00044 }
00045
00049 bool checkStatus(DDS::ReturnCode_t status, const char *info)
00050 {
00051 if (status != DDS::RETCODE_OK && status != DDS::RETCODE_NO_DATA)
00052 {
00053 cerr << "Error in " << info << ": " << getErrorName(status).c_str() << endl;
00054 return false;
00055 }
00056 return true;
00057 }
00058
00062 bool checkHandle(void *handle, string info)
00063 {
00064 if (!handle)
00065 {
00066 cerr << "Error in " << info.c_str() << ": Creation failed: invalid handle" << endl;
00067 return false;
00068 }
00069 return true;
00070 }