| [6e97e5] | 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 |  | 
|---|
| [56f73b] | 11 | // include config.h | 
|---|
|  | 12 | #ifdef HAVE_CONFIG_H | 
|---|
|  | 13 | #include <config.h> | 
|---|
|  | 14 | #endif | 
|---|
|  | 15 |  | 
|---|
|  | 16 |  | 
|---|
| [6e97e5] | 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 |  | 
|---|
|  | 28 | template<class _Target, | 
|---|
|  | 29 | class _Container> | 
|---|
|  | 30 | class DescriptorBase_impl; | 
|---|
|  | 31 |  | 
|---|
|  | 32 |  | 
|---|
|  | 33 | template<class _Target, | 
|---|
|  | 34 | class _Container> | 
|---|
|  | 35 | class SelectiveIterator; | 
|---|
|  | 36 |  | 
|---|
| [feb5d0] | 37 | template<class _Target, | 
|---|
|  | 38 | class _Container> | 
|---|
|  | 39 | class SelectiveConstIterator; | 
|---|
|  | 40 |  | 
|---|
| [6e97e5] | 41 | template<class _Target, | 
|---|
|  | 42 | class _Container> | 
|---|
|  | 43 | class DescriptorBase | 
|---|
|  | 44 | { | 
|---|
|  | 45 | friend class DescriptorBase_impl<_Target,_Container>; | 
|---|
|  | 46 | friend class SelectiveIterator<_Target,_Container>; | 
|---|
| [feb5d0] | 47 | friend class SelectiveConstIterator<_Target,_Container>; | 
|---|
| [6e97e5] | 48 |  | 
|---|
|  | 49 |  | 
|---|
|  | 50 | // expose the type of this descriptor to the public | 
|---|
|  | 51 | public: | 
|---|
|  | 52 | typedef _Target     Target; | 
|---|
| [795c0f] | 53 | typedef const _Target     ConstTarget; | 
|---|
| [6e97e5] | 54 | typedef std::vector<Target> TargetVec; | 
|---|
| [795c0f] | 55 | typedef std::vector<ConstTarget> ConstTargetVec; | 
|---|
| [6e97e5] | 56 |  | 
|---|
|  | 57 | protected: | 
|---|
|  | 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 |  | 
|---|
|  | 65 | public: | 
|---|
|  | 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 |  | 
|---|
| [795c0f] | 79 | /** | 
|---|
|  | 80 | * forward Method to implementation | 
|---|
|  | 81 | */ | 
|---|
|  | 82 | ConstTarget find(Container&) const; | 
|---|
|  | 83 |  | 
|---|
| [6e97e5] | 84 | /** | 
|---|
|  | 85 | * forward Method to implementation | 
|---|
|  | 86 | */ | 
|---|
|  | 87 | TargetVec findAll(Container&); | 
|---|
|  | 88 |  | 
|---|
| [795c0f] | 89 | /** | 
|---|
|  | 90 | * forward Method to implementation | 
|---|
|  | 91 | */ | 
|---|
|  | 92 | ConstTargetVec findAll(Container&) const; | 
|---|
| [6e97e5] | 93 |  | 
|---|
|  | 94 | private: | 
|---|
|  | 95 | impl_ptr theImpl; | 
|---|
|  | 96 | }; | 
|---|
|  | 97 |  | 
|---|
|  | 98 | template<class _Target, | 
|---|
|  | 99 | class _Container> | 
|---|
|  | 100 | DescriptorBase<_Target,_Container> AllX(); | 
|---|
|  | 101 |  | 
|---|
|  | 102 | template<class _Target, | 
|---|
|  | 103 | class _Container> | 
|---|
|  | 104 | DescriptorBase<_Target,_Container> NoX(); | 
|---|
|  | 105 |  | 
|---|
|  | 106 | template<class _Target, | 
|---|
|  | 107 | class _Container> | 
|---|
|  | 108 | DescriptorBase<_Target,_Container> | 
|---|
|  | 109 | operator&&(DescriptorBase<_Target,_Container>&, | 
|---|
|  | 110 | DescriptorBase<_Target,_Container>&); | 
|---|
|  | 111 |  | 
|---|
|  | 112 | template<class _Target, | 
|---|
|  | 113 | class _Container> | 
|---|
|  | 114 | DescriptorBase<_Target,_Container> | 
|---|
|  | 115 | operator||(DescriptorBase<_Target,_Container>&, | 
|---|
|  | 116 | DescriptorBase<_Target,_Container>&); | 
|---|
|  | 117 |  | 
|---|
|  | 118 | template<class _Target, | 
|---|
|  | 119 | class _Container> | 
|---|
|  | 120 | DescriptorBase<_Target,_Container> | 
|---|
|  | 121 | operator!(DescriptorBase<_Target,_Container>&); | 
|---|
|  | 122 |  | 
|---|
|  | 123 | #endif /* DESCRIPTORBASE_HPP_ */ | 
|---|