void DictionaryImpl::buildDictionaryFromMessage(MamaMsg& msg) { if (!mDictionary) { mamaTry(mamaDictionary_create(&mDictionary)); mamaTry(mamaDictionary_buildDictionaryFromMessage( mDictionary,msg.getUnderlyingMsg())); } return; }
void MsgNewIteratorTestC::SetUp(void) { mama_loadBridge (&mBridge, getMiddleware()); mama_open(); /* add a fields to the message. */ mamaMsg_create (&msg); mamaMsg_addU8 (msg, "u8", 101, 8); mamaMsg_addString (msg, "string", 102, "This is an iteration test."); mamaMsg_addU16 (msg, "u16", 103, 16); mamaMsg_addU32 (msg, "u32", 104, 32); mamaMsg_addU64 (msg, "u64", 105, 64); /* Build the MAMA Dictionary from our test message. */ mamaDictionary_create (&dict); mamaDictionary_buildDictionaryFromMessage (dict, msg); /* Create the message iterator */ mamaMsgIterator_create (&iterator, dict); mamaMsgIterator_associate (iterator, msg); }
static void processMsg( mamaDictionary dictionary, const mamaMsg msg ) { mamaMsgStatus msgStatus = -1; mamaMsgType msgType = -1; msgStatus = mamaMsgStatus_statusForMsg( msg ); msgType = mamaMsgType_typeForMsg( msg ); if( msgStatus == MAMA_MSG_STATUS_TIMEOUT ) { self->mCallbackSet.onTimeout( dictionary, self->mClosure ); return; } if( msgStatus != MAMA_MSG_STATUS_OK && msgType != MAMA_MSG_TYPE_DDICT_SNAPSHOT && msgType != MAMA_MSG_TYPE_UPDATE ) { char errBuf[1024]; snprintf( errBuf, 1023, "Error: mamaDictionary: unexpected " "MsgType/MsgStatus: %s/%s\n", mamaMsgType_stringForType(msgType), mamaMsgStatus_stringForStatus(msgStatus)); self->mCallbackSet.onError( dictionary, errBuf, self->mClosure ); return; } mamaDictionary_buildDictionaryFromMessage( dictionary, msg ); mamaSubscription_destroy (self->mSubscription); mamaSubscription_deallocate (self->mSubscription); self->mSubscription = NULL; /* do this last in case the dictionary transport is destroyed in the callback */ self->mCallbackSet.onComplete( dictionary, self->mClosure ); }
void MsgNewIteratorTestC::SetUp(void) { mama_loadBridge (&mBridge, getMiddleware()); mama_open(); /* add a fields to the message. */ mamaMsg_create (&msg); for (mama_fid_t f = 101; f < 106; f++) { char buf[64]; sprintf (buf, "field_%u", f); int val = rand(); mamaMsg_addU64 (msg, buf, f, val); values.insert(std::pair<mama_fid_t, uint64_t>(f, val)); } /* Build the MAMA Dictionary from our test message. */ mamaDictionary_create (&dict); mamaDictionary_buildDictionaryFromMessage (dict, msg); /* Create the message iterator */ mamaMsgIterator_create (&iterator, dict); mamaMsgIterator_associate (iterator, msg); }