IMP
2.0.1
The Integrative Modeling Platform
|
A simple decorator which adds a name to a particle. More...
#include <IMP/example/ExampleDecorator.h>
Public Member Functions | |
ExampleDecorator (Model *m, ParticleIndex id) | |
ExampleDecorator (::IMP::kernel::Particle *p) | |
std::string | get_decorator_name () const |
Get the name added to the particle. | |
void | set_decorator_name (std::string nm) |
Set the name added to the particle. | |
void | show (std::ostream &out=std::cout) const |
Public Member Functions inherited from IMP::kernel::Decorator | |
ParticleIndex | get_particle_index () const |
Particle * | get_particle () const |
Model * | get_model () const |
Returns the Model containing the particle. | |
Decorator (Particle *p) | |
Decorator () | |
Static Public Member Functions | |
static ExampleDecorator | decorate_particle (::IMP::kernel::Particle *p) |
static bool | particle_is_instance (Particle *p) |
return true if the particle has a name | |
static ExampleDecorator | setup_particle (Particle *p, std::string name) |
Add a name to the particle. 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... | |
Additional Inherited Members | |
Protected Member Functions inherited from IMP::kernel::Decorator | |
Decorator (Model *m, ParticleIndex pi) | |
Decorator (Particle *p) | |
A decorator adds functionality to a particle and ensures that invariants are preserved. In this case, the functionality is the setting and access of a name for the Particle and the invariant is that the name is always non-empty.
The source code is as follows:
Definition at line 31 of file ExampleDecorator.h.
|
static |
The create function should take arguments which allow the initial state of the Decorator to be reasonable (i.e. make sure there is a non-empty name).
Definition at line 47 of file ExampleDecorator.h.