source: molecuilder/src/Descriptors/AtomDescriptor.hpp@ 3db67e

Last change on this file since 3db67e was a5471c, checked in by Tillmann Crueger <crueger@…>, 16 years ago

Added iterator structure that allows iterating over selected atoms in the World.

  • Property mode set to 100644
File size: 1.5 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
[a5471c]17class World;
[86b917]18class atom;
19
[323177]20// internal implementation, allows assignment, copying etc
21class AtomDescripter_impl;
[86b917]22
[323177]23class AtomDescriptor {
[a5471c]24 // close coupling to the world to allow access
[323177]25 friend atom* World::getAtom(AtomDescriptor descriptor);
26 friend std::vector<atom*> World::getAllAtoms(AtomDescriptor descriptor);
[a5471c]27 friend class World::AtomIterator;
[973c03]28
[323177]29 friend AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
30 friend AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
31 friend AtomDescriptor operator!(const AtomDescriptor &arg);
[86b917]32
33public:
[323177]34 typedef boost::shared_ptr<AtomDescriptor_impl> impl_ptr;
[973c03]35
[323177]36 AtomDescriptor(impl_ptr);
37 AtomDescriptor(const AtomDescriptor&);
38 ~AtomDescriptor();
[86b917]39
[323177]40 AtomDescriptor &operator=(AtomDescriptor &);
[973c03]41
[323177]42protected:
43 atom* find();
44 std::vector<atom*> findAll();
45 impl_ptr get_impl() const;
[973c03]46
47private:
[323177]48 impl_ptr impl;
[973c03]49};
50
[323177]51// Functions to construct actual descriptors
52AtomDescriptor AllAtoms();
53AtomDescriptor NoAtoms();
[973c03]54
55// no true short circuit, but the test of the second descriptor wont be done
[323177]56AtomDescriptor operator&&(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
57AtomDescriptor operator||(const AtomDescriptor &lhs, const AtomDescriptor &rhs);
58AtomDescriptor operator!(const AtomDescriptor &arg);
[973c03]59
[86b917]60#endif /* ATOMDESCRIPTOR_HPP_ */
Note: See TracBrowser for help on using the repository browser.