示例#1
0
 server_node * find_node(int32_t node_id)
 {
     node_set_type::iterator it = node_set.find(node_id, hash_node(), equal_node());
     if (it == node_set.end())
         return NULL;
     return &(*it);
 }
示例#2
0
void node_graph::synth_reassign_id(int32_t node_id)
{
    node_set_type::iterator it = node_set.find(node_id, hash_node(), equal_node());
    if (it == node_set.end())
        throw std::runtime_error("node id not found");
    server_node * node = &(*it);

    if (!node->is_synth())
        return;

    boost::hash<int32_t> hasher;

    int32_t hidden_id = -std::abs(node_id);

    while (!node_id_available(hidden_id))
        hidden_id = -std::abs<int32_t>(hasher(node_id));

    assert(hidden_id < 0);
    node_set.erase(*node);
    node->reset_id(hidden_id);
    node_set.insert(*node);
}
示例#3
0
 bool node_id_available(int32_t node_id)
 {
     node_set_type::iterator it = node_set.find(node_id, hash_node(), equal_node());
     return (it == node_set.end());
 }