当前位置: 首页>>代码示例>>C++>>正文


C++ EventData::getEventType方法代码示例

本文整理汇总了C++中EventData::getEventType方法的典型用法代码示例。如果您正苦于以下问题:C++ EventData::getEventType方法的具体用法?C++ EventData::getEventType怎么用?C++ EventData::getEventType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EventData的用法示例。


在下文中一共展示了EventData::getEventType方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handleEvent

	bool MainMenuState::handleEvent( const EventData& theevent )
	{
		if(theevent.getEventType() == Event_NewGame)
		{
			Game::getInstance()->setNextStateType(State_Loading);
			m_endState = true;
		}

		if(theevent.getEventType() == Event_Credits)
		{
			Game::getInstance()->setNextStateType(State_Credits);
			m_endState = true;
		}

		return false;
	}
开发者ID:agiantwhale,项目名称:moon.chase.star,代码行数:16,代码来源:MainMenuState.cpp

示例2: handleEventId

void Enemy::handleEventId(EventData const &eventMessage)
{
	if(EvtData_To_EnemyUpdateHp::mEventType == eventMessage.getEventType())
	{
		const EvtData_To_EnemyUpdateHp& evtData = static_cast<const EvtData_To_EnemyUpdateHp&>(eventMessage);
		mHealthPoints -= evtData.mDamage;
	}
	else
		Actor::handleEventId(eventMessage);
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:10,代码来源:Enemy.cpp

示例3: addLap

void DriverData::addLap(const EventData &ed)
{
    if (ed.getEventType() == LTPackets::RACE_EVENT)
    {
        addRaceLap(ed);
    }
    else
    {
        addFPQLap(ed);
    }
}
开发者ID:primijos,项目名称:f1lt,代码行数:11,代码来源:driverdata.cpp

示例4: handleEvent

bool Statistics::handleEvent(const EventData &event)
{
	if (EvtData_From_DriverDeath::mEventType == event.getEventType())
	{
	}
	else if (EvtData_From_ActorDestroyed::mEventType == event.getEventType())
	{
		const EvtData_From_ActorDestroyed& evtData = static_cast<const EvtData_From_ActorDestroyed&>(event);
		Actor::ActorType type = ActorHandler::getInstance()->getActor(evtData.mId)->getActorType();
		if (type == Actor::ActorType_Enemy)
		{
			mScore += 100;
		}
		else if (type == Actor::ActorType_Tank)
		{
			mScore -= 500;
		}
	}
	else if (EvtData_System_EndGame::mEventType == event.getEventType())
	{
		calculateAccuracy();
		if(mpOutFile)
		{
			fprintf_s(mpOutFile, "Total Score: %i \n", mScore);
			fprintf_s(mpOutFile, "Total Shots Fired: %f \n Total Hits: %f \n Total Misses: %f \n Accuracy: %f",
				mTimesFired, mHits, mMisses, mAccuracy);
		}

	}
	else if (EvtData_From_EnemyHit::mEventType == event.getEventType())
	{
		mHits++;
	}
	else if (EvtData_From_WeaponFired::mEventType == event.getEventType())
	{
		mTimesFired++;
	}

	return false;
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:40,代码来源:Statistics.cpp

示例5: updatePitStatus

void DriverData::updatePitStatus(LTPackets::Colors pitColor, EventData &ed)
{
    if (pitColor == LTPackets::PIT)
    {
        bool prev = inPits;
        inPits = true;
        if (prev == false && ed.getEventType() != LTPackets::RACE_EVENT)
            addInLap(ed);
    }


    else
    {
        //if driver went out from pit, he is on his outlap
        if (inPits == true)
            outLap = true;

        inPits = false;
    }
}
开发者ID:primijos,项目名称:f1lt,代码行数:20,代码来源:driverdata.cpp

示例6: addInLap

void DriverData::addInLap(const EventData &ed)
{
    if (lastLap.lapNum <= 0)
        return;

    lapData.append(lastLap);

    if (outLap == true)
        lapData.last().lapTime = LapTime("INST. LAP");
    else
        lapData.last().lapTime = LapTime("IN LAP");

    lapData.last().qualiLapExtraData.sessionTime = ed.getRemainingTime();
    lapData.last().practiceLapExtraData.sessionTime = ed.getRemainingTime();

    if (ed.getEventType() == LTPackets::QUALI_EVENT)
    {
        int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
        lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
        lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;
    }
    updateSectorRecords();
}
开发者ID:primijos,项目名称:f1lt,代码行数:23,代码来源:driverdata.cpp

示例7: handleEvent

bool EventSnooper::handleEvent(EventData const &eventData)
{

#ifdef _DEBUG
	if (mOutFile)
	{
		fprintf_s(mOutFile, "Event Snoop: Event %p Time: %f Type: %s \n", &eventData, eventData.getTimeStamp(), eventData.getEventType().getStr().c_str());
	}

	DEBUG_MESSAGE("Event Snoop: Event " << &eventData << " Time: " << eventData.getTimeStamp() <<  " type: " << eventData.getEventType().getStr());
#endif

	return false;
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:14,代码来源:snooper.cpp

示例8: handleEventId

void Munitions::handleEventId(EventData const &eventMessage)
{
	if(EvtData_From_ActorCollisionObject::msEventType == eventMessage.getEventType())
	{
		const EvtData_From_ActorCollisionObject& evtData = static_cast<const EvtData_From_ActorCollisionObject&>(eventMessage);
		Munitions *pMunition = dynamic_cast<Munitions*>(ActorHandler::getInstance()->getActor(evtData.mFirstActorId));
		Actor *pSecondActor = ActorHandler::getInstance()->getActor(evtData.mSecondActorId);
		Actor::ActorTypes secondActorType = pSecondActor->getActorType();
		Actor::ActorTypes munitionOwnerType = pMunition->getOwnerType();

		//if a enemy collides with a munition
		if(secondActorType == Actor::ActorType_Enemy)
		{
			Enemy* pEnemy = dynamic_cast<Enemy*>(pSecondActor);			
			if((munitionOwnerType == Actor::ActorType_Tank || munitionOwnerType == Actor::ActorType_Driver) && pEnemy->getHealthPoints() > 0)
			{
				if(pEnemy->getKey().isOwner())
				{
					pEnemy->reduceHp(Weapon::calculateDamage(pMunition->getEfficiency(),pEnemy->getEnemySize(),pMunition->getDamage()), eventMessage.getNetworkId(), pMunition->getOwner());
				}
				else
				{
					safeThreadSafeQueueEvent(EventDataPtr(myNew EvtData_To_ActorReduceHp(pEnemy->getKey(), Weapon::calculateDamage(pMunition->getEfficiency(),pEnemy->getEnemySize(),pMunition->getDamage()), pMunition->getOwner())));
				}
			}
		}

		//if a tank collides with a munition
		else if(secondActorType == Actor::ActorType_Tank)
		{
			Tank*  pTank = dynamic_cast<Tank*>(pSecondActor);
			if(munitionOwnerType == Actor::ActorType_Enemy)
			{
				if(pTank->getKey().isOwner())
				{
					pTank->reduceHp(pMunition->getDamage());
				}
				else
				{
					safeThreadSafeQueueEvent(EventDataPtr(myNew EvtData_To_ActorReduceHp(pTank->getKey(), pMunition->getDamage(), pMunition->getOwner())));
				}
			}
		}

		//if a driver collides with a munition
		else if(secondActorType == Actor::ActorType_Driver)
		{
			Driver*  pDriver = dynamic_cast<Driver*>(pSecondActor);
			if(munitionOwnerType == Actor::ActorType_Enemy)
			{
				if(pDriver->getKey().isOwner())
				{
					pDriver->reduceHp(pMunition->getDamage());
				}
				else
				{
					safeThreadSafeQueueEvent(EventDataPtr(myNew EvtData_To_ActorReduceHp(pDriver->getKey(), pMunition->getDamage(), pMunition->getOwner())));
				}
			}
		}
	}
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:62,代码来源:Munitions.cpp

示例9: addFPQLap

void DriverData::addFPQLap(const EventData &ed)
{
    //during practice and quali we only save timed laps
    if ((lastLap.lapTime.toString() != "") && (lapData.empty() ||
            (/*(lastLap.numLap > lapData.last().numLap) &&*/ lastLap.getSectorTime(1).toString() != "" && lastLap.getSectorTime(2).toString() != "" && lastLap.getSectorTime(3).toString() != "")))
    {
        bool correction = false;
        //sometimes servers messes up with lap numbers, we catch this if the numlap is <= than the last one
        if (!lapData.isEmpty() && lastLap.lapNum+1 <= lapData.last().lapNum)
        {
            correction = true;
            bool approx = lapData.last().qualiLapExtraData.approxLap || lapData.last().practiceLapExtraData.approxLap;
            int numlap = lapData.last().lapNum-1;
            lapData.last() = LapData(lastLap);
            lapData.last().qualiLapExtraData.approxLap = approx;
            lapData.last().practiceLapExtraData.approxLap = approx;

            if (lapData.size() > 1)
                lapData.last().lapNum = numlap;


            if (sessionRecords.bestLap.lapNum == numlap)
                sessionRecords.bestLap.lapNum = lapData.last().lapNum;
        }
        else
        {

            //if decryption fails, replace the garbage we obtained with the best lap time
            if (lastLap.lapTime.toString() != "" && !lastLap.lapTime.isValid())
                lastLap.lapTime = sessionRecords.bestLap.lapTime;

            lastLap.qualiLapExtraData.sessionTime = ed.getRemainingTime();
            lastLap.practiceLapExtraData.sessionTime = ed.getRemainingTime();
            lapData.append(lastLap);
            lapData.last().lapNum--;

            if (ed.getEventType() == LTPackets::QUALI_EVENT)
            {
                int qPeriod = ed.getQualiPeriod() > 0 ? ed.getQualiPeriod() : 1;
                lastLap.qualiLapExtraData.qualiPeriod = qPeriod;
                lapData.last().qualiLapExtraData.qualiPeriod = qPeriod;

            }

            updateSectorRecords();
        }

        if (!correction)
        {
            if (ed.getEventType() == LTPackets::PRACTICE_EVENT)
            {
                if (lastLap < sessionRecords.bestLap)
                    sessionRecords.bestLap = lapData.last();

                else if (lastLap.lapTime == sessionRecords.bestLap.lapTime)
                {
                    lapData.last().lapTime = LapData::sumSectors(lapData.last().getSectorTime(1).toString(), lapData.last().getSectorTime(2).toString(), lapData.last().getSectorTime(3).toString());
                    lapData.last().practiceLapExtraData.approxLap = true;
                }
                else
                    lapData.last().practiceLapExtraData.approxLap = false;

            }
            else if (ed.getEventType() == LTPackets::QUALI_EVENT)
            {
                if (lastLap < sessionRecords.bestLap)
                    sessionRecords.bestLap = lapData.last();

                if (lastLap < sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] ||
                        !sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1].getTime().isValid())
                {
                    sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] = lapData.last();

                    if (sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1] < sessionRecords.bestLap)
                        sessionRecords.bestLap = sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1];
                }
                //if the current lap time is the same as the best lap, probably the driver hasn't improved so we have to calculate the real lap time from the sectors time
                else if (lastLap.lapTime == sessionRecords.bestQLaps[lastLap.qualiLapExtraData.qualiPeriod-1].lapTime)
                {
                    lapData.last().lapTime = LapData::sumSectors(lapData.last().getSectorTime(1).toString(), lapData.last().getSectorTime(2).toString(), lapData.last().getSectorTime(3).toString());
                    lapData.last().qualiLapExtraData.approxLap = true;
                }
                else
                    lapData.last().qualiLapExtraData.approxLap = false;

                correctPosition(ed);
            }

        }
        lapData.last().gap = QString::number((lapData.last().lapTime - ed.getSessionRecords().getFastestLap().getTime()).toDouble());

        posHistory.append(lastLap.pos);
        outLap = false;
    }

    //saving in and out laps
    else if (lastLap.lapNum > 1)
    {
        if (lapData.isEmpty() || (!lapData.isEmpty() && lapData.last().lapNum < lastLap.lapNum-1))
        {
//.........这里部分代码省略.........
开发者ID:primijos,项目名称:f1lt,代码行数:101,代码来源:driverdata.cpp

示例10: updateTrigger

void TriggerBase::updateTrigger(EventData const &eventData)
{
	//Skip the requirement logic if the trigger already is ready.
	if(!mFlagReady)
	{
		switch(mRequirement)
		{
			case TriggerBase::TriggerRequirements_TimeSinceMapStart:
				break;

			case TriggerBase::TriggerRequirements_TimeSinceProgramStart:
				break;

			case TriggerBase::TriggerRequirements_ObjectCreated:
				if(eventData.getEventType() == EvtData_From_ActorCreated::msEventType)
				{
					const EvtData_From_ActorCreated &castEvent = (const EvtData_From_ActorCreated &)eventData;
					switch(mSubRequirement)
					{
						case TriggerBase::TriggerSubRequirements_ObjectID:
							if(castEvent.mId == mSubValue)
							{
								mFlagReady = true;
							}
							break;

						default:
							break;
					}
				}
				break;

			case TriggerBase::TriggerRequirements_ObjectDestroyed:
				if(eventData.getEventType() == EvtData_From_ActorDestroyed::msEventType)
				{
					const EvtData_From_ActorDestroyed &castEvent = (const EvtData_From_ActorDestroyed &)eventData;
					switch(mSubRequirement)
					{
						case TriggerBase::TriggerSubRequirements_ObjectID:
							if(castEvent.mId == mSubValue)
							{
								mFlagReady = true;
							}
							break;

						default:
							break;
					}
				}
				break;

			case TriggerBase::TriggerRequirements_EnteredSourceBV:
				if(eventData.getEventType() == EvtData_To_TriggerCollision::msEventType)
				{
					const EvtData_To_TriggerCollision &castEvent = (const EvtData_To_TriggerCollision &)eventData;
					//Check if the bounding volume provided by the event corresponds with the trigger's.
					if(castEvent.mpBoundingVolume == mpSourceBV->getBoundingVolume())
					{
						mFlagReady = true;
					}
				}
				break;

			case TriggerBase::TriggerRequirements_ExitedSourceBV:
				break;

			case TriggerBase::TriggerRequirements_EnteredDestinationBV:
				break;

			case TriggerBase::TriggerRequirements_ExitedDestinationBV:
				break;

			default:
				break;
		}
	}

	//Activate the trigger if it is ready (requirements met)
	//and not waiting for any child dependencies.
	if(mFlagReady && !mFlagWaiting)
	{
		activate();
	}
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:84,代码来源:TriggerBase.cpp

示例11: handleEvent

bool TriggerHandler::handleEvent(EventData const &mEvent)
{
	bool dispatchToTriggers = true;
	if(mEvent.getEventType() == EvtData_To_TriggerCreate::msEventType)
	{
		const EvtData_To_TriggerCreate &translatedEvent = (const EvtData_To_TriggerCreate &)mEvent;

		TriggerData data;
		data.mType = translatedEvent.mTriggerType;
		data.mRequirement = translatedEvent.mTriggerRequirement;
		data.mSubRequirement = translatedEvent.mTriggerSubRequirement;
		data.mValue = translatedEvent.mTriggerValue;
		data.mSubValue = translatedEvent.mTriggerSubValue;
		data.mMisc = translatedEvent.mMisc;
		data.mSourcePosition = translatedEvent.mSourcePosition;
		data.mSourceRotation = translatedEvent.mSourceRotation;
		data.mSourceScale = translatedEvent.mSourceScale;
		data.mDestinationPosition = translatedEvent.mDestinationPosition;
		data.mDestinationRotation = translatedEvent.mDestinationRotation;
		data.mDestinationScale = translatedEvent.mDestinationScale;
		data.mShow = translatedEvent.mShow;

		mCreateTriggerStack.push(data);
		dispatchToTriggers = false;
	}
	else if(mEvent.getEventType() == EvtData_To_TriggerRemove::msEventType)
	{
		const EvtData_To_TriggerRemove &translatedEvent = (const EvtData_To_TriggerRemove &)mEvent;
		removeActiveTrigger(translatedEvent.mTriggerID);
		removeCompletedTrigger(translatedEvent.mTriggerID);
		dispatchToTriggers = false;
	}
	else if(mEvent.getEventType() == EvtData_To_TriggerRemoveAll::msEventType)
	{
		removeAllTriggers();
		dispatchToTriggers = false;
	}
	else if(mEvent.getEventType() == EvtData_To_TriggerActivate::msEventType)
	{
		const EvtData_To_TriggerActivate &translatedEvent = (const EvtData_To_TriggerActivate &)mEvent;
		forceTriggerActivation(translatedEvent.mTriggerID);
		dispatchToTriggers = false;
	}
	else if(mEvent.getEventType() == EvtData_To_TriggerComplete::msEventType)
	{
		const EvtData_To_TriggerComplete &translatedEvent = (const EvtData_To_TriggerComplete &)mEvent;
		forceTriggerCompletion(translatedEvent.mTriggerID);
		dispatchToTriggers = false;
	}
	else if(mEvent.getEventType() == EvtData_To_TriggerShow::msEventType)
	{
		showAllTriggers();
		dispatchToTriggers = false;
	}
	else if(mEvent.getEventType() == EvtData_To_TriggerHide::msEventType)
	{
		hideAllTriggers();
		dispatchToTriggers = false;
	}

	if(dispatchToTriggers)
	{
		mTransferList.clear();
		//Go through the active list and let the triggers handle the events.
		for(vector<TriggerBase *>::iterator listIter = mActiveList.begin();
			listIter != mActiveList.end(); ++listIter)
		{
			(*listIter)->handleEvent(mEvent);
			//Add any activated triggers to the transfer list (ignore children).
			if(!(*listIter)->isActive() && !(*listIter)->isChild())
			{
				mTransferList.push_back((*listIter));
			}
		}

		//Go through the transfer list and move the triggers together with their children.
		for(vector<TriggerBase *>::iterator listIter = mTransferList.begin();
			listIter != mTransferList.end(); ++listIter)
		{
			completeTriggerAndChildren((*listIter));
		}
	}
	return false;
}
开发者ID:GustavPersson,项目名称:miniature-dubstep,代码行数:84,代码来源:TriggerHandler.cpp

示例12: convertXmlParameterToEvent

	void convertXmlParameterToEvent(EventData &eventdata, XmlParameter const &xmlparameter)
	{
		eventdata.clear();
		
		EventData::DType dtype = (EventData::DType)xmlparameter.getParameter("dtype").getAsInt();
		EventData::EType etype = (EventData::EType)xmlparameter.getParameter("etype").getAsInt();

				
		eventdata.getEventType() = etype;
		eventdata.setType(dtype);

		double miliss = xmlparameter.getParameter("etime").getAsDate();
		if (miliss > 0)
			eventdata.setEventDate( miliss/ 1000.0 );
		else
			eventdata.setEventDate(-1);


		eventdata.eventSource_m = xmlparameter.getParameter("source").getAsString();
		eventdata.parentUid_m = xmlparameter.getParameter("puid").getAsUid();
		eventdata.uid_m = xmlparameter.getParameter("uid").getAsUid();

		if (dtype==EventData::DT_Log) {
		
			XmlParameter const& logParam = xmlparameter.getXmlParameter("log");
			CommonLog& log = eventdata.getAsLog(true);

			double miliss = logParam.getParameter("time").getAsDate();
			if (miliss > 0)
				log.logDate_m = miliss / 1000.0;
			else
				log.logDate_m = -1;

			log.logLevel_m  = logParam.getParameter("level").getAsInt();
			log.context_m = logParam.getParameter("context").getAsString();
			log.content_m = logParam.getParameter("content").getAsString();
			log.session_m = logParam.getParameter("session").getAsString();
			log.logThread_m = logParam.getParameter("thread").getAsInt();

						

		}
		else if (dtype==EventData::DT_CommonXml) {
			eventdata.getAsXmlParameter(true) = xmlparameter.getXmlParameter("commonxml");
		}
		else if (dtype==EventData::DT_String) {
			eventdata.getAsString(true) = xmlparameter.getParameter("str").getAsString();
		}
		else if (dtype==EventData::DT_StringList) {
			eventdata.getAsStringList(true) = xmlparameter.getParameter("strlist").getAsStringList();
		}
		else if (dtype==EventData::DT_StringMap) {
			
			CppUtils::StringMap& strmap = eventdata.getAsStringMap(true);

			XmlParameter const& strMapParam = xmlparameter.getXmlParameter("strmap");
			CppUtils::StringList keys;
			strMapParam.getValueKeys(keys);
			for(int i = 0; i < keys.size(); i++) {
				strmap[ keys[ i ] ] = strMapParam.getParameter(keys[ i ]).getAsString();
			}
			
		}
		else if (dtype==EventData::DT_Ticker) {
			convertFromXmlParameter( eventdata.getAsRtData(), xmlparameter.getXmlParameter("ticker"));
		}
		else if (eventdata.getType()==EventData::DT_TickerList) {
			
			RtDataList& rtlist = eventdata.getAsRtDataList(true);

			XmlParameter::XmlParameterList const& tickerMapParamList = xmlparameter.getXmlParameterList("tickerlist");
			RtData rtdata;

			for(int i = 0; i < tickerMapParamList.size(); i++) {
				convertFromXmlParameter( rtdata, tickerMapParamList[ i ]);
				rtlist.push_back(rtdata);
			}

		}
		else if (dtype==EventData::DT_Level2Data) {
			//convertLevel2FromXmlParameter( eventdata.getAsLevel2Data(), xmlparameter.getXmlParameter("level2data"));
			HTASSERT(false);
		}
		else if (dtype==EventData::DT_Level1Data) {
			convertLevel1FromXmlParameter( eventdata.getAsLevel1Data(), xmlparameter.getXmlParameter("level1data"));
		}
		else if (dtype==EventData::DT_DrawableObject) {
			convertDrawableObjFromXmlParameter( eventdata.getAsDrawableObject(), xmlparameter.getXmlParameter("drawobj"));
		}
		else {
			HTASSERT(false);
		}


	}
开发者ID:vit2000005,项目名称:happy_trader,代码行数:95,代码来源:xmleventdata.cpp

示例13: convertEventToXmlParameter

	// conversion functions
	void convertEventToXmlParameter(EventData const& eventdata, XmlParameter &xmlparameter)
	{
		xmlparameter.clear();
		xmlparameter.getName() = "event_packet";

		xmlparameter.getParameter("source").getAsString(true) = eventdata.getSource();
		xmlparameter.getParameter("puid").getAsUid(true) = eventdata.getParentEventUid();
		xmlparameter.getParameter("uid").getAsUid(true) = eventdata.getEventUid();
		xmlparameter.getParameter("etype").getAsInt(true) = eventdata.getEventType();
		xmlparameter.getParameter("dtype").getAsInt(true) = eventdata.getType();
		
		double sec = eventdata.getEventDate();
		if (sec <= 0)
			xmlparameter.getParameter("etime").getAsDate(true)  =-1;
		else
			xmlparameter.getParameter("etime").getAsDate(true) = sec * 1000.0;

		if (eventdata.getType()==EventData::DT_Log) {
			XmlParameter logParam;
			CommonLog const& log = eventdata.getAsLog();
			double sec = log.logDate_m;

			if (sec <= 0)
				logParam.getParameter("time").getAsDate(true) = -1;
			else	
				logParam.getParameter("time").getAsDate(true) = sec * 1000.0;
			
			logParam.getParameter("level").getAsInt(true) = log.logLevel_m;
			logParam.getParameter("context").getAsString(true) = log.context_m;
			logParam.getParameter("content").getAsString(true) = CppUtils::wrapToCDataTags(log.content_m);
			logParam.getParameter("session").getAsString(true) = log.session_m;
			logParam.getParameter("thread").getAsInt(true) = log.logThread_m;
			
		
			xmlparameter.getXmlParameter("log") = logParam;
		}
		else if (eventdata.getType()==EventData::DT_CommonXml) {
			xmlparameter.getXmlParameter("commonxml") = eventdata.getAsXmlParameter();
		}
		else if (eventdata.getType()==EventData::DT_String) {
			xmlparameter.getParameter("str").getAsString(true) = eventdata.getAsString();

		}
		else if (eventdata.getType()==EventData::DT_StringList) {
			xmlparameter.getParameter("strlist").getAsStringList(true) = eventdata.getAsStringList();
		}
		else if (eventdata.getType()==EventData::DT_StringMap) {
			XmlParameter strMapParam;
			
			CppUtils::StringMap const& strmap = eventdata.getAsStringMap();
			for(CppUtils::StringMap::const_iterator it = strmap.begin(); it != strmap.end(); it++) {
				strMapParam.getParameter(it->first).getAsString(true) = it->second;
			}

			xmlparameter.getXmlParameter("strmap") = strMapParam;
		}
		else if (eventdata.getType()==EventData::DT_Ticker) {
			convertToXmlParameter(eventdata.getAsRtData(), xmlparameter.getXmlParameter("ticker"));
		}
		else if (eventdata.getType()==EventData::DT_TickerList) {
			XmlParameter tickerParam;
			RtDataList const& rtlist = eventdata.getAsRtDataList();
			for(int i = 0; i < rtlist.size(); i++) {
				convertToXmlParameter(rtlist[ i ], tickerParam);
				xmlparameter.getXmlParameterList("tickerlist").push_back(tickerParam);
			}

		}
		else if (eventdata.getType()==EventData::DT_Dummy) {
			// no-op
		}
		else if (eventdata.getType()==EventData::DT_Level2Data) {
			//convertLevel2ToXmlParameter(eventdata.getAsLevel2Data(), xmlparameter.getXmlParameter("level2data"));
			HTASSERT(false);
		}
		else if (eventdata.getType()==EventData::DT_Level1Data) {
			convertLevel1ToXmlParameter(eventdata.getAsLevel1Data(), xmlparameter.getXmlParameter("level1data"));
		}
		else if (eventdata.getType()==EventData::DT_DrawableObject) {
			convertDrawableObjToXmlParameter(eventdata.getAsDrawableObject(), xmlparameter.getXmlParameter("drawobj"));
		}
		else {
			// dummy
			HTASSERT(false);
		}

	}
开发者ID:vit2000005,项目名称:happy_trader,代码行数:88,代码来源:xmleventdata.cpp


注:本文中的EventData::getEventType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。