void CProtoGearPrice::GetGearArrField(VT_PROTO_FIELD &vtField, const GearPriceAckItem &ackItem) { static BOOL arOptional[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, }; static EProtoFildType arFieldType[] = { ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int64, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int64, }; static LPCSTR arFieldKey[] = { "BuyPrice", "BuyOrder", "BuyVol", "SellPrice", "SellOrder", "SellVol", }; GearPriceAckItem &item = const_cast<GearPriceAckItem &>(ackItem); void *arPtr[] = { &item.nBuyPrice, &item.nBuyOrder, &item.nBuyVolume, &item.nSellPrice, &item.nSellOrder, &item.nSellVolume, }; CHECK_OP(_countof(arOptional) == _countof(arFieldType), NOOP); CHECK_OP(_countof(arOptional) == _countof(arFieldKey), NOOP); CHECK_OP(_countof(arOptional) == _countof(arPtr), NOOP); vtField.clear(); PROTO_FIELD field; for ( int n = 0; n < _countof(arOptional); n++ ) { field.bOptional = arOptional[n]; field.eFieldType = arFieldType[n]; field.strFieldKey = arFieldKey[n]; switch (field.eFieldType) { case ProtoFild_Int32: field.pInt32 = (int*)arPtr[n]; break; case ProtoFild_Int64: field.pInt64 = (INT64*)arPtr[n]; break; case ProtoFild_StringA: field.pStrA = (std::string*)arPtr[n]; break; case ProtoFild_StringW: field.pStrW = (std::wstring*)arPtr[n]; break; default: CHECK_OP(FALSE, NOOP); break; } vtField.push_back(field); } }
//tomodify 8 void CProtoGearPrice::GetProtoBodyField_Ack(VT_PROTO_FIELD &vtField, const ProtoAckBodyType &ackData) { static BOOL arOptional[] = { FALSE, FALSE, }; static EProtoFildType arFieldType[] = { ProtoFild_Int32, ProtoFild_StringA }; static LPCSTR arFieldKey[] = { "Market", "StockCode", }; ProtoAckBodyType &body = const_cast<ProtoAckBodyType &>(ackData); void *arPtr[] = { &body.nStockMarket, &body.strStockCode, }; CHECK_OP(_countof(arOptional) == _countof(arFieldType), NOOP); CHECK_OP(_countof(arOptional) == _countof(arFieldKey), NOOP); CHECK_OP(_countof(arOptional) == _countof(arPtr), NOOP); vtField.clear(); PROTO_FIELD field; for ( int n = 0; n < _countof(arOptional); n++ ) { field.bOptional = arOptional[n]; field.eFieldType = arFieldType[n]; field.strFieldKey = arFieldKey[n]; switch (field.eFieldType) { case ProtoFild_Int32: field.pInt32 = (int*)arPtr[n]; break; case ProtoFild_Int64: field.pInt64 = (INT64*)arPtr[n]; break; case ProtoFild_StringA: field.pStrA = (std::string*)arPtr[n]; break; case ProtoFild_StringW: field.pStrW = (std::wstring*)arPtr[n]; break; default: CHECK_OP(FALSE, NOOP); break; } vtField.push_back(field); } }
//tomodify 7 void CProtoQueryHKOrder::GetProtoBodyField_Req(VT_PROTO_FIELD &vtField, const ProtoReqBodyType &reqData) { static BOOL arOptional[] = { TRUE, FALSE, }; static EProtoFildType arFieldType[] = { ProtoFild_Int32, ProtoFild_Int32, }; static LPCSTR arFieldKey[] = { "EnvType", "Cookie", }; ProtoReqBodyType &body = const_cast<ProtoReqBodyType &>(reqData); void *arPtr[] = { &body.nEnvType, &body.nCookie, }; CHECK_OP(_countof(arOptional) == _countof(arFieldType), NOOP); CHECK_OP(_countof(arOptional) == _countof(arFieldKey), NOOP); CHECK_OP(_countof(arOptional) == _countof(arPtr), NOOP); vtField.clear(); PROTO_FIELD field; for ( int n = 0; n < _countof(arOptional); n++ ) { field.bOptional = arOptional[n]; field.eFieldType = arFieldType[n]; field.strFieldKey = arFieldKey[n]; switch (field.eFieldType) { case ProtoFild_Int32: field.pInt32 = (int*)arPtr[n]; break; case ProtoFild_Int64: field.pInt64 = (INT64*)arPtr[n]; break; case ProtoFild_StringA: field.pStrA = (std::string*)arPtr[n]; break; case ProtoFild_StringW: field.pStrW = (std::wstring*)arPtr[n]; break; default: CHECK_OP(FALSE, NOOP); break; } vtField.push_back(field); } }
void CProtoQueryHKOrder::GetHKOrderArrField(VT_PROTO_FIELD &vtField, const QueryHKOrderAckItem &ackItem) { static BOOL arOptional[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, }; static EProtoFildType arFieldType[] = { ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_StringW, ProtoFild_StringW, ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int32, ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int32, }; static LPCSTR arFieldKey[] = { "LocalID", "OrderID", "OrderType", "OrderSide", "Status", "StockCode", "StockName", "Price", "Qty", "DealtQty", "DealtAvgPrice","SubmitedTime", "UpdatedTime", "ErrCode", }; QueryHKOrderAckItem &item = const_cast<QueryHKOrderAckItem &>(ackItem); void *arPtr[] = { &item.nLocalID, &item.nOrderID, &item.nOrderType, &item.enSide, &item.nStatus, &item.strStockCode, &item.strStockName, &item.nPrice, &item.nQty, &item.nDealtQty, &item.nDealtAvgPrice,&item.nSubmitedTime, &item.nUpdatedTime, &item.nErrCode }; CHECK_OP(_countof(arOptional) == _countof(arFieldType), NOOP); CHECK_OP(_countof(arOptional) == _countof(arFieldKey), NOOP); CHECK_OP(_countof(arOptional) == _countof(arPtr), NOOP); vtField.clear(); PROTO_FIELD field; for ( int n = 0; n < _countof(arOptional); n++ ) { field.bOptional = arOptional[n]; field.eFieldType = arFieldType[n]; field.strFieldKey = arFieldKey[n]; switch (field.eFieldType) { case ProtoFild_Int32: field.pInt32 = (int*)arPtr[n]; break; case ProtoFild_Int64: field.pInt64 = (INT64*)arPtr[n]; break; case ProtoFild_StringA: field.pStrA = (std::string*)arPtr[n]; break; case ProtoFild_StringW: field.pStrW = (std::wstring*)arPtr[n]; break; default: CHECK_OP(FALSE, NOOP); break; } vtField.push_back(field); } }
//tomodify 8 void CProtoOrderUpdatePush::GetProtoBodyField_Ack(VT_PROTO_FIELD &vtField, const ProtoAckBodyType &ackData) { static BOOL arOptional[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, }; static EProtoFildType arFieldType[] = { ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_StringA, ProtoFild_Int32, ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_StringA, }; static LPCSTR arFieldKey[] = { "LocalID", "OrderID", "OrderSide", "OrderTypeHK", "OrderStatusHK","StockName", "Price", "Qty", "DealtQty", "SubmitTime", "UpdateTime", "StockCode", }; ProtoAckBodyType &body = const_cast<ProtoAckBodyType &>(ackData); void *arPtr[] = { &body.nLocalID, &body.nOrderID, &body.nOrderDir, &body.nOrderTypeHK, &body.nOrderStatusHK, &body.strStockName, &body.nPrice, &body.nQTY, &body.nDealQTY, &body.nSubmitTime, &body.nUpdateTime, &body.strStockCode, }; CHECK_OP(_countof(arOptional) == _countof(arFieldType), NOOP); CHECK_OP(_countof(arOptional) == _countof(arFieldKey), NOOP); CHECK_OP(_countof(arOptional) == _countof(arPtr), NOOP); vtField.clear(); PROTO_FIELD field; for ( int n = 0; n < _countof(arOptional); n++ ) { field.bOptional = arOptional[n]; field.eFieldType = arFieldType[n]; field.strFieldKey = arFieldKey[n]; switch (field.eFieldType) { case ProtoFild_Int32: field.pInt32 = (int*)arPtr[n]; break; case ProtoFild_Int64: field.pInt64 = (INT64*)arPtr[n]; break; case ProtoFild_StringA: field.pStrA = (std::string*)arPtr[n]; break; case ProtoFild_StringW: field.pStrW = (std::wstring*)arPtr[n]; break; default: CHECK_OP(FALSE, NOOP); break; } vtField.push_back(field); } }
//tomodify 8 void CProtoBasicPrice::GetProtoBodyField_Ack(VT_PROTO_FIELD &vtField, const ProtoAckBodyType &ackData) { static BOOL arOptional[] = { FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, }; static EProtoFildType arFieldType[] = { ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int64, ProtoFild_Int64, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_Int32, ProtoFild_StringA, ProtoFild_Int32 }; static LPCSTR arFieldKey[] = { "High", "Open", "Low", "Close", "Vol", "Turnover", "LastClose","Cur", "Market", "StockCode", "Time" }; ProtoAckBodyType &body = const_cast<ProtoAckBodyType &>(ackData); void *arPtr[] = { &body.nHigh, &body.nOpen, &body.nLow, &body.nClose, &body.nVolume, &body.nTurnover, &body.nLastClose,&body.nCur, &body.nStockMarket, &body.strStockCode, &body.dwTime }; CHECK_OP(_countof(arOptional) == _countof(arFieldType), NOOP); CHECK_OP(_countof(arOptional) == _countof(arFieldKey), NOOP); CHECK_OP(_countof(arOptional) == _countof(arPtr), NOOP); vtField.clear(); PROTO_FIELD field; for ( int n = 0; n < _countof(arOptional); n++ ) { field.bOptional = arOptional[n]; field.eFieldType = arFieldType[n]; field.strFieldKey = arFieldKey[n]; switch (field.eFieldType) { case ProtoFild_Int32: field.pInt32 = (int*)arPtr[n]; break; case ProtoFild_Int64: field.pInt64 = (INT64*)arPtr[n]; break; case ProtoFild_StringA: field.pStrA = (std::string*)arPtr[n]; break; case ProtoFild_StringW: field.pStrW = (std::wstring*)arPtr[n]; break; default: CHECK_OP(FALSE, NOOP); break; } vtField.push_back(field); } }