class TSwizzleC : public TSwizzleCBase |
Maintains a dual representation for a constant object. The representation is:
by stream id, if the object is not in memory (the stream contains the external representation of that object).
by pointer, if the object is in memory.
The template class defines the type of object for which the swizzle is a representation. Access to the to the represented object is available through the swizzle, but is limited. The represented object cannot be changed.
Maintaining a dual representation for an object allows the loading of objects into memory from a store to be deferred; this is particularly important in complex applications.
Public Member Functions | |
---|---|
TSwizzleC() | |
TSwizzleC(const T *) | |
TSwizzleC(TStreamId) | |
TSwizzleC(TSwizzle< T >) | |
const T * | AsPtr() |
void | ExternalizeL(RWriteStream &) |
operator const T *() | |
const T & | operator*() |
const T * | operator->() |
TSwizzleC< T > & | operator=(const T *) |
TSwizzleC | ( | ) | [inline] |
Constructs an uninitialised swizzle. It is necessary because there are also non-default constructors in this class.
TSwizzleC | ( | const T * | aPtr | ) | [inline] |
Constructs a swizzle for a class T type object and represents the object by pointer.
const T * aPtr | A pointer to a class T type object. |
TSwizzleC | ( | TStreamId | anId | ) | [inline] |
Constructs a swizzle for a class T type object and represents the object as a stream id.
TStreamId anId | The stream id of a stream containing the external representation of an object of type class T. |
TSwizzleC | ( | TSwizzle< T > | aSwizzle | ) | [inline] |
Constructs a swizzle for a class T type object that is currently represented by another swizzle.
The representation of the class T type object is the same as its representation by the specified swizzle, i.e. if the specified swizzle represents the object as a pointer, then this newly constructed swizzle also represents the object as a pointer.
TSwizzle< T > aSwizzle | The swizzle whose representation of the class T type object is to be copied to this swizzle. |
const T * | AsPtr | ( | ) | const [inline] |
Returns a constant pointer to the object which this swizzle represents.
Note:
The in memory object cannot be changed through this swizzle.
To access members of the object, the indirect component selector operator->() can be used.
A const pointer to the class T type object represented by this swizzle.
void | ExternalizeL | ( | RWriteStream & | aStream | ) | const [inline] |
Externalises the stream id of the stream associated with this swizzle.
This function presupposes that:
a store map, i.e. an object of type CStoreMap, has been constructed
the id of the stream containing the external representation of the <class T> object has been bound to this swizzle and added to the store map.
the concrete stream referenced by aStream has been constructed, specifying the store map as an externalizer.
The presence of this function means that the standard templated operator<<() can be used.
RWriteStream & aStream | Stream to which the stream id should be externalised |
const T & | operator* | ( | ) | const [inline] |
Returns a const reference to the type T object which this swizzle represents.
A const reference to the type T object represented by this swizzle.
const T * | operator-> | ( | ) | const [inline] |
Gives access to members of the type T object which this swizzle represents.
Note:
use the AsPtr() member function to return a pointer to the object itself.
the type T object cannot be changed through this operator.
A const pointer to the T type object; not explicitly accessible.
TSwizzleC< T > & | operator= | ( | const T * | aPtr | ) | [inline] |
Sets this swizzle to represent the in-memory type T object, pointed to by the specified T* pointer.
A reference to this swizzle representing the object of type T.
const T * aPtr | A pointer to an object of type T which the swizzle is to represent. |