00001 #ifndef __INSTANTIO_CODEC_H
00002 #define __INSTANTIO_CODEC_H
00003
00004 #ifdef _MSC_VER
00005 # pragma once
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "InstantIODef.h"
00027 #include "BasicCodec.h"
00028 #include "TypeName.h"
00029 #include <string>
00030
00031
00032 namespace InstantIO
00033 {
00034
00035
00036 class BasicOutSlot;
00037 class BasicInSlot;
00038 template <class T> class OutSlot;
00039 template <class T> class InSlot;
00040
00041
00093 template <class T>
00094 class Codec: public BasicCodec
00095 {
00096 public:
00097
00108 inline Codec(const std::string &label, CreateEncoderMethod createEncoderMethod, CreateDecoderMethod createDecoderMethod, const std::string &author = std::string())
00109 : BasicCodec(label, createEncoderMethod, createDecoderMethod, author)
00110 {}
00111
00113 virtual ~Codec() {};
00114
00121 virtual const char *getTypeName() const
00122 { return TypeName<T>::getName(); };
00123
00130 virtual bool sameType(const BasicOutSlot &outSlot) const
00131 { return dynamic_cast<const OutSlot<T>*>(&outSlot) != 0; };
00132
00139 virtual bool sameType(const BasicInSlot &inSlot) const
00140 { return dynamic_cast<const InSlot<T>*>(&inSlot) != 0; };
00141
00142 private:
00143
00145 Codec(const Codec<T> &);
00146
00148 const Codec<T> &operator=(const Codec<T> &);
00149 };
00150
00151
00152 }
00153
00154
00155 #endif // __INSTANTIO_CODEC_H