source: molecuilder/src/Descriptors/AtomDescriptor.hpp@ 120f8b

Last change on this file since 120f8b was 323177, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Rebuilt AtomDescriptors using PIMPL-Idiom and added unittest for descriptors

  • Property mode set to 100644
File size: 1.4 KB
RevLine 
[86b917]1/*
2 * AtomDescriptor.hpp
3 *
4 * Created on: Feb 5, 2010
5 * Author: crueger
6 */
7
8#ifndef ATOMDESCRIPTOR_HPP_
9#define ATOMDESCRIPTOR_HPP_
10
[973c03]11
12#include <vector>
13#include <map>
14#include <boost/shared_ptr.hpp>
[86b917]15#include "World.hpp"
16
17class atom;
18
[323177]19// internal implementation, allows assignment, copying etc
20class AtomDescripter_impl;
[86b917]21
[323177]22class AtomDescriptor {
23 friend atom* World::getAtom(AtomDescriptor descriptor);
24 friend std::vector<atom*> World::getAllAtoms(AtomDescriptor descriptor);
[973c03]25
[323177]26 friend AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
27 friend AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
28 friend AtomDescriptor operator!(const AtomDescriptor &arg);
[86b917]29
30public:
[323177]31 typedef boost::shared_ptr<AtomDescriptor_impl> impl_ptr;
[973c03]32
[323177]33 AtomDescriptor(impl_ptr);
34 AtomDescriptor(const AtomDescriptor&);
35 ~AtomDescriptor();
[86b917]36
[323177]37 AtomDescriptor &operator=(AtomDescriptor &);
[973c03]38
[323177]39protected:
40 atom* find();
41 std::vector<atom*> findAll();
42 impl_ptr get_impl() const;
[973c03]43
44private:
[323177]45 impl_ptr impl;
[973c03]46};
47
[323177]48// Functions to construct actual descriptors
49AtomDescriptor AllAtoms();
50AtomDescriptor NoAtoms();
[973c03]51
52// no true short circuit, but the test of the second descriptor wont be done
[323177]53AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
54AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
55AtomDescriptor operator!(const AtomDescriptor &arg);
[973c03]56
[86b917]57#endif /* ATOMDESCRIPTOR_HPP_ */
Note: See TracBrowser for help on using the repository browser.