Classes Files

Wombat::MamaFieldCache

More…

#include <MamaFieldCache.h>

Public Classes

  Name
class const_iterator
class iterator
class MamaFieldCacheIterator

Public Functions

  Name
  MamaFieldCache()
virtual ~MamaFieldCache()
virtual void create()
virtual void clear()
virtual mama_size_t getSize() const
virtual void setTrackModified(bool value)
virtual bool getTrackModified() const
virtual void setUseFieldNames(bool value)
virtual bool getUseFieldNames() const
virtual void setUseLock(bool value)
virtual bool getUseLock() const
virtual void lock()
virtual void unlock()
virtual const MamaFieldCacheField * find(mama_fid_t fid, const char * name =NULL) const
virtual MamaFieldCacheField * find(mama_fid_t fid, const char * name =NULL)
virtual void setModified(MamaFieldCacheField & field)
virtual void apply(const MamaFieldCacheField & field)
virtual void apply(const MamaMsg & msg, const MamaDictionary * dict =NULL)
virtual void apply(const MamaFieldCacheRecord & record)
virtual void getFullMessage(MamaMsg & msg)
virtual void getDeltaMessage(MamaMsg & msg)
virtual void clearModifiedFields()
virtual const_iterator begin() const
virtual iterator begin()
virtual const_iterator end() const
virtual iterator end()

Detailed Description

class Wombat::MamaFieldCache;

The [MamaFieldCache](classWombat_1_1MamaFieldCache.html) class is a collection of unordered [MamaFieldCacheField](classWombat_1_1MamaFieldCacheField.html) elements. This class provides methods for creating and finding fields, applying changes to the fields in the cache and populating a MamaMsg with the fields in cache.

Public Functions Documentation

function MamaFieldCache

MamaFieldCache()

Constructor. Use create to create the actual cache.

function ~MamaFieldCache

virtual ~MamaFieldCache()

Destructor. This is called automatically when an object is destroyed. This method will clean all the memory allocated.

function create

virtual void create()

Create a MamaFieldCache.

function clear

virtual void clear()

Clear the [MamaFieldCache](classWombat_1_1MamaFieldCache.html). No fields will be present in the cache after this operation. The cache is ready to be used, as long as create has been called once.

function getSize

virtual mama_size_t getSize() const

Return: The number of fields in cache.

Return the number of fields in cache.

function setTrackModified

virtual void setTrackModified(
    bool value
)

Parameters:

  • value Specify whether field modifications will be tracked.

Set if field modifications are tracked when creating a delta message. See method getDeltaMessage. When modifications are not tracked, then calling getDeltaMessage is the same as calling getFullMessage.

function getTrackModified

virtual bool getTrackModified() const

Return: Whether tracking modifications is enabled or not.

Return the value of the track modifications flag.

function setUseFieldNames

virtual void setUseFieldNames(
    bool value
)

Parameters:

  • value Specify whether field names will be used.

Set if field names are used when adding fields to MamaMsg. See methods getDeltaMessage and getFullMessage.

function getUseFieldNames

virtual bool getUseFieldNames() const

Return: Whether field names are enabled or not.

Return the value of the use field names flag.

function setUseLock

virtual void setUseLock(
    bool value
)

Parameters:

  • value Specify whether locking will be used.

Set if the cache uses a lock when some methods are called for thread safety.

function getUseLock

virtual bool getUseLock() const

Return: Whether the cache is using a lock or not.

Return the value of the locking flag.

function lock

virtual void lock()

Lock the cache.

function unlock

virtual void unlock()

Unlock the cache.

function find

virtual const MamaFieldCacheField * find(
    mama_fid_t fid,
    const char * name =NULL
) const

Parameters:

  • fid Field id of the field to look up.
  • name Field name of the field to look up.

Return: The field in the cache (if present)

Retrieve a field from the cache. Note that the field returned is a pointer to a reusable MamaFieldCacheField field for the MamaFieldCache which will be overwritten each time the function is called. If the field is not found then NULL is returned.

function find

virtual MamaFieldCacheField * find(
    mama_fid_t fid,
    const char * name =NULL
)

Parameters:

  • fid Field id of the field to look up.
  • name Field name of the field to look up.

Return: The field in the cache (if present)

Retrieve a field from the cache. Note that the field returned is a pointer to a reusable MamaFieldCacheField field for the MamaFieldCache which will be overwritten each time the function is called. If the field is not found then NULL is returned.

function setModified

virtual void setModified(
    MamaFieldCacheField & field
)

Parameters:

  • field The field to set the modified flag to.

Set the specified field as modified even if the value has not changed.

function apply

virtual void apply(
    const MamaFieldCacheField & field
)

Parameters:

  • field The field to use for updating the cache.

Update the cache content with the field given. If the field is already present, it will be updated, otherwise it will be added to the cache.

function apply

virtual void apply(
    const MamaMsg & msg,
    const MamaDictionary * dict =NULL
)

Parameters:

  • msg Reference to a [MamaMsg](classWombat_1_1MamaMsg.html) containing the fields to update in the cache.
  • dict Reference to a [MamaDictionary](classWombat_1_1MamaDictionary.html) representing a data dictionary.

Update the cache content with the data contained in the message.

function apply

virtual void apply(
    const MamaFieldCacheRecord & record
)

Parameters:

  • record Reference to a [MamaFieldCacheRecord](classWombat_1_1MamaFieldCacheRecord.html) containing the fields to update in the cache.

Update the cache content with the data contained in the record.

function getFullMessage

virtual void getFullMessage(
    MamaMsg & msg
)

Parameters:

  • msg MamaMsg which will be populated with the fields from the cache.

Populate a MamaMsg with all the fields present in the cache.

function getDeltaMessage

virtual void getDeltaMessage(
    MamaMsg & msg
)

Parameters:

  • msg MamaMsg which will be populated with the modified fields from the cache.

Populate a MamaMsg with all the fields currently modified in the cache. Note that this method also resets the modification state of the modified fields. If trackModifications flag is set to false, then this method is the same as getFullMessage.

function clearModifiedFields

virtual void clearModifiedFields()

Clear the list of all the modified fields and reset the modified flags for all the modified fields in the cache.

function begin

virtual const_iterator begin() const

Return: An iterator to the first element in the cache.

Return a constant iterator to the first field in the cache and allows to iterate over the fields in the cache.

function begin

virtual iterator begin()

Return: An iterator to the first element in the cache.

Return an iterator to the first field in the cache and allows to iterate over the fields in the cache.

function end

virtual const_iterator end() const

Return: An iterator to the first element in the cache.

Return a const iterator to an invalid element and allows to check if an iterator has arrived to the end (no more elements to iterate). The content of this iterator must not be accessed.

function end

virtual iterator end()

Return: An iterator to the first element in the cache.

Return an iterator to an invalid element and allows to check if an iterator has arrived to the end (no more elements to iterate). The content of this iterator must not be accessed.


Updated on 2023-03-31 at 15:29:24 +0100