22 std::vector<unsigned> AtomIdx;
23 std::vector<unsigned> BondIdx;
29 std::vector<unsigned>::iterator it =
30 std::lower_bound(AtomIdx.begin(), AtomIdx.end(), i);
31 AtomIdx.insert(it, i);
34 std::vector<unsigned>::iterator it =
35 std::lower_bound(BondIdx.begin(), BondIdx.end(), i);
36 BondIdx.insert(it, i);
40 return AtomIdx.size() == right.AtomIdx.size() &&
41 BondIdx.size() == right.BondIdx.size() &&
42 0 == memcmp(&AtomIdx[0], &right.AtomIdx[0],
43 AtomIdx.size() *
sizeof(unsigned)) &&
44 0 == memcmp(&BondIdx[0], &right.BondIdx[0],
45 BondIdx.size() *
sizeof(unsigned));
49 if (AtomIdx.size() < right.AtomIdx.size())
return true;
50 if (AtomIdx.size() > right.AtomIdx.size())
return false;
52 if (BondIdx.size() < right.BondIdx.size())
return true;
53 if (BondIdx.size() > right.BondIdx.size())
return false;
57 diff = memcmp(&AtomIdx[0], &right.AtomIdx[0],
58 AtomIdx.size() *
sizeof(unsigned));
59 if (diff < 0)
return true;
60 if (diff > 0)
return false;
61 return memcmp(&BondIdx[0], &right.BondIdx[0],
62 BondIdx.size() *
sizeof(unsigned)) < 0;
67 std::map<TKey, TValue> Index;
76 bool find(
const TKey& key, TValue& value)
const {
81 std::map<TKey, TValue>::const_iterator entryit = Index.find(key);
82 if (Index.end() != entryit) value = entryit->second;
83 return Index.end() != entryit;
86 void add(
const TKey& key, TValue found =
true) {
89 Index.insert(std::pair<TKey, bool>(key, found));
bool operator==(const TKey &right) const
bool find(const TKey &key, TValue &value) const
size_t getNumBonds() const
Includes a bunch of functionality for handling Atom and Bond queries.
void add(const TKey &key, TValue found=true)
bool operator<(const TKey &right) const
size_t getNumAtoms() const