ParamFlow.cc 1 KB
/*
 * ParamFlow.cc
 *
 *  Created on: Nov 25, 2014
 *      Author: AKKA
 */

#include "VirtualInstrumentInterval.hh"
#include "ParamFlow.hh"

namespace AMDA {

namespace LocalFileInterface {

ParamFlow::ParamFlow(VirtualInstrumentInterval& pVI) :
		_vi(pVI)
{
}

ParamFlow::~ParamFlow()
{
}

LocalParamDataPacket* ParamFlow::get(std::string pParamId)
{
	//try to find param
	auto lIt = _paramInfoMap.find(pParamId);
	if (lIt == _paramInfoMap.end())
		return NULL;
	if (_paramInfoMap[pParamId] == nullptr)
		return NULL;
	if(_paramInfoMap[pParamId]->getPacketList().empty()) {
		_vi.getAsync().get();
	}
	return _paramInfoMap[pParamId]->getPacketList().pop();
}

bool ParamFlow::isTimeIntToProcessChanged(std::string pParamId) {
	return _vi.isTimeIntToProcessChanged() && _paramInfoMap[pParamId]->getPacketList().empty();
}

bool ParamFlow::isNoMoreTimeInt(std::string pParamId) {
	return _vi.isNoMoreTimeInt() && _paramInfoMap[pParamId]->getPacketList().empty();
}

} /* namespace LocalParamDataPacket */
} /* namespace AMDA */