The template structure Id provides type-safe object identifiers: Many database tables have an integer primary key. Id allows for typesafe "references" to objects via their id. Consider and compare the two code fragments below:
// not type-safe class C { public: ... long oid; ... }; C* findC(long cid); // any long to search for a C accepted!
// type-safe using Id<T> class C { public: typedef Id<C> Oid; ... Oid oid; ... }; C* findC(const Id<C>& cid); // compiler error if findC() is not // called with correct type
Definition at line 86 of file osbid.h.
OSB_LIB::Id< T >::Id | ( | long | id = ID_NOT_SET |
) | [inline, explicit] |
long OSB_LIB::Id< T >::id | ( | ) | const [inline] |
bool OSB_LIB::Id< T >::isSet | ( | ) | const [inline] |
bool OSB_LIB::Id< T >::notSet | ( | ) | const [inline] |
Check if object id is not set.
Definition at line 95 of file osbid.h.
Referenced by OSB_LIB::Id< OSB_LIB::Contract >::isSet(), and OSB_DB::OtlId::OtlId().
bool OSB_LIB::Id< T >::operator!= | ( | const Id< T > & | rhs | ) | const [inline] |
bool OSB_LIB::Id< T >::operator< | ( | const Id< T > & | rhs | ) | const [inline] |
bool OSB_LIB::Id< T >::operator<= | ( | const Id< T > & | rhs | ) | const [inline] |
bool OSB_LIB::Id< T >::operator== | ( | const Id< T > & | rhs | ) | const [inline] |
bool OSB_LIB::Id< T >::operator> | ( | const Id< T > & | rhs | ) | const [inline] |
bool OSB_LIB::Id< T >::operator>= | ( | const Id< T > & | rhs | ) | const [inline] |
long OSB_LIB::Id< T >::id_ [private] |
The value of the id.
Definition at line 111 of file osbid.h.
Referenced by OSB_LIB::Id< OSB_LIB::Contract >::id(), OSB_LIB::Id< OSB_LIB::Contract >::notSet(), OSB_LIB::Id< OSB_LIB::Contract >::operator!=(), OSB_LIB::Id< OSB_LIB::Contract >::operator<(), OSB_LIB::Id< OSB_LIB::Contract >::operator<=(), OSB_LIB::Id< OSB_LIB::Contract >::operator==(), OSB_LIB::Id< OSB_LIB::Contract >::operator>(), and OSB_LIB::Id< OSB_LIB::Contract >::operator>=().