source: src/Descriptors/DescriptorBase.hpp

Candidate_v1.6.1
Last change on this file was 795c0f, checked in by Frederik Heber <heber@…>, 9 years ago

World::getAtoms() now has const versions as well.

  • this in turn required to adapt all AtomDescriptors and some fixes, e.g. predicate is now const member and works on const atom ptr.
  • Property mode set to 100644
File size: 2.7 KB
Line 
1/*
2 * DescriptorBase.hpp
3 *
4 * Created on: Mar 12, 2010
5 * Author: crueger
6 */
7
8#ifndef DESCRIPTORBASE_HPP_
9#define DESCRIPTORBASE_HPP_
10
11// include config.h
12#ifdef HAVE_CONFIG_H
13#include <config.h>
14#endif
15
16
17#include <vector>
18#include <boost/shared_ptr.hpp>
19
20/***
21 * Code in this file is not used.
22 *
23 * I was not able to figure out how to factor out the common code for
24 * descriptors and have given up :-( . If somebody else wants to have
25 * another shot just go ahead, but expect a hard ride from here on.
26 */
27
28template<class _Target,
29 class _Container>
30class DescriptorBase_impl;
31
32
33template<class _Target,
34 class _Container>
35class SelectiveIterator;
36
37template<class _Target,
38 class _Container>
39class SelectiveConstIterator;
40
41template<class _Target,
42 class _Container>
43class DescriptorBase
44{
45 friend class DescriptorBase_impl<_Target,_Container>;
46 friend class SelectiveIterator<_Target,_Container>;
47 friend class SelectiveConstIterator<_Target,_Container>;
48
49
50 // expose the type of this descriptor to the public
51public:
52 typedef _Target Target;
53 typedef const _Target ConstTarget;
54 typedef std::vector<Target> TargetVec;
55 typedef std::vector<ConstTarget> ConstTargetVec;
56
57protected:
58 typedef _Container Container;
59 typedef typename Container::iterator iterator;
60
61 typedef DescriptorBase_impl<Target,Container> impl;
62 typedef boost::shared_ptr<impl> impl_ptr;
63
64
65public:
66
67 DescriptorBase();
68 DescriptorBase(const DescriptorBase&);
69 DescriptorBase(impl_ptr);
70 virtual ~DescriptorBase();
71
72 DescriptorBase& operator=(const DescriptorBase&);
73
74 /**
75 * forward Method to implementation
76 */
77 Target find(Container&);
78
79 /**
80 * forward Method to implementation
81 */
82 ConstTarget find(Container&) const;
83
84 /**
85 * forward Method to implementation
86 */
87 TargetVec findAll(Container&);
88
89 /**
90 * forward Method to implementation
91 */
92 ConstTargetVec findAll(Container&) const;
93
94private:
95 impl_ptr theImpl;
96};
97
98template<class _Target,
99 class _Container>
100DescriptorBase<_Target,_Container> AllX();
101
102template<class _Target,
103 class _Container>
104DescriptorBase<_Target,_Container> NoX();
105
106template<class _Target,
107 class _Container>
108DescriptorBase<_Target,_Container>
109 operator&&(DescriptorBase<_Target,_Container>&,
110 DescriptorBase<_Target,_Container>&);
111
112template<class _Target,
113 class _Container>
114DescriptorBase<_Target,_Container>
115 operator||(DescriptorBase<_Target,_Container>&,
116 DescriptorBase<_Target,_Container>&);
117
118template<class _Target,
119 class _Container>
120DescriptorBase<_Target,_Container>
121 operator!(DescriptorBase<_Target,_Container>&);
122
123#endif /* DESCRIPTORBASE_HPP_ */
Note: See TracBrowser for help on using the repository browser.