Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: S32STD.H
Link against: estor.lib

Class CStoreMap

class CStoreMap : public CBase, public MExternalizer< TStreamRef >;

Description

Store map used when externalising swizzled in-memory objects.

It has three main characteristics:

it acts as an in-memory repository of stream ids and associated swizzles

it acts as an externaliser for swizzles

it offers cleanup support

Derivation

Members

Defined in CStoreMap:
At(), Begin(), BindL(), CStoreMap(), End(), ExternalizeL(), Forget(), Label(), NewL(), NewLC(), Reset(), ResetAndDestroy(), TEntry, TIterator, Unbind(), ~CStoreMap()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

static IMPORT_C CStoreMap *NewL(CStreamStore &aStore);

Description

Allocates and constructs a store map associated with the specified store and returns a pointer to that store map.

The function leaves if it cannot complete successfully.

Parameters

CStreamStore &aStore

A reference to the store associated with this store map.

Return value

CStoreMap *

A pointer to the new store map object.


NewLC()

static IMPORT_C CStoreMap *NewLC(CStreamStore &aStore);

Description

Allocates and constructs a store map associated with the specified store, returns a pointer to that store map and puts the pointer onto the cleanup stack.

The function leaves if it cannot complete successfully.

Placing a pointer to this object onto the cleanup stack allows the object and allocated resources to be cleaned up if a subsequent leave occurs.

Parameters

CStreamStore &aStore

A reference to the store associated with this store map.

Return value

CStoreMap *

A pointer to the new store map object.


CStoreMap()

IMPORT_C CStoreMap(CStreamStore &aStore);

Description

Parameters

CStreamStore &aStore


~CStoreMap()

IMPORT_C ~CStoreMap();

Description

Frees resources owned by the object, prior to its destruction.

In particular, the destructor deletes all streams whose stream ids are currently held within the store map and then empties the store map.

[Top]


Member functions


BindL()

IMPORT_C void BindL(TSwizzleC< TAny > aSwizzle, TStreamId anId);

Description

Creates an entry in the store map to contain the specified stream id and an associated swizzle. On return from this function, the stream id is said to be bound to the swizzle.

If the store map already contains an entry with the same swizzle, then the new entry replaces the existing entry; in effect, knowledge of the original stream id associated with aSwizzle, is lost.

Callers of this function can pass any type of swizzle as the first parameter, i.e. any swizzle derived from TSwizzleCBase. The required TSwizzleC<TAny> object is constructed from the swizzle passed by the caller.

Note that in most applications, callers pass a general swizzle, i.e. an object of type TSwizzle<class T>, where T is the type of object represented by that swizzle.

Parameters

TSwizzleC< TAny > aSwizzle

Any swizzle derived from TSwizzleCBase.

TStreamId anId

The stream id to be bound to the swizzle.


Unbind()

IMPORT_C void Unbind(TSwizzleC< TAny > aSwizzle);

Description

Deletes the first entry from the store map corresponding to the specified swizzle.

On return from this function, the swizzle is said to be unbound and knowledge of the associated stream id is lost.

Callers of this function can pass any type of swizzle as the parameter, i.e. any swizzle derived from TSwizzleCBase. The required TSwizzleC<TAny> object is constructed from the swizzle passed by the caller.

Notes:

In most applications, callers pass a general swizzle, i.e. an object of type TSwizzle<class T>, where T is the type of object represented by that swizzle.

If no matching entry can be found in the store map, then the store map remains unaltered.

Parameters

TSwizzleC< TAny > aSwizzle

Any swizzle derived from TSwizzleCBase.


Forget()

IMPORT_C void Forget(TStreamId anId);

Description

Deletes an entry from the store map. The entry selected is the first one whose stream id matches the specified stream id.

On return from this function, the stream id is said to be forgotten and knowledge of that stream id is lost.

Parameters

TStreamId anId

The stream id used to identify the entry in the store map to be deleted.


Reset()

IMPORT_C void Reset();

Description

Deletes all entries from the store map.

It is important that this function is called before deleting the store map, as the destructor attempts to delete all streams whose stream ids are held within the map.


ResetAndDestroy()

IMPORT_C void ResetAndDestroy();

Description

Deletes all streams whose ids are held within the store map, and then empties the store map.


At()

IMPORT_C TStreamId At(TSwizzleC< TAny > aSwizzle) const;

Description

Returns the stream id of the first entry the store map matching the specified swizzle.

Callers of this function can pass any type of swizzle as the first parameter, i.e. any swizzle derived from TSwizzleCBase. The required TSwizzleC<TAny> object is constructed from the swizzle passed by the caller.

Parameters

TSwizzleC< TAny > aSwizzle

Any type of swizzle derived from TSwizzleCBase.

Return value

TStreamId

The required streamid::KNullStreamId, if no matching entry can be found.


Label()

IMPORT_C TSwizzleC< TAny > Label(TStreamId anId) const;

Description

Returns the swizzle in the store map assocated with the specified stream id.

Parameters

TStreamId anId

The id of the stream

Return value

TSwizzleC< TAny >

The associated swizzle. If there is no matching swizzle, then this is an uninitialized swizzle.


Begin()

IMPORT_C TIterator Begin() const;

Description

Return value

TIterator


End()

IMPORT_C TIterator End() const;

Description

Return value

TIterator


ExternalizeL()

private: virtual void ExternalizeL(const TStreamRef &aRef, RWriteStream &aStream) const;

Description

Performs externalisation.

The function is called by operator().

Parameters

const TStreamRef &aRef

RWriteStream &aStream

The write stream.

[Top]


Member structures


Struct TEntry

struct TEntry;

Description

Members

Defined in CStoreMap::TEntry:
id, swizzle

Member data


swizzle

TSwizzleC< TAny > swizzle;

Description


id

TStreamId id;

Description

[Top]


Member type definitions


Typedef TIterator

typedef const TEntry* CStoreMap::TIterator;

Description