TypeInfo.hxx

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
00003  *                         UNIVERSITAT POMPEU FABRA
00004  *
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef _TYPEINFO_H_
00023 #define _TYPEINFO_H_
00024 
00025 //class StaticTrue {};
00026 //class StaticFalse {};
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         // Default TypeInfo definition
00051         template <typename T> class TypeInfo : public DefaultTypeInfo {};
00052 
00053         // A short for defining a class belonging to a TypeInfo group
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 
Generated by  doxygen 1.6.3