コード例 #1
0
 void onUpdate (MamdaFundamentalListener::MamdaFundamentalListenerImpl&  impl,
                const MamaMsgField&                                      field)
 {
     switch (field.getType())
     {
         case MAMA_FIELD_TYPE_I8:
         case MAMA_FIELD_TYPE_U8:
         case MAMA_FIELD_TYPE_I16:
         case MAMA_FIELD_TYPE_U16:
         case MAMA_FIELD_TYPE_I32:
         case MAMA_FIELD_TYPE_U32:
             impl.mDivFreq = impl.getDividendFrequency (field.getU32());
             impl.mDivFreqFieldState = MODIFIED;
             break;
         case MAMA_FIELD_TYPE_STRING:
             impl.mDivFreq = impl.getDividendFrequency (field.getString());
             impl.mDivFreqFieldState = MODIFIED;
             break;
         default:
             mama_log (MAMA_LOG_LEVEL_FINE,
                       "Unhandled type %d for wDivFreq.  "
                       "Expected string or integer.", 
                       field.getType());
             break;
     }
 }
コード例 #2
0
 void onUpdate (MamdaQuoteToBookListenerImpl&  impl,
                const MamaMsgField&            field)
 {
     if (field.getType () == MAMA_FIELD_TYPE_STRING)
     {
         impl.mQuoteCache.mQuoteQualNative = field.getString();
     }
     else if (field.getType () == MAMA_FIELD_TYPE_CHAR)
     {
         impl.mQuoteCache.mQuoteQualNative = field.getChar();
     }
 }
コード例 #3
0
        void onUpdate (MamdaFundamentalListener::MamdaFundamentalListenerImpl&  impl,
                        const MamaMsgField&                                     field)
        {

           const char* marketSegment;
           int segment;

            switch (field.getType())
            {
                case MAMA_FIELD_TYPE_I8:
                case MAMA_FIELD_TYPE_U8:
                case MAMA_FIELD_TYPE_I16:
                case MAMA_FIELD_TYPE_U16:
                case MAMA_FIELD_TYPE_I32:
                case MAMA_FIELD_TYPE_U32:
                    segment = field.getU32();
                    if (0 == segment)
                    {
                        impl.mMarketSegment = MamdaFundamentalFields::MRKT_SEGMENT_NONE;
                        impl.mMarketSegmentFieldState = MODIFIED;
                    }
                    else
                    {
                        ostringstream stringbuilder;
                        stringbuilder << segment;
                        impl.mMarketSegment = stringbuilder.str();
                        impl.mMarketSegmentFieldState = MODIFIED;
                    }
                    break;
                case MAMA_FIELD_TYPE_STRING:
                    marketSegment = field.getString();
                    if (strcmp (marketSegment, "0") == 0)
                    {
                        // No market segment is known/available for this security
                        impl.mMarketSegment = MamdaFundamentalFields::MRKT_SEGMENT_NONE;
                        impl.mMarketSegmentFieldState = MODIFIED;
                    }
                    else
                    {
                        // Already a string;
                        impl.mMarketSegment = marketSegment;
                        impl.mMarketSegmentFieldState = MODIFIED;
                    }
                    break;
                default:
                    mama_log (MAMA_LOG_LEVEL_FINE,
                              "Unhandled type %d for wMarketSegment.  "
                              "Expected string or integer.", 
                              field.getType());
                    break;
            }
        }
コード例 #4
0
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;
}