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);
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
Ints get_index(const kernel::ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
#define IMP_HASHABLE_INLINE(name, hashret)
Base for a simple primitive-like type.
#define IMP_BRACKET(Value, Index, bounds_check_expr, expr)
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Various general useful macros for IMP.
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.