IMP  2.0.1
The Integrative Modeling Platform
IMP::core::Hierarchy Class Reference

A decorator for helping deal with a hierarchy. More...

#include <IMP/core/Hierarchy.h>

+ Inheritance diagram for IMP::core::Hierarchy:

Public Types

typedef HierarchyTraits DecoratorTraits
 
typedef Decorator DecoratorTraitsBase
 

Public Member Functions

 Hierarchy (Model *m, ParticleIndex id, const HierarchyTraits &tr)
 
 Hierarchy (::IMP::kernel::Particle *p, const HierarchyTraits &tr=get_default_traits())
 
 Hierarchy (const HierarchyTraits &tr)
 
void add_child (Hierarchy h) const
 
void add_child_at (Hierarchy h, unsigned int pos)
 
void clear_children ()
 
Hierarchy get_child (unsigned int i) const
 
int get_child_index () const
 
GenericHierarchies get_children () const
 
const DecoratorTraitsget_decorator_traits () const
 
unsigned int get_number_of_children () const
 
Hierarchy get_parent () const
 
const HierarchyTraitsget_traits () const
 
void remove_child (unsigned int i)
 
void remove_child (Hierarchy h)
 
void show (std::ostream &out=std::cout) const
 
- Public Member Functions inherited from IMP::kernel::Decorator
ParticleIndex get_particle_index () const
 
Particleget_particle () const
 
Modelget_model () const
 Returns the Model containing the particle.
 
 Decorator (Particle *p)
 
 Decorator ()
 

Static Public Member Functions

static Hierarchy decorate_particle (::IMP::kernel::Particle *p, const HierarchyTraits &tr=get_default_traits())
 
static const DecoratorTraitsget_default_decorator_traits ()
 
static const HierarchyTraitsget_default_traits ()
 Get the default hierarchy traits.
 
static bool particle_is_instance (Particle *, HierarchyTraits=Hierarchy::get_default_traits())
 
static Hierarchy setup_particle (Particle *p, HierarchyTraits traits=Hierarchy::get_default_traits())
 Add the needed attributes to a particle.
 
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. More...
 
- Static Public Member Functions inherited from IMP::kernel::Decorator
static bool particle_is_instance (Particle *p)
 Return true if the particle can be cast to the decorator. More...
 

Related Functions

(Note that these are not member functions.)

template<class HD , class F >
HD find_breadth_first (HD h, F f)
 Find the first node which matches some criteria.
 
template<class H , class Out , class F >
Out gather (H h, F f, Out out)
 Gather all the particles in the hierarchy which meet some criteria.
 
template<class H , class Out , class K , class V >
Out gather_by_attribute (H h, K k, V v, Out out)
 Gather all the particles in the hierarchy which match on an attribute.
 
template<class H , class Out , class K0 , class V0 , class K1 , class V1 >
Out gather_by_attributes (H h, K0 k0, V0 v0, K1 k1, V1 v1, Out out)
 Gather all the particles in the hierarchy which match on two attributes.
 
template<class H , class Out , class F >
Out gather_slice (H h, F f, Out out)
 Gather all the particles in the hierarchy which meet some criteria. More...
 
GenericHierarchies get_all_descendants (Hierarchy mhd)
 Get all the particles in the subtree.
 
GenericHierarchies get_internal (Hierarchy mhd)
 Get all the non-leaves of the bit of hierarchy.
 
GenericHierarchies get_leaves (Hierarchy mhd)
 Get all the leaves of the bit of hierarchy. More...
 
Hierarchy get_root (Hierarchy h)
 Return the root of the hierarchy. More...
 
template<class ND >
std::ostream & show (Hierarchy h, std::ostream &out=std::cout)
 Print the hierarchy using a given decorator as to display each node. More...
 
template<class HD , class F >
visit_breadth_first (HD d, F f)
 Apply the visitor to each particle, breadth first. More...
 
template<class HD , class F >
visit_breadth_first_with_data (HD d, F f, typename F::result_type i)
 Apply functor F to each particle, traversing the hierarchy breadth first. More...
 
template<class HD , class F >
visit_depth_first (HD d, F f)
 Apply functor F to each particle, traversing the hierarchy depth first. More...
 
template<class HD , class F >
visit_depth_first_with_data (HD d, F f, typename F::result_type i)
 Apply functor F to each particle, traversing the hierarchy depth first. More...
 

Additional Inherited Members

- Protected Member Functions inherited from IMP::kernel::Decorator
 Decorator (Model *m, ParticleIndex pi)
 
 Decorator (Particle *p)
 

Detailed Description

See HierarchyTraits for an example of how to define a custom hierarchy and Hierarchy for a hierarchy for molecules.

See Also
HierarchyTraits

Definition at line 82 of file core/Hierarchy.h.

Member Function Documentation

Hierarchy IMP::core::Hierarchy::get_parent ( ) const
Returns
the parent particle, or Hierarchy() if it has no parent.

Definition at line 129 of file core/Hierarchy.h.

+ Here is the call graph for this function:

static bool IMP::core::Hierarchy::particle_is_instance ( Particle ,
HierarchyTraits  = Hierarchy::get_default_traits() 
)
static

Check if the particle has the needed attributes for a cast to succeed

Definition at line 121 of file core/Hierarchy.h.

static Hierarchy IMP::core::Hierarchy::setup_particle ( Particle p,
const Particles &  children,
HierarchyTraits  traits = Hierarchy::get_default_traits() 
)
static

The particles can be, but don't have to be Hierarchy particles already.

Definition at line 101 of file core/Hierarchy.h.

+ Here is the call graph for this function:

Friends And Related Function Documentation

GenericHierarchies get_leaves ( Hierarchy  mhd)
related

The leaves are returned in the obvious order (first child before second child).

Hierarchy get_root ( Hierarchy  h)
related

Definition at line 590 of file core/Hierarchy.h.


The documentation for this class was generated from the following file: