22 std::vector<unsigned> AtomIdx;
23 std::vector<unsigned> BondIdx;
26 return AtomIdx.size();
29 return BondIdx.size();
33 std::vector<unsigned>::iterator it = std::lower_bound(AtomIdx.begin(), AtomIdx.end(), i);
34 AtomIdx.insert(it, i);
37 std::vector<unsigned>::iterator it = std::lower_bound(BondIdx.begin(), BondIdx.end(), i);
38 BondIdx.insert(it, i);
42 return AtomIdx.size() == right.AtomIdx.size()
43 && BondIdx.size() == right.BondIdx.size()
44 && 0==memcmp(&AtomIdx[0], &right.AtomIdx[0], AtomIdx.size()*
sizeof(unsigned))
45 && 0==memcmp(&BondIdx[0], &right.BondIdx[0], BondIdx.size()*
sizeof(unsigned));
49 if(AtomIdx.size() < right.AtomIdx.size())
51 if(AtomIdx.size() > right.AtomIdx.size())
54 if(BondIdx.size() < right.BondIdx.size())
56 if(BondIdx.size() > right.BondIdx.size())
61 diff = memcmp(&AtomIdx[0], &right.AtomIdx[0], AtomIdx.size()*
sizeof(unsigned));
66 return memcmp(&BondIdx[0], &right.BondIdx[0], BondIdx.size()*
sizeof(unsigned)) < 0;
70 std::map<TKey, TValue> Index;
79 bool find(
const TKey& key, TValue& value)
const {
84 std::map<TKey, TValue>::const_iterator entryit = Index.find(key);
85 if(Index.end() != entryit)
86 value = entryit->second;
87 return Index.end() != entryit;
90 void add(
const TKey& key, TValue found=
true) {
94 Index.insert( std::pair<TKey, bool>(key, found));
size_t getNumBonds() const
size_t getNumAtoms() const
bool operator==(const TKey &right) 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
bool find(const TKey &key, TValue &value) const