Example #1
0
	std::vector< std::pair< prm::qualified_path, std::string > > get_available_agent_specs(prm::param_accessor param_vals)
	{
		std::vector< std::pair< prm::qualified_path, std::string > > names;

		auto node = param_vals["agent_spec_list"];
		auto agent_spec_list_path = resolve_id("agent_spec_list", param_vals.get_root(), param_vals.get_current_path(), param_vals.get_all_paths());
		for(auto agent_entry : node)
		{
			auto agent_repeat_num = agent_entry.first.as< unsigned int >();
			auto agent = agent_entry.second;

			auto rel_path = prm::qualified_path({ "spec" }) + std::string{ "name" };
			auto name_node = prm::find_value(agent, rel_path);
			assert(name_node);

			auto spec_path = agent_spec_list_path;
			spec_path.leaf().set_index(agent_repeat_num);
			spec_path += std::string("spec");

			names.emplace_back(std::make_pair(
				spec_path,
				name_node.as< std::string >()
				));
		}

		return names;
	}
Example #2
0
    std::string process_ids(id_state& state, std::string const& xml)
    {
        placeholder_index placeholders = index_placeholders(state, xml);

        typedef std::vector<id_placeholder*>::iterator iterator;

        iterator it = placeholders.begin(),
            end = placeholders.end();

        // Placeholder ids are processed in blocks of ids with
        // an equal number of dots.
        while (it != end) {
            unsigned num_dots = (*it)->num_dots;

            // ids can't clash with ids at a different num_dots, so
            // this only needs to track the id generation data
            // for a single num_dots at a time.
            allocated_ids ids;

            iterator it2 = it;
            do {
                resolve_id(**it2++, ids);
            } while(it2 != end && (*it2)->num_dots == num_dots);

            do {
                generate_id(**it++, ids);
            } while(it != it2);
        }

        return replace_ids(state, xml);
    }
IR__::Contained_ptr
Repository_impl::lookup_id
(const char* search_id)
throw(CORBA::SystemException)
{
	DEBUG_OUTLINE ( "Repository_impl::lookup_id() called" );
	
	if ( !check_for_id ( search_id ) )
		return IR__::Contained::_nil();
	
	Contained_impl *contained = resolve_id ( search_id );
	return contained -> _this();
}