static void determineMaxFid (mamaDictionary dictionary, mamaMsg msg) { const char* userSymbol; /* Determine the maximum field id */ mamaMsg_iterateFields (msg, maxIterator, NULL, self); if (dictionary->mSubscription) { mamaSubscription_getSymbol (dictionary->mSubscription, &userSymbol); mama_log (MAMA_LOG_LEVEL_FINE, "%s%s DICT maxFid: %d", userSymbolFormatted, self->mMaxFid); } else { mama_log (MAMA_LOG_LEVEL_FINE, "DICT maxFid: %d", self->mMaxFid); } }
/* Description: Create a mamaMsg, add strings to fields in the message, * and iterate through the fields printing values via * callback method. * * Expected Result: MAMA_STATUS_OK */ TEST_F (MsgIterateTestC, IteratorCallback) { /* create a mama message. */ mamaMsg msg = NULL; mamaMsg_create (&msg); /* add a fields to the message. */ mamaMsg_addString (msg, "string", 101, "This is an iteration test."); mamaMsg_addU8 (msg, "u8", 102, 8); mamaMsg_addU16 (msg, "u16", 103, 16); mamaMsg_addU32 (msg, "u32", 104, 32); mamaMsg_addU64 (msg, "u64", 105, 64); /* iterate through the msg's fields */ ASSERT_EQ (MAMA_STATUS_OK, mamaMsg_iterateFields (msg, msgOnField, NULL, (void*) 2)); /* destroy the message. */ mamaMsg_destroy (msg); }
void displayMsg (mamaMsg msg) { mamaMsg_iterateFields (msg, displayCb, NULL, msg); }
static void getAndStoreFields (mamaDictionary dictionary, mamaMsg msg) { mamaMsg_iterateFields (msg, dictMsgIterator, NULL, self); }