RDKit: SeedSet.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

SeedSet.h
Go to the documentation of this file.
1 // $Id$
2 //
3 // Copyright (C) 2014 Novartis Institutes for BioMedical Research
4 //
5 // @@ All Rights Reserved @@
6 // This file is part of the RDKit.
7 // The contents are covered by the terms of the BSD license
8 // which is included in the file license.txt, found at the root
9 // of the RDKit source tree.
10 //
11 #pragma once
12 #include <map>
13 #include <algorithm>
14 #include "Seed.h"
15
16 namespace RDKit {
17 namespace FMCS {
18 class 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()) break;
51 iterator it = Seeds.insert(where, EmptySeed);
52 Value& val = *it;
53 val.setMoleculeFragment(seed);
54
55 return val;
56 }
57 };
58 }
59 }
RDKit::FMCS::SeedSet::Value
Seed Value
Definition: SeedSet.h:24
RDKit::FMCS::Seed
Definition: Seed.h:60
RDKit::FMCS::SeedSet::empty
bool empty()
Definition: SeedSet.h:34
RDKit::FMCS::Seed::setMoleculeFragment
void setMoleculeFragment(const Seed &src)
Definition: Seed.h:91
RDKit::FMCS::SeedSet
Definition: SeedSet.h:18
RDKit::FMCS::SeedSet::add
Value & add(const Value &seed)
Definition: SeedSet.h:46
Seed.h
RDKit::FMCS::SeedSet::begin
iterator begin()
Definition: SeedSet.h:35
RDKit::FMCS::SeedSet::erase
void erase(iterator where)
Definition: SeedSet.h:30
RDKit::FMCS::SeedSet::push_back
Value & push_back(const Value &seed)
Definition: SeedSet.h:42
RDKit::FMCS::SeedSet::front
const Value & front() const
Definition: SeedSet.h:40
RDKit::FMCS::Seed::getNumBonds
unsigned getNumBonds() const
Definition: Seed.h:126
RDKit::FMCS::SeedSet::end
iterator end()
Definition: SeedSet.h:36
RDKit::FMCS::SeedSet::size
size_t size()
Definition: SeedSet.h:31
RDKit::FMCS::SeedSet::begin
const_iterator begin() const
Definition: SeedSet.h:38
RDKit::FMCS::SeedSet::front
Value & front()
Definition: SeedSet.h:37
RDKit
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
RDKit::FMCS::SeedSet::clear
void clear()
Definition: SeedSet.h:29
RDKit::FMCS::SeedSet::iterator
ValueSet::iterator iterator
Definition: SeedSet.h:25
RDKit::FMCS::SeedSet::end
const_iterator end() const
Definition: SeedSet.h:39
RDKit::FMCS::SeedSet::const_iterator
ValueSet::const_iterator const_iterator
Definition: SeedSet.h:26