IMP
2.2.0
The Integrative Modeling Platform
IMP Mainpage
All IMP Modules
Related Pages
Modules
Namespaces
Classes
Files
Examples
Indexes
File List
File Members
State.h
Go to the documentation of this file.
1
/**
2
* \file IMP/atom/State.h \brief A decorator for States.
3
*
4
* Copyright 2007-2014 IMP Inventors. All rights reserved.
5
*
6
*/
7
8
#ifndef IMPATOM_STATE_H
9
#define IMPATOM_STATE_H
10
11
#include <IMP/atom/atom_config.h>
12
#include "
atom_macros.h
"
13
#include "
Hierarchy.h
"
14
15
#include <
IMP/base_types.h
>
16
#include <
IMP/kernel/Particle.h
>
17
#include <
IMP/kernel/Model.h
>
18
#include <
IMP/Decorator.h
>
19
20
IMPATOM_BEGIN_NAMESPACE
21
22
//! A decorator for a node that marks this hierarchy as being a particular
23
// state.
24
/**
25
* \note Only one State node is allowed in any path up the tree as nesting
26
* them does not have a clear meaning.
27
*/
28
class
IMPATOMEXPORT
State
:
public
Hierarchy
{
29
static
IntKey
get_index_key();
30
31
static
void
do_setup_particle(
kernel::Model
*m,
kernel::ParticleIndex
pi,
32
unsigned
int
state);
33
34
void
validate();
35
36
public
:
37
IMP_DECORATOR_SETUP_1
(
State
,
unsigned
int
, index);
38
IMP_DECORATOR_METHODS
(
State
,
Hierarchy
);
39
40
static
bool
get_is_setup
(
kernel::Model
*m,
kernel::ParticleIndex
pi) {
41
return
m->get_has_attribute(get_index_key(), pi);
42
}
43
44
unsigned
int
get_state_index
()
const
{
45
return
get_model
()->
get_attribute
(get_index_key(),
get_particle_index
());
46
}
47
};
48
49
IMP_DECORATORS
(State, States, Hierarchies);
50
51
/** Walk up the hierarchy to find the current state. Return -1 if there is none.
52
*/
53
IMPATOMEXPORT
int
get_state_index
(Hierarchy h);
54
55
IMPATOM_END_NAMESPACE
56
57
#endif
/* IMPATOM_STATE_H */
Decorator.h
Import IMP/kernel/Decorator.h in the namespace.
IMP::kernel::Decorator::get_particle_index
ParticleIndex get_particle_index() const
Definition:
kernel/Decorator.h:183
IMP::kernel::Key
A base class for Keys.
Definition:
kernel/Key.h:46
base_types.h
Import IMP/kernel/base_types.h in the namespace.
IMP_DECORATOR_METHODS
#define IMP_DECORATOR_METHODS(Name, Parent)
Definition:
kernel/decorator_macros.h:27
IMP::kernel::Decorator::get_model
Model * get_model() const
Returns the Model containing the particle.
Definition:
kernel/Decorator.h:186
IMP::atom::Hierarchy::get_is_setup
static bool get_is_setup(kernel::Model *m, kernel::ParticleIndex p)
Definition:
atom/Hierarchy.h:279
IMP::kernel::Model::get_attribute
Type get_attribute(TypeKey attribute_key, ParticleIndex particle)
Hierarchy.h
Decorator for helping deal with a hierarchy of molecules.
IMP::atom::Hierarchy
The standard decorator for manipulating molecular structures.
Definition:
atom/Hierarchy.h:198
IMP::base::Index< ParticleIndexTag >
IMP::atom::get_state_index
int get_state_index(Hierarchy h)
Model.h
Storage of a model, its restraints, constraints and particles.
Particle.h
Classes to handle individual model particles.
atom_macros.h
Various important macros for implementing decorators.
IMP::atom::State
A decorator for a node that marks this hierarchy as being a particular.
Definition:
State.h:28
IMP_DECORATOR_SETUP_1
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Definition:
kernel/decorator_macros.h:140
IMP_DECORATORS
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Definition:
kernel/decorator_macros.h:391
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:72