CLAM-Development
1.1
|
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 00031 class DefaultTypeInfo { 00032 public: 00033 typedef StaticFalse StorableAsLeaf; 00034 typedef StaticFalse IsComponent; 00035 typedef StaticFalse IsIterable; 00036 }; 00037 00039 class BasicCTypeInfo : public DefaultTypeInfo { 00040 public: 00041 typedef StaticTrue StorableAsLeaf; 00042 }; 00043 00044 class ContainerTypeInfo : public DefaultTypeInfo { 00045 public: 00046 typedef StaticTrue IsIterable; 00047 }; 00048 00049 // Default TypeInfo definition 00050 template <typename T> class TypeInfo : public DefaultTypeInfo {}; 00051 00052 // A short for defining a class belonging to a TypeInfo group 00053 #define CLAM_TYPEINFOGROUP(GROUP, TYPE) \ 00054 template <> class TypeInfo< TYPE > : public GROUP {}; 00055 00056 CLAM_TYPEINFOGROUP(BasicCTypeInfo, char); 00057 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned char); 00058 CLAM_TYPEINFOGROUP(BasicCTypeInfo, signed char); 00059 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const char); 00060 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const unsigned char); 00061 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const signed char); 00062 CLAM_TYPEINFOGROUP(BasicCTypeInfo, char *); 00063 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned char *); 00064 CLAM_TYPEINFOGROUP(BasicCTypeInfo, signed char *); 00065 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const char *); 00066 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const unsigned char *); 00067 CLAM_TYPEINFOGROUP(BasicCTypeInfo, const signed char *); 00068 00069 CLAM_TYPEINFOGROUP(BasicCTypeInfo, void *); 00070 CLAM_TYPEINFOGROUP(BasicCTypeInfo, short int); 00071 CLAM_TYPEINFOGROUP(BasicCTypeInfo, short unsigned int); 00072 CLAM_TYPEINFOGROUP(BasicCTypeInfo, int); 00073 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned int); 00074 CLAM_TYPEINFOGROUP(BasicCTypeInfo, long); 00075 CLAM_TYPEINFOGROUP(BasicCTypeInfo, unsigned long); 00076 CLAM_TYPEINFOGROUP(BasicCTypeInfo, bool); 00077 CLAM_TYPEINFOGROUP(BasicCTypeInfo, double); 00078 CLAM_TYPEINFOGROUP(BasicCTypeInfo, float); 00079 00080 } 00081 00082 00083 #endif//_TYPEINFO_H_ 00084 00085