IMP
2.0.1
The Integrative Modeling Platform
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
kernel/container_base.h
Go to the documentation of this file.
1
/**
2
* \file IMP/kernel/container_base.h
3
* \brief Abstract base class for containers of particles.
4
*
5
* Copyright 2007-2013 IMP Inventors. All rights reserved.
6
*
7
*/
8
9
#ifndef IMPKERNEL_CONTAINER_BASE_H
10
#define IMPKERNEL_CONTAINER_BASE_H
11
12
#include <IMP/kernel/kernel_config.h>
13
#include "
base_types.h
"
14
#include "
ScoreState.h
"
15
#include "
particle_index.h
"
16
#include <
IMP/base/utility_macros.h
>
17
#include <
IMP/base/ref_counted_macros.h
>
18
#include <
IMP/base/Object.h
>
19
#include <
IMP/base/WeakPointer.h
>
20
21
IMPKERNEL_BEGIN_NAMESPACE
22
class
Particle
;
23
class
Model
;
24
25
//! Abstract class for containers of particles
26
/** Containers store sets of tuples of particles. The degree of the tuple
27
(i.e. whether each tuple contains one, two, three or four
28
particles) is constant for each container. That is, a
29
SingletonContainer is a set of single particles, a PairContainer
30
is a set of pairs of particles etc.
31
32
These sets can come from a variety of sources, such as
33
- user-provided lists, e.g. IMP::core::ListSingletonContainer
34
- operations on other containers e.g. IMP::core::PairContainerSet
35
- computations based on particle attributes
36
e.g. IMP::Core::ClosePairContainer
37
38
Containers provide a variety of methods to
39
- get the number of tuples
40
- get the ith tuple
41
- iterate through the tuples
42
- determine if a tuple is contained in the set
43
44
\note If nothing uses the added and removed containers they may not
45
be updated.
46
47
\note Containers store \em sets and so are fundamentally unordered.
48
*/
49
class
IMPKERNELEXPORT
Container
:
public
ScoreState
50
{
51
bool
changed_;
52
#if IMP_HAS_CHECKS >= IMP_INTERNAL
53
bool
readable_;
54
bool
writeable_;
55
#endif
56
protected
:
57
//! This will be reset at the end of evaluate
58
void
set_is_changed(
bool
tf);
59
Container
(
Model
*m, std::string name=
"Container %1%"
);
60
public
:
61
//! Get contained particles
62
/** Get a list of all particles contained in this one,
63
given that the input containers are up to date.
64
*/
65
virtual
ParticleIndexes
get_all_possible_indexes()
const
=0;
66
67
/** \deprecated use get_all_possible_indexes() instead
68
*/
69
IMP_DEPRECATED_WARN
70
ParticlesTemp
get_all_possible_particles
()
const
{
71
IMP_DEPRECATED_FUNCTION
(Use
IMP::Container::get_all_possible_indexes
()
72
instead);
73
return
IMP::kernel::get_particles
(get_model(), get_all_possible_indexes());
74
}
75
76
/** Return true if the container changed since the last evaluate.*/
77
bool
get_is_changed()
const
;
78
79
//! containers don't have outputs
80
ModelObjectsTemp
do_get_outputs
() const IMP_OVERRIDE {
81
return
ModelObjectsTemp
();
82
}
83
84
//! Reset changed status
85
virtual
void
do_after_evaluate(
DerivativeAccumulator
*accpt) IMP_OVERRIDE;
86
87
/** True if the container's contents are not independent from one
88
another, and so it cannot be decomposed into a sum of terms.
89
Examples include connectivity.*/
90
virtual
bool
get_is_decomposable
()
const
{
return
true
;}
91
92
#if !defined(IMP_DOXYGEN)
93
// methods to implement checking for inputs and outputs
94
void
validate_readable()
const
;
95
void
validate_writable()
const
;
96
void
set_is_readable(
bool
tf);
97
void
set_is_writable(
bool
tf);
98
#endif
99
IMP_REF_COUNTED_DESTRUCTOR
(
Container
);
100
};
101
102
IMPKERNEL_END_NAMESPACE
103
104
#endif
/* IMPKERNEL_CONTAINER_BASE_H */