00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef TORC_GENERIC_OM_SCALAR_HPP
00017 #define TORC_GENERIC_OM_SCALAR_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 #endif //GENOM_SERIALIZATION
00026
00027 #include "torc/generic/om/Composite.hpp"
00028 #include "torc/generic/om/CompositionType.hpp"
00029 #include "torc/generic/util/Error.hpp"
00030
00031 namespace torc {
00032
00033 namespace generic {
00034
00035
00036
00037
00038 template<typename _Type>
00039 class Scalar : virtual public Composite<_Type>
00040 {
00041 #ifdef GENOM_SERIALIZATION
00042 friend class boost::serialization::access;
00043 #endif //GENOM_SERIALIZATION
00044
00045 public:
00046 typedef typename Composite<_Type>::Type Type;
00047 typedef typename Composite<_Type>::Pointer Pointer;
00048 typedef typename Composite<_Type>::List List;
00049 typedef typename Composite<_Type>::SizeType SizeType;
00050
00051 virtual
00052 ~Scalar() throw();
00053
00054
00055
00056
00057
00058
00059 virtual CompositionType
00060 getCompositionType() const throw();
00061
00062
00063
00064
00065
00066 virtual SizeType
00067 getSize() const throw();
00068
00069
00070
00071
00072
00073
00074
00075
00076 virtual const Pointer
00077 get(const std::vector<SizeType> & indices) const throw(Error);
00078
00079
00080
00081
00082
00083
00084 virtual void
00085 getChildren( List &outChildren ) const throw(Error);
00086
00087 protected:
00088 Scalar();
00089
00090 private:
00091 #ifdef GENOM_SERIALIZATION
00092 template<class Archive> void
00093 serialize( Archive &ar, unsigned int );
00094 #endif //GENOM_SERIALIZATION
00095
00096 Scalar(const Scalar<_Type> & source) throw();
00097 Scalar<_Type> &
00098 operator=(const Scalar<_Type> & source) throw();
00099 };
00100
00101 template<typename _Type>
00102 Scalar<_Type>::~Scalar() throw() {
00103 }
00104
00105
00106
00107
00108
00109
00110
00111 template<typename _Type>
00112 CompositionType
00113 Scalar<_Type>::getCompositionType() const throw() {
00114 return eCompositionTypeScalar;
00115 }
00116
00117
00118
00119
00120
00121 template<typename _Type>
00122 typename Scalar<_Type>::SizeType
00123 Scalar<_Type>::getSize() const throw()
00124 {
00125 return 1;
00126 }
00127
00128
00129
00130
00131
00132
00133
00134
00135 template<typename _Type>
00136 const typename Scalar<_Type>::Pointer
00137 Scalar<_Type>::get(const std::vector<typename Scalar<_Type>::SizeType> & indices) const throw(Error) {
00138 return Pointer();
00139 }
00140
00141
00142
00143
00144
00145
00146 template<typename _Type>
00147 void
00148 Scalar<_Type>::getChildren(
00149 typename Scalar<_Type>::List &outChildren ) const throw(Error) {
00150 return;
00151 }
00152
00153 template<typename _Type>
00154 Scalar<_Type>::Scalar()
00155 :Composite<_Type>() {
00156 }
00157
00158 #ifdef GENOM_SERIALIZATION
00159 template<typename _Type>
00160 template<class Archive> void
00161 Scalar<_Type>::serialize( Archive &ar, unsigned int ) {
00162
00163 }
00164 #endif //GENOM_SERIALIZATION
00165
00166
00167 }
00168
00169 }
00170 #endif // TORC_GENERIC_OM_SCALAR_HPP