Chemical Data Processing Library C++ API - Version 1.1.1
MatchExpressionList.hpp
Go to the documentation of this file.
1 /*
2  * MatchExpressionList.hpp
3  *
4  * This file is part of the Chemical Data Processing Toolkit
5  *
6  * Copyright (C) 2003 Thomas Seidel <thomas.seidel@univie.ac.at>
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Lesser General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * Lesser General Public License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public License
19  * along with this library; see the file COPYING. If not, write to
20  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23 
29 #ifndef CDPL_CHEM_MATCHEXPRESSIONLIST_HPP
30 #define CDPL_CHEM_MATCHEXPRESSIONLIST_HPP
31 
32 #include <algorithm>
33 #include <memory>
34 #include <functional>
35 
38 
39 
40 namespace CDPL
41 {
42 
43  namespace Chem
44  {
45 
58  template <typename ObjType1, typename ObjType2 = void>
59  class MatchExpressionList : public MatchExpression<ObjType1, ObjType2>,
60  public Util::IndirectArray<MatchExpression<ObjType1, ObjType2> >
61  {
62 
63  public:
67  typedef std::shared_ptr<MatchExpressionList> SharedPointer;
68 
76 
77  private:
78  const char* getClassName() const
79  {
80  return "MatchExpressionList";
81  }
82  };
83  } // namespace Chem
84 } // namespace CDPL
85 
86 
87 // Implementation
88 
89 template <typename ObjType1, typename ObjType2>
91 {
92  return (std::find_if(this->getElementsBegin(), this->getElementsEnd(),
93  std::bind(&MatchExpression<ObjType1, ObjType2>::requiresAtomBondMapping, std::placeholders::_1)) !=
94  this->getElementsEnd());
95 }
96 
97 #endif // CDPL_CHEM_MATCHEXPRESSIONLIST_HPP
CDPL::Chem::MatchExpressionList::requiresAtomBondMapping
bool requiresAtomBondMapping() const
Tells whether the expression list requires a reevaluation after a query to target object mapping cand...
Definition: MatchExpressionList.hpp:90
CDPL::Util::IndirectArray
A dynamic array class for the storage of object pointers with an indirected query interface.
Definition: IndirectArray.hpp:68
CDPL::Chem::MatchExpression
A generic boolean expression interface for the implementation of query/target object equivalence test...
Definition: MatchExpression.hpp:75
CDPL::Chem::MatchExpressionList
A container for the storage and evaluation of logical match expression lists.
Definition: MatchExpressionList.hpp:61
MatchExpression.hpp
Definition of the class CDPL::Chem::MatchExpression.
CDPL
The namespace of the Chemical Data Processing Library.
CDPL::Chem::MatchExpressionList::SharedPointer
std::shared_ptr< MatchExpressionList > SharedPointer
A reference-counted smart pointer [SHPTR] for dynamically allocated MatchExpressionList instances.
Definition: MatchExpressionList.hpp:67
IndirectArray.hpp
Definition of the class CDPL::Util::IndirectArray.