RDKit
Open-source cheminformatics and machine learning.
MatchTable.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 #pragma once
11 #include <vector>
12 #include <stdexcept>
13 
14 namespace RDKit {
15  namespace FMCS {
16  template<typename T>
17  class TArray2D { // for scalar value types ! including bool with special STL implementation (no reference to item - bitset used)
18  size_t XSize;
19  size_t YSize;
20  std::vector<T> Data;
21  public:
22  inline TArray2D(size_t cy=0, size_t cx=0) : XSize(cx), YSize(cy), Data(cx*cy) {}
23  inline size_t getXSize()const {
24  return XSize;
25  }
26  inline size_t getYSize()const {
27  return YSize;
28  }
29  inline bool empty ()const {
30  return Data.empty();
31  }
32  inline void clear () {
33  Data.clear();
34  XSize = 0;
35  YSize = 0;
36  }
37  inline void resize(size_t cy, size_t cx) {
38  Data.resize(cx*cy);
39  XSize = cx;
40  YSize = cy;
41  }
42  inline void set(size_t row, size_t col, T val) {
43  Data[row*XSize + col] = val;
44  }
45  inline T at(size_t row, size_t col) {
46  return Data[row*XSize + col];
47  }
48  inline T at(size_t row, size_t col)const {
49  return Data[row*XSize + col];
50  }
51  };
52 
53  typedef TArray2D<bool> MatchTable; // row is index in QueryMolecule
54 
55  }
56 }
TArray2D< bool > MatchTable
Definition: MatchTable.h:53
T at(size_t row, size_t col) const
Definition: MatchTable.h:48
bool empty() const
Definition: MatchTable.h:29
TArray2D(size_t cy=0, size_t cx=0)
Definition: MatchTable.h:22
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:28
size_t getYSize() const
Definition: MatchTable.h:26
size_t getXSize() const
Definition: MatchTable.h:23
void resize(size_t cy, size_t cx)
Definition: MatchTable.h:37
T at(size_t row, size_t col)
Definition: MatchTable.h:45