00001 // $Id: ConnectionID.h,v 1.2 2011/03/07 15:41:54 mommsen Exp $ 00003 00004 #ifndef EventFilter_StorageManager_ConnectionID_h 00005 #define EventFilter_StorageManager_ConnectionID_h 00006 00007 #include <cstddef> 00008 #include <iostream> 00009 00010 namespace smproxy { 00011 00020 struct ConnectionID 00021 { 00022 unsigned int value; 00023 00024 explicit ConnectionID(unsigned int id = 0) : value(id) { } 00025 00026 00030 bool isValid() const { return value != 0; } 00031 00036 bool operator< (ConnectionID other) const { return value < other.value; } 00037 00041 bool operator==(ConnectionID other) const { return value == other.value; } 00042 00046 bool operator!=(ConnectionID other) const { return value != other.value; } 00047 00052 ConnectionID& operator++() { ++value; return *this; } 00053 00058 ConnectionID operator++(int) {ConnectionID ret(*this); ++value; return ret;} 00059 }; 00060 00061 00062 00063 inline 00064 std::ostream& 00065 operator<< ( std::ostream& os, ConnectionID id) 00066 { 00067 return os << id.value; 00068 } 00069 00070 } // namespace smproxy 00071 00072 #endif // EventFilter_StorageManager_ConnectionID_h 00073 00074