src/PredFinder/elf/ElfDocument.cpp
/**
 * Public accessor to get all relations, or relations containing
 * a match for a particular arg. Returns copies
 * of the underlying ElfRelations, so changing any of the return
 * values doesn't change the contents of the document.
 *
 * @param search_arg The arg to find relations by;
 * if NULL, all relations are returned.
 * @param seen_relations A list of relations we've already
 * seen in the recursion, to avoid arg reference loops; initially
 * empty. Shares pointers with the result list, but is discarded.
 * @return A dictionary of relations by name.
 *
 * @author nward@bbn.com
 * @date 2010.08.18
 **/
Public accessor to get all relations, or relations containing
a match for a particular arg. Returns copies
of the underlying ElfRelations, so changing any of the return
values doesn't change the contents of the document.

@param search_arg The arg to find relations by;
if NULL, all relations are returned.
@param seen_relations A list of relations we've already
seen in the recursion, to avoid arg reference loops; initially
empty. Shares pointers with the result list, but is discarded.
@return A dictionary of relations by name.


Public accessor to get all relations or relations containing a match for a particular arg . Returns copies of the underlying ElfRelations so changing any of the return values doesn ' t change the contents of the document . @param search_arg The arg to find relations by ; if NULL all relations are returned . @param seen_relations A list of relations we ' ve already seen in the recursion to avoid arg reference loops ; initially empty . Shares pointers with the result list but is discarded . @return A dictionary of relations by name .
ElfRelationMap ElfDocument::get_relations_by_arg(const ElfRelationArg_ptr search_arg) const {
	ElfRelationMap matching_relations;
	BOOST_FOREACH(ElfRelation_ptr relation, _relations) {
		ElfRelationArg_ptr matching_arg = relation->get_matching_arg(search_arg);
		if (matching_arg.get() != NULL) {
			ElfRelation_ptr relation_copy = boost::make_shared<ElfRelation>(relation);
			std::pair<ElfRelationMap::iterator, bool> relation_match_insert = matching_relations.insert(ElfRelationMap::value_type(relation_copy->get_name(), std::vector<ElfRelation_ptr>()));
			relation_match_insert.first->second.push_back(relation_copy);
		}
	}
	return matching_relations;
}
ElfRelationMap ElfDocument :: get_relations_by_arg ( const ElfRelationArg_ptr search_arg ) const { ElfRelationMap matching_relations ; BOOST_FOREACH ( ElfRelation_ptr relation , _relations ) { ElfRelationArg_ptr matching_arg = relation -> get_matching_arg ( search_arg ) ; if ( matching_arg . get ( ) != NULL ) { ElfRelation_ptr relation_copy = boost :: make_shared < ElfRelation > ( relation ) ; std :: pair < ElfRelationMap :: iterator , bool > relation_match_insert = matching_relations . insert ( ElfRelationMap :: value_type ( relation_copy -> get_name ( ) , std :: vector < ElfRelation_ptr > ( ) ) ) ; relation_match_insert . first -> second . push_back ( relation_copy ) ; } } return matching_relations ; }
Public accessor to get all relations, or relations containing
 a match for a particular arg.
Public accessor to get all relations or relations containing a match for a particular arg .
// Copies of any matching relations we found
 // Loop over all of the relations in this document
 // Get a matching arg from this relation, if there is one
 // Add this found relation to the return list
 // Done
