00001
00020 #ifndef RTC_DATAPORTSTATUS_H
00021 #define RTC_DATAPORTSTATUS_H
00022
00023 #include <vector>
00024
00025 namespace RTC
00026 {
00054 class DataPortStatus
00055 {
00056 public:
00143 enum Enum
00144 {
00145 PORT_OK = 0,
00146 PORT_ERROR,
00147 BUFFER_ERROR,
00148 BUFFER_FULL,
00149 BUFFER_EMPTY,
00150 BUFFER_TIMEOUT,
00151 SEND_FULL,
00152 SEND_TIMEOUT,
00153 RECV_EMPTY,
00154 RECV_TIMEOUT,
00155 INVALID_ARGS,
00156 PRECONDITION_NOT_MET,
00157 CONNECTION_LOST,
00158 UNKNOWN_ERROR
00159 };
00160
00184 static const char* toString(DataPortStatus::Enum status)
00185 {
00186 const char* str[] = {
00187 "PORT_OK",
00188 "PORT_ERROR",
00189 "BUFFER_ERROR",
00190 "BUFFER_FULL",
00191 "BUFFER_EMPTY",
00192 "BUFFER_TIMEOUT",
00193 "SEND_FULL",
00194 "SEND_TIMEOUT",
00195 "RECV_EMPTY",
00196 "RECV_TIMEOUT",
00197 "INVALID_ARGS",
00198 "PRECONDITION_NOT_MET",
00199 "CONNECTION_LOST",
00200 "UNKNOWN_ERROR"
00201 };
00202 return str[status];
00203 }
00204 };
00205
00206 typedef std::vector<DataPortStatus::Enum> DataPortStatusList;
00207
00208 };
00209
00233 #define DATAPORTSTATUS_ENUM \
00234 typedef ::RTC::DataPortStatus::Enum ReturnCode; \
00235 using ::RTC::DataPortStatus::PORT_OK; \
00236 using ::RTC::DataPortStatus::PORT_ERROR; \
00237 using ::RTC::DataPortStatus::BUFFER_FULL; \
00238 using ::RTC::DataPortStatus::BUFFER_EMPTY; \
00239 using ::RTC::DataPortStatus::BUFFER_TIMEOUT; \
00240 using ::RTC::DataPortStatus::SEND_FULL; \
00241 using ::RTC::DataPortStatus::SEND_TIMEOUT; \
00242 using ::RTC::DataPortStatus::RECV_EMPTY; \
00243 using ::RTC::DataPortStatus::RECV_TIMEOUT; \
00244 using ::RTC::DataPortStatus::INVALID_ARGS; \
00245 using ::RTC::DataPortStatus::PRECONDITION_NOT_MET; \
00246 using ::RTC::DataPortStatus::CONNECTION_LOST; \
00247 using ::RTC::DataPortStatus::UNKNOWN_ERROR;
00248
00249 #endif // RTC_DATAPORTSTATUS_H