#include <ShoreApp.h>
/////////////////////////////////////////////
// Return the OID of T's persistent type object
/////////////////////////////////////////////
shrc Ref<T>::get_type(LOID &type_loid) const;
/////////////////////////////////////////////
// The combination of the macro TYPE_OBJECT
// and the method isa() lets you cast references:
//
// returns a Ref<T>
// if "any" points to a T or subclass of T;
// otherwise they return a null ref:
//
// pardon the pseudo-code ...
/////////////////////////////////////////////
const Ref<T> TYPE_OBJECT(T).isa(const Ref<U> &any);
{
Ref<any> aref;
Ref<I> iref;
iref = TYPE_OBJECT(I).isa(a);
}
The first form of get_type returns the logical oid of the object's type object. If the ref is nil, LOID::null is returned.
The CPP macro TYPE_OBJECT(T) yields a reference to the compiled-in C++ type object for T. Uses of TYPE_OBJECT will not compile if the SDL language binding for T is not included at compile time.
The second form of get_type returns a pointer to the given object's C++ type object, even if the SDL language binding for T is not included at compile time. In that case, the C++ type object is constructed from the type's persistent object. A null pointer is returned if the reference is not to a Shore object.
Get_type obtains a SH-mode (share-mode) lock on the object.
The method isa returns typed references:
iref = TYPE_OBJECT(T).isa(a);
If
any
points to a T or subclass of T,
any
is cast to a
Ref<T>
and returned.
If not,
a null reference is returned.
ref(cxxlb) , stat(oc) , ostat(cxxlb) .