TypeInfo.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef _TYPEINFO_H_
00023 #define _TYPEINFO_H_
00024
00025
00026
00027 #include "StaticBool.hxx"
00028
00029 namespace CLAM {
00030 bool SameType(const std::type_info & type1, const std::type_info & type2);
00031
00032 class DefaultTypeInfo {
00033 public:
00034 typedef StaticFalse StorableAsLeaf;
00035 typedef StaticFalse IsComponent;
00036 typedef StaticFalse IsIterable;
00037 };
00038
00040 class BasicCTypeInfo : public DefaultTypeInfo {
00041 public:
00042 typedef StaticTrue StorableAsLeaf;
00043 };
00044
00045 class ContainerTypeInfo : public DefaultTypeInfo {
00046 public:
00047 typedef StaticTrue IsIterable;
00048 };
00049
00050
00051 template <typename T> class TypeInfo : public DefaultTypeInfo {};
00052
00053
00054 #define CLAM_TYPEINFOGROUP(GROUP, TYPE) \
00055 template <> class TypeInfo< TYPE > : public GROUP {};
00056
00057 CLAM_TYPEINFOGROUP(BasicCTypeInfo, char);
00058 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned char);
00059 CLAM_TYPEINFOGROUP(BasicCTypeInfo, signed char);
00060 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const char);
00061 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const unsigned char);
00062 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const signed char);
00063 CLAM_TYPEINFOGROUP(BasicCTypeInfo, char *);
00064 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned char *);
00065 CLAM_TYPEINFOGROUP(BasicCTypeInfo, signed char *);
00066 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const char *);
00067 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const unsigned char *);
00068 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const signed char *);
00069
00070 CLAM_TYPEINFOGROUP(BasicCTypeInfo, void *);
00071 CLAM_TYPEINFOGROUP(BasicCTypeInfo, short int);
00072 CLAM_TYPEINFOGROUP(BasicCTypeInfo, short unsigned int);
00073 CLAM_TYPEINFOGROUP(BasicCTypeInfo, int);
00074 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned int);
00075 CLAM_TYPEINFOGROUP(BasicCTypeInfo, long);
00076 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned long);
00077 CLAM_TYPEINFOGROUP(BasicCTypeInfo, bool);
00078 CLAM_TYPEINFOGROUP(BasicCTypeInfo, double);
00079 CLAM_TYPEINFOGROUP(BasicCTypeInfo, float);
00080
00081 }
00082
00083
00084 #endif//_TYPEINFO_H_
00085
00086