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


C++ NodeInfo类代码示例

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


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

示例1: get_lines

// Collect bar summaries for job allocation on node
void NodeMenu::get_lines() {
    // First update summary information; calling get lines updates info
    pcluster_menu->get_lines();

    // Now get job allocation line content
    NodeInfo node = pnode_container->nodes[node_name];
    lines = node.get_job_bar_summary(32);
}
开发者ID:scwatts,项目名称:notop,代码行数:9,代码来源:interactive.cpp

示例2: main

int main(int argc,char *argv[])
{ 
    int numtasks, rank, dest, source, rc, count, tag=1, noderank;
    char inmsg, outmsg='x';
    MPI_Init(&argc,&argv);
    NodeInfo NI;
    NI.print();
    MPI_Finalize();
}
开发者ID:Poojachitral,项目名称:shoc,代码行数:9,代码来源:NodeInfo.cpp

示例3: unregister_from_master

int unregister_from_master()
{
    printf("unregister_from_master start\n");
    char hname[128];
    struct hostent *hent;
    int i;

    gethostname(hname, sizeof(hname));
    hent = gethostbyname(hname);

   // printf("hostname: %s/naddress list: ", hent->h_name);
    
    char* ipstr = inet_ntoa(*(struct in_addr*)(hent->h_addr_list[0]));
    string hostaddr(ipstr);
    
    int cLen = 0;
    struct sockaddr_in cli;
    
    cli.sin_family = AF_INET;
    cli.sin_port = htons(globalConfig.masterPort);
    cli.sin_addr.s_addr = inet_addr(globalConfig.masterAddr.c_str());
    
    const int sock = socket(AF_INET, SOCK_STREAM, 0);

    if(sock < 0)
    {
        printf("socket() failure!\n");
        return 0; 
    }
    
    if(connect(sock, (struct sockaddr*)&cli, sizeof(cli)) < 0)
    {
        printf("connect() failure!\n");
        return 0;
    }

    //send method
    cLen = w_send(sock, "4", 1);
    if((cLen < 0)||(cLen == 0))
    {
        printf("send() failure!\n");
        return 0;
    }

    //send body
    NodeInfo req;
    req.set_nodeaddr(globalConfig.localAddr);
    req.set_nodeport(globalConfig.port);

    w_send_pb(sock, &req);

    close(sock);
    printf("unregister_from_master done\n");
    return 1;
}
开发者ID:RusonWong,项目名称:wimg,代码行数:55,代码来源:main.cpp

示例4: captureOpenWriteDevice

bool captureOpenWriteDevice()
{
  XnStatus nRetVal = XN_STATUS_OK;
  NodeInfoList recordersList;
  
  nRetVal = g_Context.EnumerateProductionTrees(XN_NODE_TYPE_RECORDER, NULL, recordersList);
  START_CAPTURE_CHECK_RC(nRetVal, "Enumerate recorders");

  // take first
  NodeInfo chosen = *recordersList.Begin();
  nRetVal = g_Context.CreateProductionTree(chosen);
  START_CAPTURE_CHECK_RC(nRetVal, "Create recorder");

  g_Capture.pRecorder = new Recorder;
  nRetVal = chosen.GetInstance(*g_Capture.pRecorder);
  START_CAPTURE_CHECK_RC(nRetVal, "Get recorder instance");

  nRetVal = g_Capture.pRecorder->SetDestination(XN_RECORD_MEDIUM_FILE, g_Capture.csFileName);
  START_CAPTURE_CHECK_RC(nRetVal, "Set output file");

  if (getDevice() != NULL)
  {
	  nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getDevice(), XN_CODEC_UNCOMPRESSED);
	  START_CAPTURE_CHECK_RC(nRetVal, "add device node");
  }

  if (isDepthOn() && (g_Capture.DepthFormat != CODEC_DONT_CAPTURE))
  {
	  nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getDepthGenerator(), g_Capture.DepthFormat);
	  START_CAPTURE_CHECK_RC(nRetVal, "add depth node");
  }

  if (isImageOn() && (g_Capture.ImageFormat != CODEC_DONT_CAPTURE))
  {
	  nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getImageGenerator(), g_Capture.ImageFormat);
	  START_CAPTURE_CHECK_RC(nRetVal, "add image node");
  }

  if (isIROn() && (g_Capture.IRFormat != CODEC_DONT_CAPTURE))
  {
	  nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getIRGenerator(), g_Capture.IRFormat);
	  START_CAPTURE_CHECK_RC(nRetVal, "add IR stream");
  }

  if (isAudioOn() && (g_Capture.AudioFormat != CODEC_DONT_CAPTURE))
  {
	  nRetVal = g_Capture.pRecorder->AddNodeToRecording(*getAudioGenerator(), g_Capture.AudioFormat);
	  START_CAPTURE_CHECK_RC(nRetVal, "add Audio stream");
  }

  return true;
}
开发者ID:HomeBaseDev,项目名称:sandbox,代码行数:52,代码来源:Capture.cpp

示例5: nodeAtPoint

bool RenderFrameSet::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
                                 HitTestAction hitTestAction, bool inside)
{
    RenderBox::nodeAtPoint(info, _x, _y, _tx, _ty, hitTestAction, inside);

    inside = m_resizing || canResize(_x, _y);

    if ( inside && element() && !element()->noResize() && !info.readonly()){
        info.setInnerNode(element());
        info.setInnerNonSharedNode(element());
    }

    return inside || m_clientresizing;
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:14,代码来源:render_frames.cpp

示例6:

Stencil<T>*
MPICUDAStencilFactory<T>::BuildStencil( const OptionParser& options )
{
    // get options for base class
    T wCenter;
    T wCardinal;
    T wDiagonal;
    size_t lRows;
    size_t lCols;
    std::vector<long long> devs;
    CommonCUDAStencilFactory<T>::ExtractOptions( options,
                                                wCenter,
                                                wCardinal,
                                                wDiagonal,
                                                lRows,
                                                lCols,
                                                devs );

    size_t mpiGridRows;
    size_t mpiGridCols;
    unsigned int nItersPerHaloExchange;
    MPI2DGridProgram<T>::ExtractOptions( options,
                                        mpiGridRows,
                                        mpiGridCols,
                                        nItersPerHaloExchange );

    // determine which device to use
    // We would really prefer this to be done in main() but
    // since BuildStencil is a virtual function, we cannot change its
    // signature, and OptionParser provides no way to override an
    // option's value after it is set during parsing.
    NodeInfo ni;
    int myRankInNode = ni.nodeRank();
    // assign tasks to devices in round-robin approach
    // TODO is this really the mapping we want if the CUDA-capable
    // devices are heterogeneous?
    int chosenDevice = (myRankInNode % devs.size());

    return new MPICUDAStencil<T>( wCenter,
                                wCardinal,
                                wDiagonal,
                                lRows,
                                lCols,
                                mpiGridRows,
                                mpiGridCols,
                                nItersPerHaloExchange,
                                chosenDevice
                                );
}
开发者ID:BenjaminCoquelle,项目名称:shoc,代码行数:49,代码来源:MPICUDAStencilFactory.cpp

示例7: AddMember

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);
}
开发者ID:chaozh,项目名称:phxpaxos,代码行数:30,代码来源:pnode.cpp

示例8: ChangeMember

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);
}
开发者ID:chaozh,项目名称:phxpaxos,代码行数:46,代码来源:pnode.cpp

示例9: updateSchedules

bool Scheduler::updateSchedules(Pricing& pricing, NodeInfo& nodeInfo)
{
  if (!isMaster())
  {
    Master::schedule(&nodeInfo);
    return true;
  }

  unsigned long now = Clock::getUnixTime();
  bool changed = false;
  for (auto &schedule : nodeInfo.schedules)
  {
    // we already have a designated time or interval expired, so we can get next time
    if (schedule.repeatEvery > 0
        && ((schedule.designatedTime > schedule.startTime && schedule.designatedTime < schedule.startTime + schedule.interval)
            || schedule.startTime + schedule.interval < now))
    {
      schedule.startTime += schedule.repeatEvery * ceil(float(now - schedule.interval - schedule.startTime) / float(schedule.repeatEvery));
      changed = true;
    }

    #if DEBUG_SCHEDULER
    Serial.print("lastRun");
    Serial.println(schedule.lastRun);
    Serial.print("designatedtime");
    Serial.println(schedule.designatedTime);
    Serial.print("duration");
    Serial.println(schedule.duration);
    Serial.print("startime");
    Serial.println(schedule.startTime);
    Serial.print("now");
    Serial.println(now);
    Serial.print("startime");
    Serial.println(schedule.startTime);
    Serial.print("startime-now");
    Serial.println(long(schedule.startTime - now));
    #endif

      // It has already run or the designated time expiered
    if ((schedule.lastRun >= schedule.designatedTime || schedule.designatedTime + schedule.duration > now)
        // and we have a new plan to schedule
       && schedule.startTime > schedule.designatedTime
       // and there are only 30 minutes left to ensure we have data for the interval
       && long(schedule.startTime - now) < 1800)
    {
      if (isMaster())
        schedule.designatedTime = pricing.getBestTime(schedule);
      else
        {} //ask master for best time
      changed = true;
    }
  }

  if (changed)
    nodeInfo.save();

  return changed;
}
开发者ID:4m1g0,项目名称:IOT_tfg,代码行数:58,代码来源:Scheduler.cpp

示例10: LoadFile

void NodesDb::LoadFile(const wxString& file)
{
    NodeInfo *ni = new NodeInfo; 
    ni->Type = wxEmptyString;
    ni->Icon = 0;
    wxPathList paths;
    size_t i;
    
    for (i = 0; i < m_Paths.GetCount(); i++)
        paths.Add(m_Paths[i]);
    
    ni->Read(file, paths);
    
    // maybe we already parsed it?
    for (i = 0; i < m_Infos.GetCount(); i++)
        if (m_Infos[i].NodeClass == ni->NodeClass) return;
    
    m_Infos.Add(ni);
}
开发者ID:mentat,项目名称:YardSale,代码行数:19,代码来源:nodesdb.cpp

示例11: insertionSort

/**
  * insertionSort
  * 
  * uses a insertion sort algorithm to insert a new node
  * into a vector
  *
  */
void FileSystem::insertionSort(vector<NodeInfo*> nodes) {

    unsigned int ix = 0,
                 jx = 0;

    int nSize = 0;

    for (ix = 1; ix < nodes.size() - 1; ++ix) {

        nSize = allNodes.at(ix)->getSize();

        jx = ix - 1;
        NodeInfo* cmp = allNodes.at(jx);
        while( jx >= 0 && nSize < cmp->getSize() ) {
            
        }
    }

}
开发者ID:ruskiyos,项目名称:duplocator,代码行数:26,代码来源:FileSystem.cpp

示例12: nodeAtPoint

bool RenderInline::nodeAtPoint(NodeInfo& info, int _x, int _y, int _tx, int _ty,
                               HitTestAction hitTestAction, bool inside)
{
    // Check our kids if our HitTestAction says to.
    if (hitTestAction != HitTestSelfOnly) {
        for (RenderObject* child = lastChild(); child; child = child->previousSibling())
            if (!child->layer() && !child->isFloating() && child->nodeAtPoint(info, _x, _y, _tx, _ty))
                inside = true;
    }
    
    // Check our line boxes if we're still not inside.
    if (hitTestAction != HitTestChildrenOnly && !inside && style()->visibility() != HIDDEN) {
        // See if we're inside one of our line boxes.
        for (InlineRunBox* curr = firstLineBox(); curr; curr = curr->nextLineBox()) {
            if((_y >=_ty + curr->m_y) && (_y < _ty + curr->m_y + curr->m_height) &&
               (_x >= _tx + curr->m_x) && (_x <_tx + curr->m_x + curr->m_width) ) {
                inside = true;
                break;
            }
        }
    }

    if (inside && element()) {
        if (info.innerNode() && info.innerNode()->renderer() &&
            !info.innerNode()->renderer()->isInline()) {
            // Within the same layer, inlines are ALWAYS fully above blocks.  Change inner node.
            info.setInnerNode(element());

            // Clear everything else.
            info.setInnerNonSharedNode(0);
            info.setURLElement(0);
        }

        if (!info.innerNode())
            info.setInnerNode(element());

        if(!info.innerNonSharedNode())
            info.setInnerNonSharedNode(element());
    }

    return inside;
}
开发者ID:BackupTheBerlios,项目名称:nirvana-svn,代码行数:42,代码来源:render_inline.cpp

示例13: captureOpenWriteDevice

bool captureOpenWriteDevice()
{
	XnStatus nRetVal = XN_STATUS_OK;
	NodeInfoList recordersList;
	nRetVal = g_Context.EnumerateProductionTrees(XN_NODE_TYPE_RECORDER, NULL, recordersList);
	START_CAPTURE_CHECK_RC(nRetVal, "Enumerate recorders");
	// take first
	NodeInfo chosen = *recordersList.Begin();
	nRetVal = g_Context.CreateProductionTree(chosen);
	START_CAPTURE_CHECK_RC(nRetVal, "Create recorder");

	g_Capture.pRecorder = new Recorder;
	nRetVal = chosen.GetInstance(*g_Capture.pRecorder);
	START_CAPTURE_CHECK_RC(nRetVal, "Get recorder instance");

	nRetVal = g_Capture.pRecorder->SetDestination(XN_RECORD_MEDIUM_FILE, g_Capture.csFileName);
	START_CAPTURE_CHECK_RC(nRetVal, "Set output file");

	return true;
}
开发者ID:afisa,项目名称:OpenNI,代码行数:20,代码来源:Capture.cpp

示例14:

template<class NodeVector> void FileSystem::debugPrintNodes(NodeVector nodes) {
    if( debug) {
        unsigned int ix;
        NodeInfo* node;

        for (ix = 0; ix < nodes.size(); ++ix) {
            node = nodes.at(ix);

            cout << "Node: " << node->getName()
                << "\t\tSize: " << node->getSize()
                << "\tModify: " << node->getModifyTime()
                << "\tPath: " << node->getPath()
                << "\tSimilars: ";
        
            vector<NodeInfo*>::iterator it;
            vector<NodeInfo*> nodes = node->getSimilar();
            for(it=nodes.begin(); it != nodes.end(); ++it) {
                cout << (*it)->getPath() << ", ";
            }

            cout << endl;
        }
    }

}
开发者ID:ruskiyos,项目名称:duplocator,代码行数:25,代码来源:FileSystem.cpp

示例15: on_req_node_remove

 void on_req_node_remove(const int fd)
 {
 	WNodeManager* nodeManager = WNodeManager::getInstance();

	char* req_buff;
	size_t req_len;
	int cl = w_recv(fd,req_buff);

	if(cl > 0)
	{
		NodeInfo req;
		if(!req.ParseFromArray(req_buff, cl))
		{
			cerr<<"error when parse get request\n";
			//response.set_rspcode(REQ_FAILED);
			//response.set_errcode(ERR_INVALID_PARAMS);
			//w_send_pb(fd, &response);
			return;
		}

		cout<<"client addr is "<<req.nodeaddr()<<",port is "<<req.nodeport()<<endl;
		
		nodeManager->removeNode(req.nodeaddr(), req.nodeport());
		cout<<"node remove ok"<<endl;
	}
	else
	{
		cout<<"can not get node info\n";
	}
 }
开发者ID:RusonWong,项目名称:wimg,代码行数:30,代码来源:EventHandler.cpp


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