00001 //Dear emacs, this is -*- c++ -*- 00002 00014 #ifndef EFORMAT_STATUS_H 00015 #define EFORMAT_STATUS_H 00016 00017 #include <stdint.h> 00018 00019 namespace eformat { 00020 00024 enum GenericStatus { 00025 NO_ERROR = 0x0, 00026 BCID_CHECK_FAIL = 0x1, 00027 LVL1ID_CHECK_FAIL = 0x2, 00028 TIMEOUT = 0x4, 00029 DATA_CORRUPTION = 0x8, 00030 INTERNAL_OVERFLOW = 0x16 00031 }; 00032 00036 typedef enum GenericStatus GenericStatus; 00037 00038 const uint32_t STATUS_FRONT = 0; 00039 const uint32_t STATUS_BACK = 1; 00040 00044 const uint32_t DEFAULT_STATUS = NO_ERROR; 00045 00046 namespace helper { 00047 00051 class Status { 00052 00053 public: 00060 Status (eformat::GenericStatus gen, uint16_t spec) 00061 : m_gen(gen), m_spec(spec) {} 00062 00070 Status (uint32_t v); 00071 00075 inline eformat::GenericStatus generic (void) const { return m_gen; } 00076 00080 inline uint16_t specific (void) const { return m_spec; } 00081 00086 uint32_t code (void) const; 00087 00088 private: //representation 00089 00090 eformat::GenericStatus m_gen; 00091 uint16_t m_spec; 00092 00093 }; 00094 00095 } 00096 00097 } 00098 00099 #endif /* EFORMAT_STATUS_H */