void MamdaQuoteToBookListenerImpl::onField (const MamaMsg&      msg,
                                            const MamaMsgField& field,
                                            void*               closure)
{
    uint16_t fid = field.getFid();
    if (fid <= mFieldUpdatersSize)
    {
        QuoteToBookFieldUpdate* updater = mFieldUpdaters[fid];
        if (updater)
        {
            updater->onUpdate (*this, field);
        }
    }
}
Ejemplo n.º 2
0
 void MamdaFundamentalListener::MamdaFundamentalListenerImpl::onField (
     const MamaMsg&       msg,
     const MamaMsgField&  field,
     void*                closure)
 {
     uint16_t fid = field.getFid();
     if (fid <= mFieldUpdatersSize)
     {
         FundamentalFieldUpdate* updater = mFieldUpdaters[fid];
         if (updater)
         {
             updater->onUpdate (*this, field);
         }
     }
 }
uint32_t MamaRecordedMessageCodec::encodeField(char*& buffer, MamaMsgField& mmf)
{

	uint32_t r = 0;

	mamaFieldType mft = mmf.getType();
	// These modifications will be applied regardless of data type
	mama_fid_t mff = mmf.getFid();

	memcpy(buffer, &mff, 2);
	buffer += 2;
	memcpy(buffer, &mft, 4);
	buffer += 4;
	r += 6;

	switch(mft)
	{
	case MAMA_FIELD_TYPE_BOOL:
		r += encodeBool(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_CHAR:
		r += encodeChar(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_I8:
		r += encodeI8(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_U8:
		r += encodeU8(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_I16:
		r += encodeI16(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_U16:
		r += encodeU16(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_I32:
		r += encodeI32(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_U32:
		r += encodeU32(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_I64:
		r += encodeI64(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_U64:
		r += encodeU64(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_F32:
		r += encodeF32(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_F64:
		r += encodeF64(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_TIME:
		r += encodeTime(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_PRICE:
		r += encodePrice(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_STRING:
		r += encodeString(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_VECTOR_STRING:
		r += encodeVectorString(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_VECTOR_I32:
		r += encodeVectorI32(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_VECTOR_F64:
		r += encodeVectorF64(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_MSG:
		r += encodeMsgField(buffer, mmf);
		break;
	case MAMA_FIELD_TYPE_VECTOR_MSG:
		r += encodeVectorMsg(buffer, mmf);
		break;
	default:
		break;
	}
	return r;
}