home
about
news
download
doc
source
systems
tests
bugs
contact
IMP Reference Guide
develop.7482b7c7af, 2026/12/05
The Integrative Modeling Platform
IMP Manual
Reference Guide
Tutorial Index
Modules
Classes
Examples
include
IMP
atom
version 20261205.develop.7482b7c7af
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-2022 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/Particle.h
>
17
#include <
IMP/Model.h
>
18
#include <
IMP/Decorator.h
>
19
20
IMPATOM_BEGIN_NAMESPACE
21
22
//! Associate an integer "state" index with a hierarchy node.
23
/**
24
* \note Only one State node is allowed in any path up the tree as nesting
25
* them does not have a clear meaning.
26
*/
27
class
IMPATOMEXPORT State :
public
Hierarchy {
28
static
IntKey
get_index_key();
29
30
static
void
do_setup_particle(
Model
*m,
ParticleIndex
pi,
31
unsigned
int
state);
32
static
void
do_setup_particle(
Model
*m,
ParticleIndex
pi,
33
State o){
34
do_setup_particle(m, pi, o.get_state_index());
35
}
36
void
validate();
37
38
public
:
39
IMP_DECORATOR_SETUP_1
(State,
unsigned
int
, index);
40
IMP_DECORATOR_SETUP_1
(State, State, other);
41
IMP_DECORATOR_METHODS
(State, Hierarchy);
42
43
static
bool
get_is_setup(
Model
*m,
ParticleIndex
pi) {
44
return
m->get_has_attribute(get_index_key(), pi);
45
}
46
47
unsigned
int
get_state_index
()
const
{
48
return
get_model()->get_attribute(get_index_key(), get_particle_index());
49
}
50
};
51
52
IMP_DECORATORS
(State, States, Hierarchies);
53
54
//! Walk up the hierarchy to find the current state.
55
/** \return the state index, or -1 if there is none. */
56
IMPATOMEXPORT
int
get_state_index
(
Hierarchy
h);
57
58
IMPATOM_END_NAMESPACE
59
60
#endif
/* IMPATOM_STATE_H */
Decorator.h
The base class for decorators.
Model.h
Storage of a model, its restraints, constraints and particles.
Particle.h
Classes to handle individual model particles. (Note that implementation of inline functions is in int...
Hierarchy.h
Decorator for helping deal with a hierarchy of molecules.
atom_macros.h
Macros for maintaining molecular hierarchies.
base_types.h
Basic types used by IMP.
IMP::Model
Class for storing model, its restraints, constraints, and particles.
Definition
Model.h:111
IMP::atom::Hierarchy
The standard decorator for manipulating molecular structures.
Definition
atom/Hierarchy.h:192
IMP_DECORATOR_SETUP_1
#define IMP_DECORATOR_SETUP_1(Name, FirstArgumentType, first_argument_name)
Definition
decorator_macros.h:125
IMP_DECORATORS
#define IMP_DECORATORS(Name, PluralName, Parent)
Define the types for storing sets of decorators.
Definition
decorator_macros.h:419
IMP_DECORATOR_METHODS
#define IMP_DECORATOR_METHODS(Name, Parent)
Definition
decorator_macros.h:26
IMP::atom::get_state_index
int get_state_index(Hierarchy h)
Walk up the hierarchy to find the current state.
IMP::ParticleIndex
Index< ParticleIndexTag > ParticleIndex
Definition
base_types.h:196
IMP::IntKey
Key< 1 > IntKey
The type used to identify int attributes in the Particles.
Definition
base_types.h:36