8 #ifndef IMPKERNEL_INDEX_H
9 #define IMPKERNEL_INDEX_H
11 #include <IMP/kernel_config.h>
17 IMPKERNEL_BEGIN_NAMESPACE
28 explicit Index(
int i) : i_(i) {}
46 inline unsigned int get_as_unsigned_int(
Index<Tag> i) {
50 inline Index<Tag> get_invalid_index() {
51 return Index<Tag>(-1);
56 template <
class Tag,
class T>
61 IndexVector(
unsigned int sz,
const T &t = T()) :
P(sz, t) {}
64 return P::operator[](get_as_unsigned_int(i)));
67 template <
class Tag,
class Container,
class T>
69 if (v.size() <= get_as_unsigned_int(i)) {
70 v.resize(get_as_unsigned_int(i) + 1, default_value);
74 IMPKERNEL_END_NAMESPACE
#define IMP_SHOWABLE_INLINE(Name, how_to_show)
Declare the methods needed by an object that can be printed.
#define IMP_HASHABLE_INLINE(name, hashret)
#define IMP_BRACKET(Value, Index, bounds_check_expr, expr)
Implement operator[] and at() for C++, and getitem for Python.
#define IMP_INTERNAL_CHECK(expr, message)
An assertion to check for internal errors in IMP. An IMP::ErrorException will be thrown.
Macros to handle array indexing.
Base for a simple primitive-like type.
Ints get_index(const ParticlesTemp &particles, const Subset &subset, const Subsets &excluded)
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.
Abstract class for containers of particles.
Various general useful macros for IMP.