コード例 #1
0
	node_map &CServer::get_sibling_set_writable( CNode &node )
	{
		CNode *parent = node.get_parent_writable();
		if( parent )
		{
			return parent->get_children_writable();
		}
		else
		{
			return m_nodes;
		}
	}
コード例 #2
0
	void CStateTable::add( CNode &node )
	{
		/* add self to path map */
		const string &path = node.get_path();
		if( m_nodes.count( path ) > 0 )
		{
			INTEGRA_TRACE_ERROR << "duplicate key in state table: " << path;
		}
		else
		{
			m_nodes[ path ] = &node;
		}

		/* add self to id map */
		internal_id id = node.get_id();
		if( m_nodes_by_id.count( id ) > 0 )
		{
			INTEGRA_TRACE_ERROR << "duplicate key in state table: " << id;
		}
		else
		{
			m_nodes_by_id[ id ] = &node;
		}

		/* add node endpoints */
		node_endpoint_map node_endpoints = node.get_node_endpoints_writable();
		for( node_endpoint_map::const_iterator i = node_endpoints.begin(); i != node_endpoints.end(); i++ )
		{
			INodeEndpoint *node_endpoint = i->second;
			const string &path = node_endpoint->get_path();
			if( m_node_endpoints.count( path ) > 0 )
			{
				INTEGRA_TRACE_ERROR << "duplicate key in state table: " << path;
			}
			else
			{
				m_node_endpoints[ path ] = node_endpoint;
			}
		}

		/* add child nodes */
		node_map &children = node.get_children_writable();
		for( node_map::iterator i = children.begin(); i != children.end(); i++ )
		{
			add( *CNode::downcast_writable( i->second ) );
		}
	}