00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00020 #ifndef SH_VARIANTFACTORYIMPL_HPP
00021 #define SH_VARIANTFACTORYIMPL_HPP
00022
00023 #include "ShVariant.hpp"
00024 #include "ShVariantFactory.hpp"
00025
00026 namespace SH {
00027
00028 template<typename T, ShDataType DT>
00029 ShVariant* ShDataVariantFactory<T, DT>::generate(int N) const
00030 {
00031 return new ShDataVariant<T, DT>(N);
00032 }
00033
00034 template<typename T, ShDataType DT>
00035 ShVariant* ShDataVariantFactory<T, DT>::generate(std::string s) const
00036 {
00037 return new ShDataVariant<T, DT>(s);
00038 }
00039
00040 template<typename T, ShDataType DT>
00041 ShVariant* ShDataVariantFactory<T, DT>::generate(int N, void *data, bool managed) const
00042 {
00043 return new ShDataVariant<T, DT>(N, data, managed);
00044 }
00045
00046 template<typename T, ShDataType DT>
00047 ShVariant* ShDataVariantFactory<T, DT>::generateZero(int N) const
00048 {
00049 return new ShDataVariant<T, DT>(N);
00050 }
00051
00052 template<typename T, ShDataType DT>
00053 ShVariant* ShDataVariantFactory<T, DT>::generateOne(int N) const
00054 {
00055 return new ShDataVariant<T, DT>(N, ShDataTypeConstant<T, DT>::One);
00056 }
00057
00058 template<typename T, ShDataType DT>
00059 ShDataVariantFactory<T, DT>* ShDataVariantFactory<T, DT>::m_instance = 0;
00060
00061 template<typename T, ShDataType DT>
00062 const ShDataVariantFactory<T, DT>*
00063 ShDataVariantFactory<T, DT>::instance()
00064 {
00065 if(!m_instance) m_instance = new ShDataVariantFactory<T, DT>();
00066 return m_instance;
00067 }
00068
00069 template<typename T, ShDataType DT>
00070 ShDataVariantFactory<T, DT>::ShDataVariantFactory()
00071 {}
00072
00073 }
00074
00075 #endif