23 std::vector<unsigned> AtomIdx;
24 std::vector<unsigned> BondIdx;
30 std::vector<unsigned>::iterator it =
31 std::lower_bound(AtomIdx.begin(), AtomIdx.end(), i);
32 AtomIdx.insert(it, i);
35 std::vector<unsigned>::iterator it =
36 std::lower_bound(BondIdx.begin(), BondIdx.end(), i);
37 BondIdx.insert(it, i);
41 return AtomIdx.size() == right.AtomIdx.size() &&
42 BondIdx.size() == right.BondIdx.size() &&
43 0 == memcmp(&AtomIdx[0], &right.AtomIdx[0],
44 AtomIdx.size() *
sizeof(unsigned)) &&
45 0 == memcmp(&BondIdx[0], &right.BondIdx[0],
46 BondIdx.size() *
sizeof(unsigned));
50 if (AtomIdx.size() < right.AtomIdx.size())
return true;
51 if (AtomIdx.size() > right.AtomIdx.size())
return false;
53 if (BondIdx.size() < right.BondIdx.size())
return true;
54 if (BondIdx.size() > right.BondIdx.size())
return false;
58 diff = memcmp(&AtomIdx[0], &right.AtomIdx[0],
59 AtomIdx.size() *
sizeof(unsigned));
60 if (diff < 0)
return true;
61 if (diff > 0)
return false;
62 return memcmp(&BondIdx[0], &right.BondIdx[0],
63 BondIdx.size() *
sizeof(unsigned)) < 0;
68 std::map<TKey, TValue> Index;
77 bool find(
const TKey& key, TValue& value)
const {
82 std::map<TKey, TValue>::const_iterator entryit = Index.find(key);
83 if (Index.end() != entryit) value = entryit->second;
84 return Index.end() != entryit;
87 void add(
const TKey& key, TValue found =
true) {
90 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
void add(const TKey &key, TValue found=true)
bool operator<(const TKey &right) const
size_t getNumAtoms() const