RDKit: SeedSet.h Source File

| RDKit Open-source cheminformatics and machine learning.

Loading...
Searching...
No Matches
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#include <RDGeneral/export.h>
12#pragma once
13#include <map>
14#include <algorithm>
15#include "Seed.h"
16
17namespace RDKit {
18namespace FMCS {
19 class RDKIT_FMCS_EXPORT SeedSet { // sorted by amount of bonds
20 typedef std::list<Seed> ValueSet;
21 ValueSet Seeds;
22 Seed EmptySeed;
23
24 public:
25 typedef Seed Value;
26 typedef ValueSet::iterator iterator;
27 typedef ValueSet::const_iterator const_iterator;
28
29 public:
30 void clear() { Seeds.clear(); }
31 void erase(iterator where) { Seeds.erase(where); }
32 size_t size() {
33 return Seeds.size(); // for statistics only
34 }
35 bool empty() { return Seeds.empty(); }
36 iterator begin() { return Seeds.begin(); }
37 iterator end() { return Seeds.end(); }
38 Value &front() { return Seeds.front(); }
39 const_iterator begin() const { return Seeds.begin(); }
40 const_iterator end() const { return Seeds.end(); }
41 const Value &front() const { return Seeds.front(); }
42
43 Value &push_back(const Value &seed) {
44 Seeds.push_back(seed);
45 return Seeds.back();
46 }
47 Value &add(const Value &seed) {
48 iterator where;
49 for (where = Seeds.begin(); where != Seeds.end();
50 where++) { // find position in sorted list
51 if (where->getNumBonds() < seed.getNumBonds()) {
52 break;
53 }
54 }
55 iterator it = Seeds.insert(where, EmptySeed);
56 Value &val = *it;
57 val.setMoleculeFragment(seed);
58
59 return val;
60 }
61};
62} // namespace FMCS
63} // namespace RDKit
Seed.h
RDKit::FMCS::SeedSet
Definition SeedSet.h:19
RDKit::FMCS::SeedSet::end
iterator end()
Definition SeedSet.h:37
RDKit::FMCS::SeedSet::iterator
ValueSet::iterator iterator
Definition SeedSet.h:26
RDKit::FMCS::SeedSet::add
Value & add(const Value &seed)
Definition SeedSet.h:47
RDKit::FMCS::SeedSet::begin
iterator begin()
Definition SeedSet.h:36
RDKit::FMCS::SeedSet::size
size_t size()
Definition SeedSet.h:32
RDKit::FMCS::SeedSet::Value
Seed Value
Definition SeedSet.h:25
RDKit::FMCS::SeedSet::begin
const_iterator begin() const
Definition SeedSet.h:39
RDKit::FMCS::SeedSet::push_back
Value & push_back(const Value &seed)
Definition SeedSet.h:43
RDKit::FMCS::SeedSet::const_iterator
ValueSet::const_iterator const_iterator
Definition SeedSet.h:27
RDKit::FMCS::SeedSet::front
Value & front()
Definition SeedSet.h:38
RDKit::FMCS::SeedSet::erase
void erase(iterator where)
Definition SeedSet.h:31
RDKit::FMCS::SeedSet::front
const Value & front() const
Definition SeedSet.h:41
RDKit::FMCS::SeedSet::empty
bool empty()
Definition SeedSet.h:35
RDKit::FMCS::SeedSet::clear
void clear()
Definition SeedSet.h:30
RDKit::FMCS::SeedSet::end
const_iterator end() const
Definition SeedSet.h:40
RDKit::FMCS::Seed
Definition Seed.h:61
RDKit::FMCS::Seed::setMoleculeFragment
void setMoleculeFragment(const Seed &src)
Definition Seed.h:102
export.h
RDKIT_FMCS_EXPORT
#define RDKIT_FMCS_EXPORT
Definition export.h:169
RDKit::FMCS
Definition Composition2N.h:13
RDKit
Std stuff.
Definition Abbreviations.h:19