IMP
2.3.0
The Integrative Modeling Platform
IMP Mainpage
Modules
Applications
Related Pages
Groups
Classes
Files
Examples
Indexes
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-2014 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 "
ModelObject.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::container::ListSingletonContainer
34
- operations on other containers e.g. IMP::container::PairContainerSet
35
- computations based on particle attributes
36
e.g. IMP::container::ClosePairContainer
37
38
Most basically, containers allow you to get their contents
39
(eg SingletonContainer::get_indexes()) or do an operation on their contents
40
IMP_CONTAINER_FOREACH().
41
42
\note Containers store \em sets and so are fundamentally unordered.
43
*/
44
class
IMPKERNELEXPORT
Container
:
public
ModelObject
{
45
#if IMP_HAS_CHECKS >= IMP_INTERNAL
46
bool
readable_;
47
bool
writeable_;
48
#endif
49
protected
:
50
Container
(
kernel::Model
*m, std::string name =
"Container %1%"
);
51
52
virtual
std::size_t do_get_contents_hash()
const
= 0;
53
54
public
:
55
//! Get contained particles
56
/** Get a list of all particles contained in this one,
57
given that the input containers are up to date.
58
*/
59
virtual
ParticleIndexes
get_all_possible_indexes()
const
= 0;
60
61
/** Return a hash that can be used to detect when the contents
62
of the container changed. Store the value and then compare
63
against the version next time to detect if it is different. */
64
std::size_t
get_contents_hash
()
const
{
return
do_get_contents_hash(); }
65
66
//! containers don't have outputs
67
ModelObjectsTemp
do_get_outputs
() const
IMP_OVERRIDE
{
68
return
ModelObjectsTemp
();
69
}
70
71
/** True if the container's contents are not independent from one
72
another, and so it cannot be decomposed into a sum of terms.
73
Examples include connectivity.*/
74
virtual
bool
get_is_decomposable
()
const
{
return
true
; }
75
76
#if !defined(IMP_DOXYGEN)
77
// methods to implement checking for inputs and outputs
78
void
validate_readable()
const
;
79
void
validate_writable()
const
;
80
void
set_is_readable(
bool
tf);
81
void
set_is_writable(
bool
tf);
82
#endif
83
84
IMP_REF_COUNTED_DESTRUCTOR
(
Container
);
85
};
86
87
IMPKERNEL_END_NAMESPACE
88
89
#endif
/* IMPKERNEL_CONTAINER_BASE_H */
IMP::kernel::Container::get_contents_hash
std::size_t get_contents_hash() const
Definition:
kernel/container_base.h:64
particle_index.h
Various general useful functions for IMP.
ref_counted_macros.h
Various general useful macros for IMP.
IMP::kernel::ModelObjectsTemp
IMP::base::Vector< IMP::base::WeakPointer< kernel::ModelObject > > ModelObjectsTemp
Definition:
kernel/base_types.h:82
base_types.h
Basic types used by IMP.
IMP_REF_COUNTED_DESTRUCTOR
#define IMP_REF_COUNTED_DESTRUCTOR(Name)
Ref counted objects should have private destructors.
Definition:
ref_counted_macros.h:60
IMP::base::Vector< ParticleIndex >
IMP::Container
IMP::kernel::Container Container
Definition:
kernel/doxygen.h:31
IMP::kernel::Container::get_is_decomposable
virtual bool get_is_decomposable() const
Definition:
kernel/container_base.h:74
ModelObject.h
Single variable function.
IMP::kernel::Container
Abstract class for containers of particles.
Definition:
kernel/container_base.h:44
IMP::Model
IMP::kernel::Model Model
Definition:
kernel/doxygen.h:67
utility_macros.h
Various general useful macros for IMP.
WeakPointer.h
A nullptr-initialized pointer to an Object.
Object.h
A shared base class to help in debugging and things.
IMP::Particle
IMP::kernel::Particle Particle
Definition:
kernel/doxygen.h:100
IMP::kernel::ModelObject
Definition:
kernel/ModelObject.h:24
IMP_OVERRIDE
#define IMP_OVERRIDE
Cause a compile error if this method does not override a parent method.
Definition:
compiler_macros.h:75
IMP::kernel::Model
Class for storing model, its restraints, constraints, and particles.
Definition:
kernel/Model.h:73
IMP::kernel::Container::do_get_outputs
ModelObjectsTemp do_get_outputs() const
containers don't have outputs
Definition:
kernel/container_base.h:67