PolyBoRi
|
00001 // -*- c++ -*- 00002 //***************************************************************************** 00014 //***************************************************************************** 00015 00016 // include basic definitions 00017 #include "pbori_defs.h" 00018 00019 #ifndef CCheckedIdx_h_ 00020 #define CCheckedIdx_h_ 00021 00022 BEGIN_NAMESPACE_PBORI 00023 00029 class CCheckedIdx: 00030 public CTypes::auxtypes_type { 00031 00033 typedef CCheckedIdx self; 00034 00035 public: 00036 CCheckedIdx(idx_type idx): m_idx(idx) { 00037 if UNLIKELY(idx < 0) handle_error(); 00038 } 00039 CCheckedIdx(const self& rhs): m_idx(rhs.m_idx) { } 00040 ~CCheckedIdx() {} 00041 00042 operator idx_type() const { return m_idx; } 00043 private: 00044 void handle_error() const; 00045 idx_type m_idx; 00046 }; 00047 00048 END_NAMESPACE_PBORI 00049 00050 #endif