8 #ifndef IMPBASE_INDEX_H
9 #define IMPBASE_INDEX_H
11 #include <IMP/base/base_config.h>
17 IMPBASE_BEGIN_NAMESPACE
30 explicit Index(
int i) : i_(i) {}
48 inline unsigned int get_as_unsigned_int(
Index<Tag> i) {
52 inline Index<Tag> get_invalid_index() {
53 return Index<Tag>(-1);
58 template <
class Tag,
class T>
63 IndexVector(
unsigned int sz,
const T &t = T()) :
P(sz, t) {}
66 return P::operator[](get_as_unsigned_int(i)));
69 template <
class Tag,
class Container,
class T>
71 if (v.size() <= get_as_unsigned_int(i)) {
72 v.resize(get_as_unsigned_int(i) + 1, default_value);
Ints get_index(const kernel::ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Various general useful macros for IMP.
#define IMP_HASHABLE_INLINE(name, hashret)
#define IMP_USAGE_CHECK(expr, message)
A runtime test for incorrect usage of a class or method.
Abstract class for containers of particles.
A class for storing lists of IMP items.
#define IMP_COMPARISONS_1(Name, field)
Implement comparison in a class using field as the variable to compare.
Various general useful macros for IMP.
#define IMP_BRACKET(Value, Index, bounds_check_expr, expr)