本文整理汇总了C++中NodeInfoList::push_back方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeInfoList::push_back方法的具体用法?C++ NodeInfoList::push_back怎么用?C++ NodeInfoList::push_back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeInfoList
的用法示例。
在下文中一共展示了NodeInfoList::push_back方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ProposalMembership
int PNode :: AddMember(const int iGroupIdx, const NodeInfo & oNode)
{
if (!CheckGroupID(iGroupIdx))
{
return Paxos_GroupIdxWrong;
}
SystemVSM * poSystemVSM = m_vecGroupList[iGroupIdx]->GetConfig()->GetSystemVSM();
if (poSystemVSM->GetGid() == 0)
{
return Paxos_MembershipOp_NoGid;
}
uint64_t llVersion = 0;
NodeInfoList vecNodeInfoList;
poSystemVSM->GetMembership(vecNodeInfoList, llVersion);
for (auto & oNodeInfo : vecNodeInfoList)
{
if (oNodeInfo.GetNodeID() == oNode.GetNodeID())
{
return Paxos_MembershipOp_Add_NodeExist;
}
}
vecNodeInfoList.push_back(oNode);
return ProposalMembership(poSystemVSM, iGroupIdx, vecNodeInfoList, llVersion);
}
示例2: MakeConfig
void MakeConfig(MockLogStorage * poMockLogStorage, Config *& poConfig)
{
string sIP = "127.0.0.1";
int iPort = 11111;
NodeInfo oMyNode(sIP, iPort);
NodeInfoList vecNodeInfoList;
for (int i = 0; i < 3; i++)
{
vecNodeInfoList.push_back(NodeInfo(sIP, iPort));
iPort++;
}
FollowerNodeInfoList vecFollowerNodeInfoList;
int iMyGroupIdx = 0;
int iGroupCount = 1;
poConfig = nullptr;
poConfig = new Config(poMockLogStorage, true, 0, false, oMyNode, vecNodeInfoList, vecFollowerNodeInfoList, iMyGroupIdx, iGroupCount, nullptr);
assert(poConfig != nullptr);
EXPECT_CALL(*poMockLogStorage, GetSystemVariables(_,_)).Times(1).WillOnce(Return(1));
poConfig->Init();
}
示例3: parse_ipport_list
int parse_ipport_list(const char * pcStr, NodeInfoList & vecNodeInfoList)
{
string sTmpStr;
int iStrLen = strlen(pcStr);
for (int i = 0; i < iStrLen; i++)
{
if (pcStr[i] == ',' || i == iStrLen - 1)
{
if (i == iStrLen - 1 && pcStr[i] != ',')
{
sTmpStr += pcStr[i];
}
NodeInfo oNodeInfo;
int ret = parse_ipport(sTmpStr.c_str(), oNodeInfo);
if (ret != 0)
{
return ret;
}
vecNodeInfoList.push_back(oNodeInfo);
sTmpStr = "";
}
else
{
sTmpStr += pcStr[i];
}
}
return 0;
}
示例4: if
int PNode :: ChangeMember(const int iGroupIdx, const NodeInfo & oFromNode, const NodeInfo & oToNode)
{
if (!CheckGroupID(iGroupIdx))
{
return Paxos_GroupIdxWrong;
}
SystemVSM * poSystemVSM = m_vecGroupList[iGroupIdx]->GetConfig()->GetSystemVSM();
if (poSystemVSM->GetGid() == 0)
{
return Paxos_MembershipOp_NoGid;
}
uint64_t llVersion = 0;
NodeInfoList vecNodeInfoList;
poSystemVSM->GetMembership(vecNodeInfoList, llVersion);
NodeInfoList vecAfterNodeInfoList;
bool bFromNodeExist = false;
bool bToNodeExist = false;
for (auto & oNodeInfo : vecNodeInfoList)
{
if (oNodeInfo.GetNodeID() == oFromNode.GetNodeID())
{
bFromNodeExist = true;
continue;
}
else if (oNodeInfo.GetNodeID() == oToNode.GetNodeID())
{
bToNodeExist = true;
continue;
}
vecAfterNodeInfoList.push_back(oNodeInfo);
}
if ((!bFromNodeExist) && bToNodeExist)
{
return Paxos_MembershipOp_Change_NoChange;
}
vecAfterNodeInfoList.push_back(oToNode);
return ProposalMembership(poSystemVSM, iGroupIdx, vecAfterNodeInfoList, llVersion);
}
示例5: tTmpNode
void SystemVSM :: GetMembership(NodeInfoList & vecNodeInfoList, uint64_t & llVersion)
{
//must must get version first!
llVersion = m_oSystemVariables.version();
for (int i = 0; i < m_oSystemVariables.membership_size(); i++)
{
PaxosNodeInfo oNodeInfo = m_oSystemVariables.membership(i);
NodeInfo tTmpNode(oNodeInfo.nodeid());
vecNodeInfoList.push_back(tTmpNode);
}
}