コード例 #1
0
//------------------------ GetClosestNodeToPosition ---------------------------
//
//  returns the index of the closest visible graph node to the given position
//-----------------------------------------------------------------------------
int Raven_PathPlanner::GetClosestNodeToPosition(Vector2D pos)const
{
  double ClosestSoFar = MaxDouble;
  int   ClosestNode  = no_closest_node_found;

  //when the cell space is queried this the the range searched for neighboring
  //graph nodes. This value is inversely proportional to the density of a 
  //navigation graph (less dense = bigger values)
  const double range = m_pOwner->GetWorld()->GetMap()->GetCellSpaceNeighborhoodRange();

  //calculate the graph nodes that are neighboring this position
  m_pOwner->GetWorld()->GetMap()->GetCellSpace()->CalculateNeighbors(pos, range);

  //iterate through the neighbors and sum up all the position vectors
  for (NodeType* pN = m_pOwner->GetWorld()->GetMap()->GetCellSpace()->begin();
                 !m_pOwner->GetWorld()->GetMap()->GetCellSpace()->end();     
                 pN = m_pOwner->GetWorld()->GetMap()->GetCellSpace()->next())
  {
    //if the path between this node and pos is unobstructed calculate the
    //distance
    if (m_pOwner->canWalkBetween(pos, pN->Pos()))
    {
      double dist = Vec2DDistanceSq(pos, pN->Pos());

      //keep a record of the closest so far
      if (dist < ClosestSoFar)
      {
        ClosestSoFar = dist;
        ClosestNode  = pN->Index();
      }
    }
  }
   
  return ClosestNode;
}
コード例 #2
0
ファイル: network.cpp プロジェクト: spherepeer/essentia
NodeType* visibleNetwork(Algorithm* algo) {
  stack<NodeType*> toVisit;
  set<NodeType*> visited;
  map<Algorithm*, NodeType*> algoNodeMap;

  NodeType* networkRoot = new NodeType(algo);
  toVisit.push(networkRoot);

  E_DEBUG(ENetwork, "building visible network from " << algo->name());
  E_DEBUG_INDENT;

  while (!toVisit.empty()) {
    NodeType* currentNode = toVisit.top();
    toVisit.pop();
    //E_DEBUG(ENetwork, "visiting: " << currentNode->algorithm()->name());

    if (visited.find(currentNode) != visited.end()) continue;
    visited.insert(currentNode);

    vector<NodeType*> deps = currentNode->addVisibleDependencies(algoNodeMap);

    E_DEBUG(ENetwork, currentNode->algorithm()->name() << ":");
    for (int i=0; i<(int)deps.size(); i++) {
      E_DEBUG(ENetwork, "  → " << deps[i]->algorithm()->name());
      toVisit.push(deps[i]);
    }
  }

  E_DEBUG_OUTDENT;
  E_DEBUG(ENetwork, "building visible network from " << algo->name() << " ok!");
  return networkRoot;
}
コード例 #3
0
    bool pixelIsAssignedToNode(unsigned int x, unsigned int y,
            const NodeType& node) {
        auto pixelNodeId = nodeIdImage.getPixelValue(x, y);
        auto pixelNodeLevel = internalImage.getPixelValue(x, y);

        return pixelNodeId == node.getId() && pixelNodeLevel == node.getLevel();
    }
コード例 #4
0
void mitk::FastMarchingTool3D::OnAddPoint()
{
  // Add a new seed point for FastMarching algorithm
  mitk::Point3D clickInIndex;

  m_ReferenceImage->GetGeometry()->WorldToIndex(m_SeedsAsPointSet->GetPoint(m_SeedsAsPointSet->GetSize()-1),
                                                clickInIndex);
  itk::Index<3> seedPosition;
  seedPosition[0] = clickInIndex[0];
  seedPosition[1] = clickInIndex[1];
  seedPosition[2] = clickInIndex[2];

  NodeType node;
  const double seedValue = 0.0;
  node.SetValue( seedValue );
  node.SetIndex( seedPosition );
  this->m_SeedContainer->InsertElement(this->m_SeedContainer->Size(), node);
  m_FastMarchingFilter->Modified();

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();

  m_NeedUpdate = true;

  this->Update();
}
コード例 #5
0
ファイル: nodetypesdelegate.cpp プロジェクト: KDE/rocs
void NodeTypesDelegate::showPropertiesDialog()
{
    QModelIndex index = focusedIndex();
    NodeType *type = qobject_cast<NodeType*>(index.data(NodeTypeModel::DataRole).value<QObject*>());
    QPointer<NodeTypeProperties> dialog = new NodeTypeProperties(0);
    dialog->setType(type->self());
    dialog->exec();
}
コード例 #6
0
    void connectPixelsMaybeReplacingParent(const NodeType& firstNode,
            const NodeType& secondNode) {
        auto& isBefore = levelOrderComparator;
        auto firstNodeParentLevel = firstNode.getParent().getLevel();
        auto secondNodeLevel = secondNode.getLevel();

        if (isBefore(firstNodeParentLevel, secondNodeLevel))
            minMaxTree.setNodeParent(firstNode, secondNode);
    }
コード例 #7
0
    void removeNormalNode(const NodeType& node) {
        auto& parent = node.getParent();
        auto newColor = parent.getLevel();
        auto newId = parent.getId();

        updatePixelsIfAssignedToNode(node, newColor, newId);

        minMaxTree.removeNode(node.getLevel(), node.getId());
    }
コード例 #8
0
    void removeRootNode(const NodeType& node) {
        minMaxTree.removeNode(node.getLevel(), node.getId());

        auto newColor = minMaxTree.getFirstLevel();
        auto newId = 0u;

        updatePixelsIfOnCollapsedLevel(newColor, newId);
        updatePixelsIfAssignedToNode(node, newColor, newId);
    }
コード例 #9
0
ファイル: xerces.hpp プロジェクト: APTriTec/ponder
    static NodeType addChild(NodeType node, const std::string& name)
    {
        XMLCh buffer[256];
        xercesc::XMLString::transcode(name.c_str(), buffer, sizeof(buffer));

        NodeType child = node->getOwnerDocument()->createElement(buffer);
        node->appendChild(child);

        return child;
    }
コード例 #10
0
bool mitk::FastMarchingTool::OnAddPoint( StateMachineAction*, InteractionEvent* interactionEvent )
{
  if ( SegTool2D::CanHandleEvent(interactionEvent) < 1.0 )
      return false;

  // Add a new seed point for FastMarching algorithm
  mitk::InteractionPositionEvent* positionEvent = dynamic_cast<mitk::InteractionPositionEvent*>( interactionEvent );
  //const PositionEvent* p = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
  if ( positionEvent == NULL ) return false;

  if ( m_PositionEvent.IsNotNull() )
      m_PositionEvent = NULL;

  m_PositionEvent = InteractionPositionEvent::New( positionEvent->GetSender(),
                                                   positionEvent->GetPointerPositionOnScreen(),
                                                   positionEvent->GetPositionInWorld() );

  //if click was on another renderwindow or slice then reset pipeline and preview
  if( (m_LastEventSender != m_PositionEvent->GetSender()) || (m_LastEventSlice != m_PositionEvent->GetSender()->GetSlice()) )
  {
      this->BuildITKPipeline();
      this->ClearSeeds();
  }

  m_LastEventSender = m_PositionEvent->GetSender();
  m_LastEventSlice = m_LastEventSender->GetSlice();

  mitk::Point3D clickInIndex;

  m_ReferenceImageSlice->GetGeometry()->WorldToIndex(m_PositionEvent->GetPositionInWorld(), clickInIndex);
  itk::Index<2> seedPosition;
  seedPosition[0] = clickInIndex[0];
  seedPosition[1] = clickInIndex[1];

  NodeType node;
  const double seedValue = 0.0;
  node.SetValue( seedValue );
  node.SetIndex( seedPosition );
  this->m_SeedContainer->InsertElement(this->m_SeedContainer->Size(), node);
  m_FastMarchingFilter->Modified();

  m_SeedsAsPointSet->InsertPoint(m_SeedsAsPointSet->GetSize(), m_PositionEvent->GetPositionInWorld());

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();

  m_NeedUpdate = true;

  this->Update();

  m_ReadyMessage.Send();

  return true;
}
コード例 #11
0
ファイル: node_cache.hpp プロジェクト: RedSunCMX/izenelib
    void load_(vector<uint32_t>& indexes)
    {
        uint32_t idx = indexes.front();
        indexes.erase(indexes.begin());

        NodeType* n = nodes[idx].pNode_ ;
        nodes[idx] =  _cache_node_(n);

        for (uint32_t i=0; i<n->getSize(); i++)
        {
            if (n->getDiskAddr(i)==(uint64_t)-1)
                continue;

            if (n->getDiskAddr(i)%2==0)
                continue;

            NodeType* t = new NodeType(f_);
            t->load(n->getDiskAddr(i));
            nodes[count_] = _cache_node_(t);

            indexes.push_back(count_);
            n->setMemAddr(i, count_);

            count_++;
            if (count_>=CACHE_SIZE)
            {
                indexes.clear();
                return;
            }

        }
    }
コード例 #12
0
void Algorithm<NodeType, ConfigType>::Apply(NodeType* current_node,
                                            ConfigType& config,
                                            size_t stop_time)
{
  NodeType* node = current_node;
  while(util::Timer::microtimer() < stop_time)
  {
    node = current_node;
    while(true)
    {
      config.CurrentNode() = node;
      if(node->IsTerminal())
        break;

      if(!node->IsExpanded())
      {
        node = node->AddChild();
        break;
      }

      node = node->BestChild();
    }

    config.NumSimulations()++;
    const size_t* goals = node->Simulate();

    while(node != NULL)
    {
      node->Update(goals);
      node = node->Parent();
    }
  }
}
コード例 #13
0
ファイル: xerces.hpp プロジェクト: APTriTec/ponder
    static void setText(NodeType node, const std::string& text)
    {
        XMLCh buffer[256];
        xercesc::XMLString::transcode(text.c_str(), buffer, sizeof(buffer));

        node->setTextContent(buffer);
    }
コード例 #14
0
ファイル: blender_shader.cpp プロジェクト: GameLemur/blender
static InterpolationType get_image_interpolation(NodeType& b_node)
{
	int value = b_node.interpolation();
	return (InterpolationType)validate_enum_value(value,
	                                              INTERPOLATION_NUM_TYPES,
	                                              INTERPOLATION_LINEAR);
}
コード例 #15
0
ファイル: blender_shader.cpp プロジェクト: GameLemur/blender
static ExtensionType get_image_extension(NodeType& b_node)
{
	int value = b_node.extension();
	return (ExtensionType)validate_enum_value(value,
	                                          EXTENSION_NUM_TYPES,
	                                          EXTENSION_REPEAT);
}
コード例 #16
0
ファイル: Signal.hpp プロジェクト: carriercomm/egoboo
 /// Notify all subscribers.
 /// @param arguments the arguments
 /// @todo Is perfect forwarding required/desired?
 void operator()(ParameterTypes&& ... arguments) {
     if (!running) { /// @todo Use ReentrantBarrier (not committed yet).
         running = true;
         try {
             for (NodeType *cur = head; nullptr != cur; cur = cur->next) {
                 if (!cur->isDead()) {
                     (*cur)(std::forward<ParameterTypes>(arguments) ...);
                 }
             }
         } catch (...) {
             running = false;
             std::rethrow_exception(std::current_exception());
         }
         maybeSweep();
         running = false;
     }
 }
コード例 #17
0
bool mitk::FastMarchingTool::OnAddPoint(Action* action, const StateEvent* stateEvent)
{
  // Add a new seed point for FastMarching algorithm
  const PositionEvent* p = dynamic_cast<const PositionEvent*>(stateEvent->GetEvent());
  if (!p) return false;

  if (m_PositionEvent != NULL)
      delete m_PositionEvent;
  m_PositionEvent = new PositionEvent(p->GetSender(), p->GetType(), p->GetButton(), p->GetButtonState(), p->GetKey(), p->GetDisplayPosition(), p->GetWorldPosition() );

  //if click was on another renderwindow or slice then reset pipeline and preview
  if( (m_LastEventSender != m_PositionEvent->GetSender()) || (m_LastEventSlice != m_PositionEvent->GetSender()->GetSlice()) )
  {
      this->BuildITKPipeline();
      this->ClearSeeds();
  }

  m_LastEventSender = m_PositionEvent->GetSender();
  m_LastEventSlice = m_LastEventSender->GetSlice();

  mitk::Point3D clickInIndex;

  m_ReferenceImageSlice->GetGeometry()->WorldToIndex(m_PositionEvent->GetWorldPosition(), clickInIndex);
  itk::Index<2> seedPosition;
  seedPosition[0] = clickInIndex[0];
  seedPosition[1] = clickInIndex[1];

  NodeType node;
  const double seedValue = 0.0;
  node.SetValue( seedValue );
  node.SetIndex( seedPosition );
  this->m_SeedContainer->InsertElement(this->m_SeedContainer->Size(), node);
  m_FastMarchingFilter->Modified();

  m_SeedsAsPointSet->InsertPoint(m_SeedsAsPointSet->GetSize(), m_PositionEvent->GetWorldPosition());

  mitk::RenderingManager::GetInstance()->RequestUpdateAll();

  m_NeedUpdate = true;

  m_ReadyMessage.Send();

  this->Update();

  return true;
}
コード例 #18
0
ファイル: xerces.hpp プロジェクト: APTriTec/ponder
    static std::string getText(NodeType node)
    {
        const XMLCh* text = node->getTextContent();

        char buffer[256];
        xercesc::XMLString::transcode(text, buffer, sizeof(buffer) - 1);

        return buffer;
    }
コード例 #19
0
ファイル: node_cache.hpp プロジェクト: RedSunCMX/izenelib
    /**
     *Load data from disk.
     **/
    uint32_t load()
    {
        vector<uint32_t> indexes;
        indexes.push_back(0);


        NodeType* t = new NodeType(f_);
        t->load(rootAddr_);
        nodes[count_] = _cache_node_(t);
        count_++;

        while (indexes.size()>0)
        {
            load_(indexes);
        }

        return count_;
    }
コード例 #20
0
ファイル: xerces.hpp プロジェクト: APTriTec/ponder
    static NodeType findFirstChild(NodeType node, const std::string& name)
    {
        XMLCh buffer[256];
        xercesc::XMLString::transcode(name.c_str(), buffer, sizeof(buffer));

        xercesc::DOMNodeList* children = node->getElementsByTagName(buffer);
        if (children && (children->getLength() > 0))
            return static_cast<NodeType>(children->item(0));
        else
            return 0;
    }
コード例 #21
0
Node* LdapTools::readNode(const string nodeName) {
	Node* retval = NULL;
	string base("sstNode=");
	base.append(nodeName).append(",ou=nodes,ou=virtualization,ou=services,").append(
			Config::getInstance()->getLdapBaseDn());
	SYSLOGLOGGER(logDEBUG) << "readNode " << base;
	LDAPSearchResults* entries = lc->search(base, LDAPConnection::SEARCH_SUB);
	if (entries != 0) {
		LDAPEntry* entry = entries->getNext();
		if (entry != 0) {
			retval = new Node(entry->getDN(), this);
		}
		while (entry != 0) {
//			SYSLOGLOGGER(logINFO) << "dn: " << entry->getDN();
			const LDAPAttributeList* attrs = entry->getAttributes();
			LDAPAttributeList::const_iterator it = attrs->begin();
			for (; it != attrs->end(); it++) {
				LDAPAttribute attr = *it;
//				SYSLOGLOGGER(logINFO) << attr.getName() << "(";
//				SYSLOGLOGGER(logINFO) << attr.getNumValues() << "): ";
				StringList values = attr.getValues();
				StringList::const_iterator it2 = values.begin();
				string value = *it2;
//				for (; it2 != values.end(); it2++) {
//
//					SYSLOGLOGGER(logINFO) << *it2 << "; ";
//				}
//				SYSLOGLOGGER(logINFO) << std::endl;
				retval->addAttribute(entry->getDN(), attr.getName(), value);
			}
			delete entry;
			entry = entries->getNext();
		}
		if (NULL != retval) {
			NodeType* type = retval->getType(string("VM-Node"));
			string nodestate = type->getState();
			retval->setMaintenance(0 == nodestate.compare("maintenance"));
		}
	}
	return retval;
}
コード例 #22
0
ファイル: bucket_cache.hpp プロジェクト: RedSunCMX/izenelib
    /*!
     *Get a new node in cache which is stroed in position 'diskAddr'.
     **/
    nodePtr newNode(uint64_t diskAddr)
    {
        if (count_<CACHE_SIZE)
        {
            NodeType* t = new NodeType(f_);
            t->load(diskAddr);
            nodes[count_] = _cache_node_(t);
            nodePtr p(nodes[count_]);
            count_++;
            return p;
        }


        uint32_t ret = findSwitchOut();
        kickOutNodes(ret);

        NodeType* t = new NodeType(f_);
        t->load(diskAddr);
        nodes[ret] = _cache_node_(t);
        nodePtr p(nodes[ret]);
        return p;
    }
コード例 #23
0
ファイル: xerces.hpp プロジェクト: APTriTec/ponder
    static NodeType findNextSibling(NodeType node, const std::string& name)
    {
        XMLCh buffer[256];
        xercesc::XMLString::transcode(name.c_str(), buffer, sizeof(buffer));

        xercesc::DOMNode* sibling = node->getNextSibling();
        while (sibling)
        {
            bool same = xercesc::XMLString::compareString(sibling->getNodeName(), buffer) == 0;
            if ((sibling->getNodeType() == xercesc::DOMNode::ELEMENT_NODE) && same)
                return static_cast<NodeType>(sibling);
            sibling = sibling->getNextSibling();
        }

        return 0;
    }
コード例 #24
0
    typename BucketKDTree<D, ELEM_TYPE>::NodeType*
    BucketKDTree<D, ELEM_TYPE>::findLeafFor(const Point<D, ELEM_TYPE>& p)
    {
        NodeType* current = m_root;
        while (!current->isLeaf())
        {
            // Ensure non-leaf node has two children (should always be case)
            assert(current->leftChild() && current->rightChild());

            if (p[current->cuttingDimension()] < current->cuttingValue())
            {
                current = current->leftChild();
            }
            else
            {
                current = current->rightChild();
            }
        }

        return current;
    }
コード例 #25
0
ファイル: bucket_cache.hpp プロジェクト: RedSunCMX/izenelib
    /*!
     *Load bucket of specific disk address into memory.
     **/
    nodePtr getNodeByMemAddr(uint32_t& memAddr, uint64_t diskAddr)
    {
        if (diskAddr%2==1)
            return nodePtr();

        if (memAddr>=count_ && memAddr!=(uint32_t)-1&&count_!=0)
            return nodePtr();

        if (memAddr!=(uint32_t)-1)
        {
            NodeType* t = nodes[memAddr].pNode_;
            if (t->getDiskAddr()==diskAddr)
            {
                return nodePtr(nodes[memAddr], memAddr);
            }
        }

        uint32_t i = findInCache(diskAddr);
        if (i != (uint32_t)-1)
        {
            memAddr = i;
            return nodePtr(nodes[i], memAddr);
        }

        if (count_<CACHE_SIZE)
        {
            NodeType* t = new NodeType(f_);
            t->load(diskAddr);
            nodes[count_] = _cache_node_(t);

            memAddr = count_;

            count_++;
            return nodePtr(nodes[memAddr], memAddr);
        }

        //cout<< "getNodeByMemAddr()\n";

        memAddr = findSwitchOut();
        //cout<<"\nswitch out-: "<<memAddr<<endl;
        kickOutNodes(memAddr);


        NodeType* t = new NodeType(f_);
        t->load(diskAddr);
        nodes[memAddr] = _cache_node_(t);
        return nodePtr(nodes[memAddr], memAddr);
    }
コード例 #26
0
ファイル: qtxml.hpp プロジェクト: MyOwnClone/camp
 static NodeType findNextSibling(NodeType node, const std::string& name)
 {
     return node.nextSiblingElement(name.c_str());
 }
コード例 #27
0
ファイル: operators.hpp プロジェクト: andyjost/Sprite
      result_type operator()(
          Stream & stream, bool outer, NodeType const & node
        ) const
      {
        // Get the program associated with this stream.
        Program const * pgm = manipulators::detail::pgm_data(stream);

        char close_char = '\0';
        m_delim.push(' ');

        // Print the label.
        if(pgm)
        {
          switch(node.tag())
          {
            case FAIL: stream << "**FAIL**"; break;

            case CHOICE:
              if(!outer)
              {
                stream << "(";
                close_char = ')';
              }
              stream << "?_" << node.id() << " ";
              break;

            case OPER:
                if(!outer && node.arity() > 0)
                {
                  stream << "(";
                  close_char = ')';
                }
                stream << pgm->oper_label[node.id()] << " ";
                break;

            case CTOR:
            default:
              // Handle certain built-in types specially.
              if(node.tag() >= CTOR)
              {
                switch(node.id())
                {
                  case CL_TUPLE2:
                  case CL_TUPLE3:
                  case CL_TUPLE4:
                  case CL_TUPLE5:
                  case CL_TUPLE6:
                  case CL_TUPLE7:
                  case CL_TUPLE8:
                  case CL_TUPLE9:
                    stream << "(";
                    close_char = ')';
                    m_delim.pop();
                    m_delim.push(',');
                    break;
                  case CL_CONS:
                  case CL_NIL:
                  {
                    stream << "[";
                    Node const * p = &node;
                    while(true)
                    {
                      visit(
                          tr1::bind<Stream &>(
                              *this, tr1::ref(stream), false, _1
                            )
                        , *(*p)[0]
                        );
                      p = (*p)[1].get();
                      if(p->id() == CL_NIL) break;
                      stream << ",";
                    }
                    stream << "]";
                    m_delim.pop();
                    return stream;
                  }
                  default:
                    if(!outer && node.arity() > 0)
                    {
                      stream << "(";
                      close_char = ')';
                    }
                    stream << pgm->ctor_label[node.id()] << " ";
                    break;
                }
                break;
              }
              else throw RuntimeError("mishandled node in operator<<");
          }
        }
        else
        {
          if(!outer)
          {
            stream << "(";
            close_char = ')';
          }
          stream << "<unknown-ctor> ";
        }

        // Print the children.
        bool first = true;
        BOOST_FOREACH(NodePtr const & child, node.iter())
        {
          if(!first) stream << m_delim.top();
          first = false;
          visit(
              tr1::bind<Stream &>(*this, tr1::ref(stream), false, _1)
            , *child
            );
        }

        m_delim.pop();
        if(close_char) stream << close_char;
        return stream;
      }
コード例 #28
0
ファイル: qtxml.hpp プロジェクト: MyOwnClone/camp
 static std::string getText(NodeType node)
 {
     return node.text().toStdString();
 }
コード例 #29
0
ファイル: TempNodeType.cpp プロジェクト: wangscript/khala
bool TempNodeType::onLoginMsg_(InfoNodePtr& infoNodePtr, Json::Value& msg,
		Timestamp time) {
	muduo::net::TcpConnectionPtr& conn = infoNodePtr->getConn();
	if (infoNodePtr->getStatus() == LOGIN_STATUS) {
		//has logined
		LOG_WARN<< conn->peerAddress().toIpPort() << " ID:"
		<< infoNodePtr->getId() << " reloading";
		ObjectType* objectType = nodeServer_->getObjectType(
				infoNodePtr->getNodeType());
		NodeType* nodeType = dynamic_cast<NodeType*>(objectType);
		return nodeType->onLoginSuccessMsg(infoNodePtr, msg, time);
	}
	onLoginTypeCheck(infoNodePtr, msg);
	ObjectType* objectType = nodeServer_->getObjectType(
			infoNodePtr->getNodeType());
	//because onLoginTypeCheck will always set as NodeType...
	NodeType* nodeType = dynamic_cast<NodeType*>(objectType);
	if (nodeType == 0)
		return false;
	if (!nodeType->onLoginCheckMsg(infoNodePtr, msg, time)) {
		LOG_ERROR<< conn->peerAddress().toIpPort() << "tmp ID:"
		<<infoNodePtr->getTempId()<< " login failure!";
		return true;
	}
	//set id
	uint id = infoNodePtr->getId();
	if (id == DEFAULT_ID) {
		LOG_INFO << conn->peerAddress().toIpPort()
				<< " ID will be set as tmp ID:" << infoNodePtr->getTempId();
		id = infoNodePtr->getTempId();
		infoNodePtr->setId(id);
	}
	if (!nodeServer_->getNodePool()->hasNode(id)) {
		//the new id has not login,add to nodePool
		if (nodeServer_->getNodePool()->setNewNode(id, infoNodePtr)) {
			//add to nodePool success,remove from TempNodePool
			nodeServer_->getTempNodePool()->remove(infoNodePtr->getTempId());
			infoNodePtr->setStatus(LOGIN_STATUS);
			LOG_INFO << conn->peerAddress().toIpPort() << " ID:" << id
					<< " login success!";
			return nodeType->onLoginSuccessMsg(infoNodePtr, msg, time);
		} else {
			//loading err,can't set id,may other threading is login with the id
			LOG_ERROR<< conn->peerAddress().toIpPort() << " ID:" << id
			<< " login err!";
			bool res = nodeType->onLoginFailureMsg(infoNodePtr, msg, time);
			//reset id as DEFAULT_ID
			infoNodePtr->setId(DEFAULT_ID);
			return res;
		}
	} else {
		//the id has login
		LOG_ERROR << conn->peerAddress().toIpPort() << " ID:" << id
		<< " Has logined id!";
		bool res = nodeType->onLoginFailureMsg(infoNodePtr, msg, time);
		//reset id as DEFAULT_ID
		infoNodePtr->setId(DEFAULT_ID);
		return res;
	}
	return true;
}
コード例 #30
0
ファイル: qtxml.hpp プロジェクト: MyOwnClone/camp
 static bool isValid(NodeType node)
 {
     return !node.isNull();
 }