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


C++ Msg::setData方法代码示例

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


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

示例1: GetNextMsg

Msg *
MsgList::alloc(DxMessageCode code_, int32_t activityId_, void *data_,
		int32_t len_, MemBlk *blk_, MsgDataType dataType_)
{
	Msg *msg;
	SseInterfaceHeader hdr;

	lock();
	if (msgList.empty()) {
		Debug(DEBUG_MSGLIST, allocs, "allocs");
		Debug(DEBUG_MSGLIST, frees, "frees");
		unlock();
		Fatal(ERR_NMA);
	}

	msg = msgList.front();
	msgList.pop_front();

	Assert(!msg->allocated());
	msg->setAllocated();

	hdr.code = code_;
	hdr.activityId = activityId_;
	GetNssDate(hdr.timestamp);
	hdr.messageNumber = GetNextMsg();
	msg->setHeader(hdr);
	msg->setData(data_, len_, blk_, dataType_);

	++allocs;
	unlock();
	return (msg);
}
开发者ID:Abhishekpatil,项目名称:SonATA,代码行数:32,代码来源:Msg.cpp

示例2: passThruCfg


//.........这里部分代码省略.........
	int cmd = pt->getNxtCmd();
	while (cmd)
	{
		timer.sleep(3000);
		if (++counter == 10)
			Fatal(ERR_IPIV); 	// Something is wrong!

		hdr.activityId = pt->getActivityId();
		hdr.code = cmd;

		LogInfo(0, -1, "Reading standalone Config File cmd %d actId %d",
				hdr.code, hdr.activityId);

		hdr.messageNumber = lastMsg++;
		switch (hdr.code) {
			case CONFIGURE_DX:
			{
				hdr.dataLength = sizeof(DxConfiguration);
				msg = msgList->alloc();
				msg->setHeader(hdr);

					/* Allocate space for the cmd specific data */
				blk = partitionSet->alloc((size_t) hdr.dataLength);
				Assert(blk);
				if (!blk)
					Fatal(ERR_MAF);

				data = blk->getData();

				/* Initialize data.... */
				DxConfiguration *config = (DxConfiguration *)data;
				config->a2dClockrate = 104.16;

				msg->setData(data, hdr.dataLength, blk);
				break;
			}
			case SEND_DX_ACTIVITY_PARAMETERS:
			{
				hdr.dataLength = sizeof(DxActivityParameters);
				msg = msgList->alloc();
				msg->setHeader(hdr);

					/* Allocate space for the cmd specific data */
				blk = partitionSet->alloc((size_t) hdr.dataLength);
				Assert(blk);
				if (!blk)
					Fatal(ERR_MAF);

				data = blk->getData();

				/* Initialize data.... */
				DxActivityParameters *params = (DxActivityParameters *)data;
				params->activityId = hdr.activityId;
				obsLength = pt->getInt("ObsLen",cmd);;
				params->dataCollectionLength = obsLength; // seconds
					// RF Freq/MHz of IF band center
				params->ifcSkyFreq = pt->getInt("ifcSkyFreq",cmd);
				; 	// RF Freq/MHz of DX band center
				params->dxSkyFreq = pt->getInt("dxSkyFreq",cmd);
					// Number of subchannels. bins
				params->channelNumber = pt->getInt("channelNumber",cmd);
				baseLineDelay = pt->getInt("baselineDelay",cmd);
				cmdArgs->setBaselineDelay(baseLineDelay);
				int optParams = pt->getInt("operationsFlag",cmd);
					// optParams is a bitmask, where the bit numbers are
					// defined by the OperationsMask enum in
开发者ID:jonr925,项目名称:SonATA,代码行数:67,代码来源:SseSimulator.cpp

示例3: extractArgs


//.........这里部分代码省略.........
            LogWarning(ERR_NE, hdr.activityId,
                       "msg code = %d, len = %d, t = %u, last msg = %d, last len = %d, last t = %u",
                       hdr.code, len, tv.tv_sec, lastCode, lastLen, lastTime);
            Timer t;
            t.sleep(100);
        }
        else {
            lastCode = hdr.code;
            lastLen = len;
            lastTime = tv.tv_sec;
        }
        if (len) {
            MemBlk *blk = partitionSet->alloc(len);
            Assert(blk);
            if (!blk)
                Fatal(ERR_MAF);
            data = blk->getData();
            err = sse->recv(data, len);
            if (err) {
                switch (err) {
                case EAGAIN:
                case EINTR:
                case ENOTCONN:
                case ECONNRESET:
                    blk->free();
                    Assert(msgList->free(msg));
                    stopAllActivities(stopIssued);
                    continue;
                default:
                    Fatal(err);
                    break;
                }
            }
            msg->setData(data, len, blk);
        }

        // demarshall the data of the message depending on
        // the message type
        switch (hdr.code) {
        case REQUEST_INTRINSICS:
            break;
        case CONFIGURE_DX:
            (static_cast<DxConfiguration *> (data))->demarshall();
            break;

        case PERM_RFI_MASK:
        case BIRDIE_MASK:
        case RCVR_BIRDIE_MASK:
        case TEST_SIGNAL_MASK:
            demarshallFrequencyMask(data);
            break;
        case RECENT_RFI_MASK:
            demarshallRecentRFIMask(data);
            break;
        case REQUEST_DX_STATUS:
            break;
        case SEND_DX_ACTIVITY_PARAMETERS:
            (static_cast<DxActivityParameters *> (data))->demarshall();
            break;
        case DX_SCIENCE_DATA_REQUEST:
            (static_cast<DxScienceDataRequest *> (data))->demarshall();
            break;
#ifdef notdef
        case SEND_DOPPLER_PARAMETERS:
            (static_cast<DopplerParameters *> (data))->demarshall();
            break;
开发者ID:sigblips,项目名称:GiD-SonATA-old,代码行数:67,代码来源:SseInputTask.cpp


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