Classes Files

Wombat::MamaDictionary

More…

#include <MamaDictionary.h>

Public Functions

  Name
virtual ~MamaDictionary()
  MamaDictionary(void )
virtual void create(MamaQueue * queue, MamaDictionaryCallback * callback, MamaSource * source, int retries =MAMA_DEFAULT_RETRIES, double timeout =MAMA_DEFAULT_TIMEOUT, void * closure =NULL)
virtual const char * getFeedName()
virtual const char * getFeedHost()
virtual MamaFieldDescriptor * getFieldByFid(mama_fid_t fid)
virtual const MamaFieldDescriptor * getFieldByFid(mama_fid_t fid) const
virtual MamaFieldDescriptor * getFieldByIndex(size_t index)
virtual const MamaFieldDescriptor * getFieldByIndex(size_t index) const
virtual MamaFieldDescriptor * getFieldByName(const char * name)
virtual const MamaFieldDescriptor * getFieldByName(const char * name) const
virtual mama_fid_t getMaxFid(void ) const
virtual size_t getSize(void ) const
virtual bool hasDuplicates(void ) const
virtual MamaDictionaryCallback * getCallback(void ) const
virtual void setCallback(MamaDictionaryCallback * callback)
virtual mamaDictionary getDictC()
virtual const mamaDictionary getDictC() const
virtual void * getClosure(void ) const
virtual MamaMsg * getDictionaryMessage() const
virtual void buildDictionaryFromMessage(MamaMsg & msg)
virtual MamaFieldDescriptor * createFieldDescriptor(mama_fid_t fid, const char * name, mamaFieldType type)
virtual void setMaxFid(mama_size_t maxFid)
virtual void writeToFile(const char * fileName)
virtual void populateFromFile(const char * fileName)

Public Attributes

  Name
DictionaryImpl * mPimpl

Detailed Description

class Wombat::MamaDictionary;

The [MamaDictionary](classWombat_1_1MamaDictionary.html) class maps field identifiers (FIDs) to human readable strings. Incoming [MamaMsg](classWombat_1_1MamaMsg.html)s may contain FIDs but no field names. The dictionary allows applications to determine the name associated with a given FID. On some platforms, the inbound messages may have names, but not fids in which case the dictionary can map names to fids.

Public Functions Documentation

function ~MamaDictionary

virtual ~MamaDictionary()

function MamaDictionary

MamaDictionary(
    void 
)

function create

virtual void create(
    MamaQueue * queue,
    MamaDictionaryCallback * callback,
    MamaSource * source,
    int retries =MAMA_DEFAULT_RETRIES,
    double timeout =MAMA_DEFAULT_TIMEOUT,
    void * closure =NULL
)

Parameters:

  • queue The mama queue.
  • callback The dictionary callback.
  • source The dictionary source. Depends upon feed handler configuration. See feed handler documentation for details
  • timeout The timeout in seconds.
  • retries The number of times to retry before failing.
  • closure The caller supplied closure.

Create a dictionary subscription. The caller supplied DictionaryCallback.onComplete will be invoked after the dictionary is fully constructed.

If there is an error creating the dictionary Mama invokes the onError callback, and the returned dictionary is not valid. In the event of a timeout, Mama invokes the onTimeout callback. This method uses the default timeout and retry values (SubscriptionBridge.DEFAULT_TIMEOUT and SubscriptionBridge.DEFAULT_RETRIES.

function getFeedName

virtual const char * getFeedName()

Parameters:

  • dictionary The dictionary.

Return: the feed name

Return the dictionary source feed name

function getFeedHost

virtual const char * getFeedHost()

Parameters:

  • dictionary The dictionary.

Return: the feed host

Return the dictionary source feed host

function getFieldByFid

virtual MamaFieldDescriptor * getFieldByFid(
    mama_fid_t fid
)

Parameters:

  • fid The field id.

Return: The field.

Return the field with the specified field FID. This method is very efficient.

function getFieldByFid

virtual const MamaFieldDescriptor * getFieldByFid(
    mama_fid_t fid
) const

Parameters:

  • fid The field id.

Return: The field.

Return the field with the specified field FID. This method is very efficient.

function getFieldByIndex

virtual MamaFieldDescriptor * getFieldByIndex(
    size_t index
)

Parameters:

  • index The index.

Return: The field.

Return the field with the corresponding zero based index. This method is O (N) with respect to the size of the dictionary.

function getFieldByIndex

virtual const MamaFieldDescriptor * getFieldByIndex(
    size_t index
) const

Parameters:

  • index The index.

Return: The field.

Return the field with the corresponding zero based index. This method is O (N) with respect to the size of the dictionary.

function getFieldByName

virtual MamaFieldDescriptor * getFieldByName(
    const char * name
)

Parameters:

  • name The name of the field.

Return: The field with the specified name or null if there is no such field.

Return the field with the specified name. If there is more than one field with the same name, the one with the lowest field id is returned.

function getFieldByName

virtual const MamaFieldDescriptor * getFieldByName(
    const char * name
) const

Parameters:

  • name The name of the field.

Return: The field with the specified name or null if there is no such field.

Return the field with the specified name. If there is more than one field with the same name, the one with the lowest field id is returned.

function getMaxFid

virtual mama_fid_t getMaxFid(
    void 
) const

Return: The highest FID.

Return the highest field identifier.

function getSize

virtual size_t getSize(
    void 
) const

Return: The number of entries in the dictionary.

Return the number of fields in the dictionary.

function hasDuplicates

virtual bool hasDuplicates(
    void 
) const

Return: true if there are duplicates.

Return true if there are multiple fields with the same name.

function getCallback

virtual MamaDictionaryCallback * getCallback(
    void 
) const

See: MamaDictionaryCallback

Return: The callback

Return the callback.

function setCallback

virtual void setCallback(
    MamaDictionaryCallback * callback
)

Parameters:

  • callback The callback.

Set the callback to receive notifications when creation is complete or an error occurs.

function getDictC

virtual mamaDictionary getDictC()

Return the underlying C mamaDictionary.

function getDictC

virtual const mamaDictionary getDictC() const

Return the underlying C mamaDictionary.

function getClosure

virtual void * getClosure(
    void 
) const

Return: the closure.

Return the closure for the dictionary.

function getDictionaryMessage

virtual MamaMsg * getDictionaryMessage() const

Return: Pointer to a new MamaMsg for the dictionary.

Returns a MamaMsg representing the data dictionary. This message can be published or used to create a new MamaDictionary object. A new MamaMsg is created for each invocation of the method. It is the responsibility of the caller to delete the message when no longer needed.

function buildDictionaryFromMessage

virtual void buildDictionaryFromMessage(
    MamaMsg & msg
)

Parameters:

  • msg Reference to a MamaMsg representing a data dictionary.

Recreate a data dictionary from the MamaMsg supplied. The MamaMsg is copied and can therefore be deleted after the method has returned.

function createFieldDescriptor

virtual MamaFieldDescriptor * createFieldDescriptor(
    mama_fid_t fid,
    const char * name,
    mamaFieldType type
)

Parameters:

  • fid The fid for the new field descriptor.
  • name The name for the new field descriptor.
  • type The type for the new field descriptor.

Add a new field descriptor to a dictionary. New fields can be added to an existing dictionary obtained from the MAMA infrastructure. This function can also be used to manually build a data dictionary.

function setMaxFid

virtual void setMaxFid(
    mama_size_t maxFid
)

Parameters:

  • maxFid The probable maximum fid being added to the dictionary.

Tell the dictionary what the probable maximum fid in the data dictionary may be. This is not necessary but will aid performance for manually creating a new dictionary or adding new fields to an existing dictionary.

Calling this function ensures that there is capacity in the dictionary for field descriptors with fids up to the maximum specified.

Fields with fids greater than specified can be added to the dictionary but this will incur the overhead of allocating more memory and copying dictionary elements.

function writeToFile

virtual void writeToFile(
    const char * fileName
)

Parameters:

  • fileName The name of the file to serialize the dictionary to. This can be a fully qualified name, relative or a file on the $WOMBAT_PATH
Write the data dictionary to a file. The dictionary will be written in the form: fid fieldName fieldType

function populateFromFile

virtual void populateFromFile(
    const char * fileName
)

Parameters:

  • fileName The file from which to populate the dictionary. This can be a fully qualified name, relative or a file on the $WOMBAT_PATH

Populate a dictionary from the contents of a file. Can be used to add additional fields to an existing dictionary or to populate a new dictionary.

Public Attributes Documentation

variable mPimpl

DictionaryImpl * mPimpl;

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