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


C++ DipData类代码示例

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


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

示例1: convert

	void convert(DipData &dipData, VariablePtr DPEValue, const CharString & tagName) const{
		DynVar * vals = (DynVar *)(DPEValue);
		if (!vals){
			throw BadTypeConversionException(BadTypeConversionException::BADTYPE);
		}

		if (vals->isA() != DYNTEXT_VAR){
			throw BadTypeConversionException(BadTypeConversionException::BADTYPE);
		}
		unsigned int size = vals->getArrayLength();
		if (size == 0){
			return;
		}
		const char ** array = new const char*[size];
		for (unsigned int i = 0; i < size; i++){
			Variable * value =  vals->getAt(i);
			array[i] = ((TextVar *)(value))->getValue();
		}
		if (tagName.len() == 0){
			dipData.insert(array, size);
		} else {
			dipData.insert(array, size, tagName); 
		}

		delete []array;
	}
开发者ID:waqarphd,项目名称:RPCDCS,代码行数:26,代码来源:PVSS_DIP_TypeMap.cpp

示例2: handleMessage

/*
Now the API manager can be reconfigured at run time. This means that DPE's
can be 
1)added
2)removed
3)changed. 
What we do NOT want to happen is that these opertions occur the when in the handler
as it will mess up the iterators and possibly the CdipDpeBridge::addValueToList operation,
so we lock this instance so that add/removes can not it can not occur whilst the handler 
is iterating though the list.
*/
void CdipSubscription::handleMessage(DipSubscription* subscription, DipData& data){
	//PVSSTRACE(TRACEIN,"CdipSubscription::handleMessage()");
	if (this->mustGetLastPubValue()){
		/**
		* clear any pending update request, since we have just received the data
		* the new mapping needed (see mustGetLastPubValueFlag).
		* this situation may occur (for example) if updating a DPE mapping configuration
		* will cause two (or more) mappings are made to an newly created subscription. The 2nd
		* mapping would cause the mustGetLastPubValueFlag to be set, whilst the creation of
		* the subscription will cause this subscription to automatically receive the last transmitted
		* publication data. If we do'nt clear the flag this subscription will request the data a second
		* time, if we don't have this mechanism subsequent mappings may not recv a value until the
		* subscribed to publication explicitly publishes a new value(s).
		*/
		this->mustGetLastPubValueFlag = false;
	}

	if (data.extractDataQuality() == DIP_QUALITY_UNINITIALIZED){
		PVSSLOG(ErrClass::PRIO_INFO, "Uninitialized DIP data received for :"<<subscription->getTopicName()<<", skipped.");
		return;
	}


	//PVSSLOG(ErrClass::PRIO_INFO, "Data received and being processed.");

	//PVSSINFO("DIP-70 Subscription data received " << (int)data.size() << " data fields from pub " << (const char *)(this->getPubName()) << " with ts " << data.extractDipTime().getAsMillis() << " quality "<< data.extractDataQuality());

	try{
		DpIdValueList *list = new DpIdValueList();
		
		//MD In case the DIP data time is older than datapoints time , 
		// then force current time and send a Warning message with the previous time and the new time.
		DipLong lastTagMappingUpdateTimestamp = 0l;
		DipLong timeInMs = 0l;
		{
			SmutexGuard guard(lock); // lock this instance whilst in this code block
			std::vector<CdipDataMapping *>::const_iterator it = tagMappings.begin();
			lastTagMappingUpdateTimestamp = ((*it)->timeSecondsPVSS)*1000L + (*it)->timeMSecPVSS;

			if (data.extractDipTime().getAsMillis() <= lastTagMappingUpdateTimestamp) {
				//Use current time instead and send warning.
				timeInMs = getCurrentTimeAsDipLong();
				PVSSINFO("Data from: "<<subscription->getTopicName()<<" has an older timestamp than PVSS, changed to current time.");

				addMappedDPEValueInformationToUpdateList(*list, data, timeInMs,data.extractDipTime().getAsMillis(), true, true);
			} else if( data.extractDipTime().getAsMillis() > getCurrentTimeAsDipLong()){
				// DIP-44 Case where the DIP value is in the future, we force it to current time but
				//  raise the User bit to indicate source time discrepancy
				timeInMs = getCurrentTimeAsDipLong();
				addMappedDPEValueInformationToUpdateList(*list, data, timeInMs, 0, true, true);
			} else {
				timeInMs = data.extractDipTime().getAsMillis();
				addMappedDPEValueInformationToUpdateList(*list, data, timeInMs, 0, true, false);
			}

			////
			// The validity check must happen AFTER the DIP data has been parsed
			// because it is only by trying to convert DIP data to DPE that we can
			// determine whether the DPE is invalid or not
			addMappedDPEValidityStatusToUpdateList(*list);
			/////
		}

		sendListOfUpdatesToPVSS(list, timeInMs);
		//PVSSINFO("Handle: List size = " << (int)list->getNumberOfItems ()<<".")
	} catch (std::runtime_error &de){
		PVSSERROR("Exception " << de.what() << 
			" thrown in handler for pub" <<
			(const char *)this->getPubName());
		int numFields;
		const char ** fields = data.getTags(numFields);
		PVSSINFO("Fields in publication are:-");
		for (int i = 0; i < numFields; i++){
			PVSSINFO(i << " " << fields[i]);
		}
	} catch (...){
		PVSSERROR("Exception thrown in handler for pub " <<
			(const char *)this->getPubName());
	}
	//PVSSTRACE(TRACEOUT,"CdipSubscription::handleMessage()");
}
开发者ID:waqarphd,项目名称:RPCDCS,代码行数:92,代码来源:CdipSubscription.cpp

示例3: handleMessage

	void handleMessage(DipSubscription *sub, DipData &message) {
		
		// Source parameters
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Irradiator/EmergencyStop") EmergencyStop =  message.extractBool("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Irradiator/Moving") Moving = message.extractBool("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Irradiator/Siren") Siren = message.extractBool("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Irradiator/SourceOFF") SourceOFF = message.extractBool("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Irradiator/SourceON") SourceON = message.extractBool("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Irradiator/Veto") Veto = message.extractBool("__DIP_DEFAULT__");

		// Attenuator parameters
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/DownStreamPos/A") AttDA = message.extractInt("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/DownStreamPos/B") AttDB = message.extractInt("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/DownStreamPos/C") AttDC = message.extractInt("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/DownStreamPos/EffectiveAttenuation") AttDEff = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/UpStreamPos/A") AttUA = message.extractInt("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/UpStreamPos/B") AttUB = message.extractInt("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/UpStreamPos/C") AttUC = message.extractInt("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Attenuators/UpStreamPos/EffectiveAttenuation") AttUEff = message.extractFloat("__DIP_DEFAULT__");
		
		// Radmon parameters
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/1/Dose") D1 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/1/Temperature") T1 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/2/Dose") D2 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/2/Temperature") T2 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/3/Dose") D3 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/3/Temperature") T3 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/4/Dose") D4 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/4/Temperature") T4 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/5/Dose") D5 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/5/Temperature") T5 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/6/Dose") D6 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/6/Temperature") T6 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/7/Dose") D7 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/7/Temperature") T7 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/8/Dose") D8 = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Radmon/8/Temperature") T8 = message.extractFloat("__DIP_DEFAULT__");

		// Environmental parameters
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Atmospheric_Pressure") P = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Temp_Inside_Bunker") TIN = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Temp_Outside_Bunker") TOUT = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Humidity_Inside_Bunker") RHIN = message.extractFloat("__DIP_DEFAULT__");
		if((string)sub->getTopicName() == "dip/GIFFppGPN/Humidity_Outside_Bunker") RHOUT = message.extractFloat("__DIP_DEFAULT__");
		
		if((string)sub->getTopicName() == "EnvSensors/203/ZONE5") {		
			P203 = message.extractFloat("P");
			T203 = message.extractFloat("T");
			RH203 = message.extractFloat("RH");
		}

		if((string)sub->getTopicName() == "EnvSensors/202/ZONE1") {		
			P202 = message.extractFloat("P");
			T202 = message.extractFloat("T");
			RH202 = message.extractFloat("RH");
		}

		if((string)sub->getTopicName() == "EnvSensors/201/ZONE2") {		
			P201 = message.extractFloat("P");
			T201 = message.extractFloat("T");
			RH201 = message.extractFloat("RH");
		}

		// Gas parameters
		if((string)sub->getTopicName() == "dip/GIFFppGPN/gas/RPC_MFC_Humidity") RPC_MFC_Humidity = message.extractFloat("H2O");

		if((string)sub->getTopicName() == "dip/GIFFppGPN/gas/IRsensor") {
			iC4H10_BINOS1 = message.extractFloat("iC4H10_BINOS1");
			iC4H10_BINOS2 = message.extractFloat("iC4H10_BINOS2");
		}

		if((string)sub->getTopicName() == "dip/GIFFppGPN/gas/RPC_MFC") {		
			C2H2F4 = message.extractFloat("C2H2F4");
			iC4H10 = message.extractFloat("iC4H10");
			mixture_with_water = message.extractFloat("mixture_with_water");
			mixture_without_water = message.extractFloat("mixture_without_water");
			SF6 = message.extractFloat("SF6");
		}

		if((string)sub->getTopicName() == "GasSensors/106/ZONE5") {		
			P106 = message.extractFloat("P");
			T106 = message.extractFloat("T");
			RH106 = message.extractFloat("RH");
		}

		if((string)sub->getTopicName() == "GasSensors/105/ZONE2") {		
			P105 = message.extractFloat("P");
			T105 = message.extractFloat("T");
			RH105 = message.extractFloat("RH");
		}

		if((string)sub->getTopicName() == "GasSensors/103/ZONE5") {		
			P103 = message.extractFloat("P");
			T103 = message.extractFloat("T");
			RH103 = message.extractFloat("RH");
		}

		if((string)sub->getTopicName() == "GasSensors/102/ZONE2") {		
			P102 = message.extractFloat("P");
			T102 = message.extractFloat("T");
//.........这里部分代码省略.........
开发者ID:jeyserma,项目名称:WebDCS,代码行数:101,代码来源:webdcsdip.cpp

示例4: handleMessage

	/**
	* handle changes to subscribed to publications
	* Simply prints the contents of the received data.
	* @param subscription - the subsciption to the publications thats changed.
	* @param message - object containing publication data
	* */
	void handleMessage(DipSubscription *subscription, DipData &message){

		cout<<"Received data from "<<subscription->getTopicName()<<endl;
		cout<<"value :"<<message.extractDouble("value")<<endl;
		}
开发者ID:skappert,项目名称:mcp,代码行数:11,代码来源:Client.cpp


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