本文整理汇总了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);
}
示例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
示例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;