cartodata  5.1.2
doi.h
Go to the documentation of this file.
1 /* This software and supporting documentation are distributed by
2  * Institut Federatif de Recherche 49
3  * CEA/NeuroSpin, Batiment 145,
4  * 91191 Gif-sur-Yvette cedex
5  * France
6  *
7  * This software is governed by the CeCILL-B license under
8  * French law and abiding by the rules of distribution of free software.
9  * You can use, modify and/or redistribute the software under the
10  * terms of the CeCILL-B license as circulated by CEA, CNRS
11  * and INRIA at the following URL "http://www.cecill.info".
12  *
13  * As a counterpart to the access to the source code and rights to copy,
14  * modify and redistribute granted by the license, users are provided only
15  * with a limited warranty and the software's author, the holder of the
16  * economic rights, and the successive licensors have only limited
17  * liability.
18  *
19  * In this respect, the user's attention is drawn to the risks associated
20  * with loading, using, modifying and/or developing or reproducing the
21  * software by the user in light of its specific status of free software,
22  * that may mean that it is complicated to manipulate, and that also
23  * therefore means that it is reserved for developers and experienced
24  * professionals having in-depth computer knowledge. Users are therefore
25  * encouraged to load and test the software's suitability as regards their
26  * requirements in conditions enabling the security of their systems and/or
27  * data to be ensured and, more generally, to use and operate it in the
28  * same conditions as regards security.
29  *
30  * The fact that you are presently reading this means that you have had
31  * knowledge of the CeCILL-B license and that you accept its terms.
32  */
33 
34 #ifndef CARTODATA_ROI_DOI_H
35 #define CARTODATA_ROI_DOI_H
36 
38 #include <cartodata/wip/roi/roi.h>
39 
40 #define DECLARE_VIRTUAL_GENERIC_OBJECT_TYPE( T ) \
41 template <> \
42 struct GenericObjectTypeDeclared< T > \
43 { \
44  static inline void check() {}; \
45 }; \
46 template <> \
47 void DictionaryInterface::setProperty( const std::string &key, \
48  T const &value ); \
49 template <> \
50 bool DictionaryInterface::getProperty( const std::string &key, T &value ) const; \
51 extern template class TypedObject< T >; \
52 extern template class ReferenceObject< T >; \
53 extern template class PointerObject< T >; \
54 extern template \
55 T const &GenericObject::value< T >() const; \
56 extern template \
57 T &GenericObject::value< T >(); \
58 template <> \
59 bool GenericObject::value( T &dest ) const; \
60 template <> \
61 void GenericObject::setValue( T const & x ); \
62 extern template bool DictionaryInterface:: \
63 getProperty( const std::string &, T & ) const; \
64 extern template void DictionaryInterface:: \
65 setProperty( const std::string &, T const & ); \
66 
67 
68 namespace carto {
69 
70 
71  //------------------//
72  // RcptrObject<T> //
73 //------------------//
74 
75 // This class has nthing to do here, it should go in object.h.
76 // It is just for testing without compiling everything.
77 template <typename T>
78 class RcptrObject : public TypedObject<T>
79 {
80 public:
81  inline RcptrObject( T &x );
82  virtual ~RcptrObject();
83  virtual T &getValue();
84 
85  virtual Object clone() const;
86 
87 private:
88 
89  mutable rc_ptr<T> _pvalue;
90 };
91 
92 
93  //--------------------//
94  // RcptrObject<T> //
95 //--------------------//
96 
97 //-----------------------------------------------------------------------------
98 template <typename T>
99 inline RcptrObject<T>::RcptrObject( T &x ) : _pvalue( &x )
100 {
101 }
102 
103 
104  //----------------//
105  // DiscreteDOI //
106 //----------------//
107 
108 class DiscreteDOI : public virtual RCObject, virtual public IterableInterface
109 {
110 public:
111  virtual ~DiscreteDOI();
112 
113  virtual Object objectIterator() const = 0;
114  virtual Object valueAt( const Site &site ) const;
115 
116 };
117 
118 // DECLARE_VIRTUAL_GENERIC_OBJECT_TYPE( DiscreteDOI );
119 
120 #if 0
121 #define T DiscreteDOI
122 template <>
123 struct GenericObjectTypeDeclared< T >
124 {
125  static inline void check() {};
126 };
127 template <>
128 void DictionaryInterface::setProperty( const std::string &key,
129  T const &value );
130 template <>
131 bool DictionaryInterface::getProperty( const std::string &key, T &value ) const;
132 template <>
133 bool GenericObject::value( T &dest ) const;
134 template <>
135 void GenericObject::setValue( T const & x );
136 extern template class TypedObject< T >;
137 extern template class ReferenceObject< T >;
138 extern template class PointerObject< T >;
139 extern template
140 T const &GenericObject::value< T >() const;
141 extern template
142 T &GenericObject::value< T >();
143 extern template
144 bool GenericObject::value( T &dest ) const;
145 extern template
146 void GenericObject::setValue( T const & x );
147 extern template bool DictionaryInterface::
148 getProperty( const std::string &, T & ) const;
149 extern template void DictionaryInterface::
150 setProperty( const std::string &, T const & );
151 #undef T
152 #endif
153 
154 
155  //-------------------//
156  // NumberIterator //
157 //-------------------//
158 
159 class NumberIterator : public virtual RCObject, virtual public IteratorInterface
160 {
161  Object currentValue() const;
162  virtual double currentNumber() const = 0;
163 };
164 
165 // DECLARE_VIRTUAL_GENERIC_OBJECT_TYPE( NumberIterator );
166 
167 
168  //----------------------//
169  // DiscreteNumberDOI //
170 //----------------------//
171 
173 {
174  virtual Object objectIterator() const;
175  virtual Object valueAt( const Site &site ) const;
176  virtual NumberIterator *numberIterator() const = 0;
177  virtual double numberAt( const Site &site ) const;
178 };
179 
180 // DECLARE_VIRTUAL_GENERIC_OBJECT_TYPE( DiscreteNumberDOI );
181 
182 
183 
184 } // namespace carto
185 
186 #endif // ifndef CARTODATA_ROI_DOI_H
virtual bool getProperty(const std::string &key, Object &value) const=0
virtual void setProperty(const std::string &key, Object value)=0
virtual ~DiscreteDOI()
virtual Object objectIterator() const =0
virtual Object valueAt(const Site &site) const
const T & value() const
void setValue(const T &val)
RcptrObject(T &x)
Definition: doi.h:99
virtual T & getValue()
virtual ~RcptrObject()
virtual Object clone() const
static void check(T *x=NULL)