00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_VECTORBIT_HPP
00017 #define TORC_GENERIC_OM_VECTORBIT_HPP
00018
00019 #include "torc/generic/om/DumpRestoreConfig.hpp"
00020
00021 #include <vector>
00022
00023 #ifdef GENOM_SERIALIZATION
00024 #include <boost/serialization/access.hpp>
00025 #include <boost/serialization/base_object.hpp>
00026 #include <boost/serialization/vector.hpp>
00027 #endif //GENOM_SERIALIZATION
00028
00029 #include "torc/generic/om/Composite.hpp"
00030 #include "torc/generic/om/CompositionType.hpp"
00031 #include "torc/generic/util/Error.hpp"
00032
00033
00034 namespace torc {
00035
00036 namespace generic {
00037
00038
00039
00040
00041
00042
00043 template<typename _Type>
00044 class VectorBit : public virtual Composite<_Type>
00045 {
00046 #ifdef GENOM_SERIALIZATION
00047 friend class boost::serialization::access;
00048 #endif //GENOM_SERIALIZATION
00049
00050 public:
00051 typedef _Type Type;
00052 typedef Composite<Type> BaseType;
00053 typedef typename BaseType::List List;
00054 typedef typename BaseType::Pointer Pointer;
00055 typedef typename BaseType::SizeType SizeType;
00056
00057
00058
00059
00060
00061
00062 virtual CompositionType
00063 getCompositionType() const throw();
00064
00065
00066
00067
00068
00069 virtual SizeType
00070 getSize() const throw();
00071
00072
00073
00074
00075
00076
00077 virtual void
00078 getChildren( List &outChildren ) const throw(Error);
00079
00080
00081
00082
00083
00084
00085
00086
00087 virtual const Pointer
00088 get(const std::vector<SizeType> &inIndices) const throw(Error);
00089
00090
00091
00092
00093
00094
00095 inline const std::vector<SizeType> &
00096 getIndices() const throw();
00097
00098
00099
00100
00101
00102
00103 void
00104 setIndices(const std::vector<SizeType> & inSource) throw();
00105
00106
00107 inline SizeType
00108 getAbsoluteIndex() const throw();
00109
00110 void
00111 setAbsoluteIndex( SizeType inSource ) throw();
00112
00113 protected:
00114 VectorBit();
00115
00116 public:
00117 virtual
00118 ~VectorBit() throw();
00119
00120 private:
00121 #ifdef GENOM_SERIALIZATION
00122 template<class Archive> void
00123 serialize( Archive &ar, unsigned int );
00124 #endif //GENOM_SERIALIZATION
00125
00126 std::vector<SizeType> mIndices;
00127 SizeType mAbsoluteIndex;
00128
00129 VectorBit(const VectorBit<_Type> & source) throw();
00130 VectorBit<_Type> &
00131 operator=(const VectorBit<_Type> & source) throw();
00132
00133 };
00134
00135
00136
00137
00138
00139 template<typename _Type>
00140 CompositionType
00141 VectorBit<_Type>::getCompositionType() const throw() {
00142 return eCompositionTypeVectorBit;
00143 }
00144
00145
00146
00147
00148
00149 template<typename _Type>
00150 typename VectorBit<_Type>::SizeType
00151 VectorBit<_Type>::getSize() const throw()
00152 {
00153 return 1;
00154 }
00155
00156
00157
00158
00159
00160
00161 template<typename _Type>
00162 void
00163 VectorBit<_Type>::getChildren(
00164 typename VectorBit<_Type>::List &outChildren ) const throw(Error) {
00165 return;
00166 }
00167
00168
00169
00170
00171
00172
00173
00174
00175 template<typename _Type>
00176 const typename VectorBit<_Type>::Pointer
00177 VectorBit<_Type>::get(
00178 const std::vector<typename VectorBit<_Type>::SizeType> & indices) const throw(Error) {
00179 return Pointer();
00180 }
00181
00182
00183
00184
00185
00186
00187 template<typename _Type>
00188 inline const std::vector<typename VectorBit<_Type>::SizeType> &
00189 VectorBit<_Type>::getIndices() const throw() {
00190 return mIndices;
00191 }
00192
00193
00194
00195
00196
00197
00198 template<typename _Type>
00199 void
00200 VectorBit<_Type>::setIndices(
00201 const std::vector<SizeType> & inSource) throw() {
00202 mIndices = inSource;
00203 }
00204
00205 template<typename _Type>
00206 inline typename VectorBit<_Type>::SizeType
00207 VectorBit<_Type>::getAbsoluteIndex() const throw() {
00208 return mAbsoluteIndex;
00209 }
00210
00211 template<typename _Type>
00212 void
00213 VectorBit<_Type>::setAbsoluteIndex( SizeType inSource ) throw() {
00214 mAbsoluteIndex = inSource;
00215 }
00216
00217 template<typename _Type>
00218 VectorBit<_Type>::VectorBit()
00219 :BaseType(),
00220 mIndices() {
00221 }
00222
00223 template<typename _Type>
00224 VectorBit<_Type>::~VectorBit() throw() {
00225 }
00226 #ifdef GENOM_SERIALIZATION
00227 template<typename _Type>
00228 template<class Archive> void
00229 VectorBit<_Type>::serialize( Archive &ar, unsigned int ) {
00230 ar & boost::serialization::base_object< Composite<_Type> >( *this );
00231 ar & mIndices;
00232 ar & mAbsoluteIndex;
00233 }
00234 #endif //GENOM_SERIALIZATION
00235
00236
00237
00238 }
00239
00240 }
00241 #endif // TORC_GENERIC_OM_VECTORBIT_HPP