See HierarchyTraits for an example of how to define a custom hierarchy and Hierarchy for a hierarchy for molecules.
Public Types | |
typedef IMP::internal::IndexingIterator < ChildAttrArrayAccessor > | ChildIterator |
Public Member Functions | |
unsigned int | add_child (Hierarchy t) |
void | add_child_at (Hierarchy t, unsigned int idx) |
void | add_children (const GenericHierarchies &et) |
ChildIterator | children_begin () const |
ChildIterator | children_end () const |
void | clear_children () |
Hierarchy | get_child (unsigned int i) const |
int | get_child_index (Hierarchy c) const |
Get the index of a specific child in this particle. | |
GenericHierarchies | get_children () const |
unsigned int | get_number_of_children () const |
Hierarchy | get_parent () const |
int | get_parent_index () const |
Get the index of this particle in the list of children. | |
const HierarchyTraits & | get_traits () const |
bool | has_parent () const |
Hierarchy (::IMP::Particle *p, const HierarchyTraits &tr=get_default_traits()) | |
void | remove_child (Hierarchy t) |
Static Public Member Functions | |
static Hierarchy | decorate_particle (::IMP::Particle *p, const HierarchyTraits &tr=get_default_traits()) |
static const HierarchyTraits & | get_default_traits () |
Get the default hierarchy traits. | |
static bool | particle_is_instance (Particle *p, HierarchyTraits traits=Hierarchy::get_default_traits()) |
static Hierarchy | setup_particle (Particle *p, const Particles &children, HierarchyTraits traits=Hierarchy::get_default_traits()) |
Add the needed attributes to a particle and add the particles as children. | |
static Hierarchy | setup_particle (Particle *p, HierarchyTraits traits=Hierarchy::get_default_traits()) |
Add the needed attributes to a particle. | |
Related Functions | |
(Note that these are not member functions.) | |
template<class HD , class F > | |
HD | breadth_first_find (HD h, F f) |
Find the first node which matches some criteria. | |
template<class HD , class F > | |
F | breadth_first_traversal (HD d, F f) |
Apply the visitor to each particle, breadth first. | |
template<class HD , class F > | |
F | breadth_first_traversal_with_data (HD d, F f, typename F::result_type i) |
Apply functor F to each particle, traversing the hierarchy breadth first. | |
template<class HD , class F > | |
F | depth_first_traversal (HD d, F f) |
Apply functor F to each particle, traversing the hierarchy depth first. | |
template<class HD , class F > | |
F | depth_first_traversal_with_data (HD d, F f, typename F::result_type i) |
Apply functor F to each particle, traversing the hierarchy depth first. | |
template<class Out , class F > | |
Out | gather (Hierarchy h, F f, Out out) |
Gather all the particles in the hierarchy which meet some criteria. | |
template<class Out , class K , class V > | |
Out | gather_by_attribute (Hierarchy h, K k, V v, Out out) |
Gather all the particles in the hierarchy which match on an attribute. | |
template<class Out , class K0 , class V0 , class K1 , class V1 > | |
Out | gather_by_attributes (Hierarchy h, K0 k0, V0 v0, K1 k1, V1 v1, Out out) |
Gather all the particles in the hierarchy which match on two attributes. | |
GenericHierarchiesTemp | get_all_descendants (Hierarchy mhd) |
Get all the particles in the subtree. | |
GenericHierarchiesTemp | get_internal (Hierarchy mhd) |
Get all the non-leaves of the bit of hierarchy. | |
GenericHierarchiesTemp | get_leaves (Hierarchy mhd) |
Get all the leaves of the bit of hierarchy. | |
Hierarchy | get_root (Hierarchy h) |
Return the root of the hierarchy. | |
template<class ND > | |
std::ostream & | show (Hierarchy h, std::ostream &out=std::cout, unsigned int max_depth=std::numeric_limits< unsigned int >::max()) |
Print the hierarchy using a given decorator as to display each node. |
int IMP::core::Hierarchy::get_child_index | ( | Hierarchy | c | ) | const |
Get the index of a specific child in this particle.
This takes linear time.
Hierarchy IMP::core::Hierarchy::get_parent | ( | ) | const |
Reimplemented in IMP::atom::Hierarchy.
int IMP::core::Hierarchy::get_parent_index | ( | ) | const |
Get the index of this particle in the list of children.
bool IMP::core::Hierarchy::has_parent | ( | ) | const |
Return true if the parent is not empty
static bool IMP::core::Hierarchy::particle_is_instance | ( | Particle * | p, | |
HierarchyTraits | traits = Hierarchy::get_default_traits() | |||
) | [static] |
Check if the particle has the needed attributes for a cast to succeed
static Hierarchy IMP::core::Hierarchy::setup_particle | ( | Particle * | p, | |
const Particles & | children, | |||
HierarchyTraits | traits = Hierarchy::get_default_traits() | |||
) | [static] |
Add the needed attributes to a particle and add the particles as children.
The particles can be, but don't have to be Hierarchy particles already.