RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
SeedSet.h
Go to the documentation of this file.
1//
2// Copyright (C) 2014 Novartis Institutes for BioMedical Research
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10#include <RDGeneral/export.h>
11#pragma once
12#include <map>
13#include <algorithm>
14#include "Seed.h"
15
16namespace RDKit {
17namespace FMCS {
18class RDKIT_FMCS_EXPORT SeedSet { // sorted by amount of bonds
19 typedef std::list<Seed> ValueSet;
20 ValueSet Seeds;
21 Seed EmptySeed;
22
23 public:
24 typedef Seed Value;
25 typedef ValueSet::iterator iterator;
26 typedef ValueSet::const_iterator const_iterator;
27
28 public:
29 void clear() { Seeds.clear(); }
30 void erase(iterator where) { Seeds.erase(where); }
31 size_t size() {
32 return Seeds.size(); // for statistics only
33 }
34 bool empty() { return Seeds.empty(); }
35 iterator begin() { return Seeds.begin(); }
36 iterator end() { return Seeds.end(); }
37 Value &front() { return Seeds.front(); }
38 const_iterator begin() const { return Seeds.begin(); }
39 const_iterator end() const { return Seeds.end(); }
40 const Value &front() const { return Seeds.front(); }
41
42 Value &push_back(const Value &seed) {
43 Seeds.push_back(seed);
44 return Seeds.back();
45 }
46 Value &add(const Value &seed) {
47 iterator where;
48 for (where = Seeds.begin(); where != Seeds.end();
49 where++) { // find position in sorted list
50 if (where->getNumBonds() < seed.getNumBonds()) {
51 break;
52 }
53 }
54 iterator it = Seeds.insert(where, EmptySeed);
55 Value &val = *it;
56 val.setMoleculeFragment(seed);
57
58 return val;
59 }
60};
61} // namespace FMCS
62} // namespace RDKit
iterator end()
Definition SeedSet.h:36
ValueSet::iterator iterator
Definition SeedSet.h:25
Value & add(const Value &seed)
Definition SeedSet.h:46
iterator begin()
Definition SeedSet.h:35
const_iterator begin() const
Definition SeedSet.h:38
Value & push_back(const Value &seed)
Definition SeedSet.h:42
ValueSet::const_iterator const_iterator
Definition SeedSet.h:26
Value & front()
Definition SeedSet.h:37
void erase(iterator where)
Definition SeedSet.h:30
const Value & front() const
Definition SeedSet.h:40
const_iterator end() const
Definition SeedSet.h:39
void setMoleculeFragment(const Seed &src)
Definition Seed.h:124
#define RDKIT_FMCS_EXPORT
Definition export.h:169
Std stuff.