本文整理汇总了C++中ACE_InputCDR::pre_read方法的典型用法代码示例。如果您正苦于以下问题:C++ ACE_InputCDR::pre_read方法的具体用法?C++ ACE_InputCDR::pre_read怎么用?C++ ACE_InputCDR::pre_read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACE_InputCDR
的用法示例。
在下文中一共展示了ACE_InputCDR::pre_read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
CmResult COFP13TableFeatureProp::DecodeMPTFP(ACE_InputCDR &is, COFP13TableFeatureProp * &prop)
{
ACE_UINT16 type;
bool bGood = is.pre_read(&type, sizeof(type));
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
ACE_CDR::swap_2(reinterpret_cast<const char *>(&type), reinterpret_cast<char *>(&type));
COFP13TableFeatureProp *propData = nullptr;
ACE_DEBUG((LM_DEBUG, ACE_TEXT("COFP13TableFeatureProp::DecodeMPTFP, type=%u\n"), type));
switch (type)
{
case OFPTFPT_INSTRUCTIONS:
case OFPTFPT_INSTRUCTIONS_MISS:
{
propData = new COFP13TableFeaturePropInstruct(type);
break;
}
case OFPTFPT_EXPERIMENTER:
case OFPTFPT_EXPERIMENTER_MISS:
{
propData = new COFP13TableFeaturePropExperimenter(type);
break;
}
case OFPTFPT_NEXT_TABLES:
case OFPTFPT_NEXT_TABLES_MISS:
{
propData = new COFP13TableFeaturePropNextTables(type);
}
case OFPTFPT_WRITE_ACTIONS:
case OFPTFPT_WRITE_ACTIONS_MISS:
case OFPTFPT_APPLY_ACTIONS:
case OFPTFPT_APPLY_ACTIONS_MISS:
{
propData = new COFP13TableFeaturePropActions(type);
}
case OFPTFPT_MATCH:
case OFPTFPT_WILDCARDS:
case OFPTFPT_WRITE_SETFIELD:
case OFPTFPT_WRITE_SETFIELD_MISS:
case OFPTFPT_APPLY_SETFIELD:
case OFPTFPT_APPLY_SETFIELD_MISS:
{
propData = new COFP13TableFeaturePropOXM(type);
}
default:
{
break;
}
}
CM_ASSERT_RETURN(propData != nullptr, CM_ERROR_OUT_OF_MEMORY);
CmResult rv = propData->StreamFrom(is);
if (CM_FAILED(rv))
{
ACE_ERROR((LM_ERROR, ACE_TEXT("COFP13TableFeatureProp::DecodeMPTFP error\n")));
return CM_ERROR_FAILURE;
}
prop = propData;
return CM_OK;
}
示例2: sizeof
CmResult COFP10Action::
DecodeAction(ACE_InputCDR& is, COFP10Action * &apAction)
{
CmResult lRet = CM_ERROR_FAILURE;
ACE_UINT16 wType = 0;
COFP10Action *pAct = nullptr;
bool bGood = is.pre_read(&wType, sizeof(wType));
CM_ASSERT_RETURN(bGood, CM_ERROR_FAILURE);
ACE_CDR::swap_2(reinterpret_cast<const char *>(&wType), reinterpret_cast<char *>(&wType));
switch (wType)
{
case OFPAT_OUTPUT:
{
pAct = new COFP10ActOutput();
break;
}
case OFPAT_SET_VLAN_VID:
{
pAct = new COFP10ActSetVlanVid();
break;
}
case OFPAT_SET_VLAN_PCP:
{
pAct = new COFP10ActSetVlanPcp();
break;
}
case OFPAT_STRIP_VLAN:
{
pAct = new COFP10ActStripVlan();
break;
}
case OFPAT_SET_DL_SRC:
case OFPAT_SET_DL_DST:
{
pAct = new COFP10ActSetDlAddr(wType);
break;
}
case OFPAT_SET_NW_SRC:
case OFPAT_SET_NW_DST:
{
pAct = new COFP10ActSetNwAddr(wType);
break;
}
case OFPAT_SET_NW_TOS:
{
pAct = new COFP10ActSetNwTos();
break;
}
case OFPAT_SET_TP_SRC:
case OFPAT_SET_TP_DST:
{
pAct = new COFP10ActSetTpPort(wType);
break;
}
case OFPAT_ENQUEUE:
{
pAct = new COFP10ActEnqueue();
break;
}
default:
{
break;
}
}
CM_ASSERT_RETURN(pAct != nullptr, CM_ERROR_OUT_OF_MEMORY);
lRet = pAct->StreamFrom(is);
if (CM_FAILED(lRet))
{
ACE_ERROR((LM_ERROR, ACE_TEXT("COFP10Action::DecodeAction(): fail in StreamFrom(), lRet=%d\n"), lRet));
return lRet;
}
apAction = pAct;
return CM_OK;
}