1 // 2 // HtVectorGeneric.cc 3 // 4 // HtVectorGeneric: A Vector class which holds objects of type GType. 5 // (A vector is an array that can expand as necessary) 6 // This class is very similar in interface to the List class 7 // 8 // Part of the ht://Dig package <http://www.htdig.org/> 9 // Copyright (c) 1999-2004 The ht://Dig Group 10 // For copyright details, see the file COPYING in your distribution 11 // or the GNU Library General Public License (LGPL) version 2 or later 12 // <http://www.gnu.org/copyleft/lgpl.html> 13 // 14 // $Id: HtVectorGeneric.cc,v 1.5 2004/05/28 13:15:21 lha Exp $ 15 // 16 17 #ifdef HAVE_CONFIG_H 18 #include "htconfig.h" 19 #endif /* HAVE_CONFIG_H */ 20 21 #include "HtVector_int.h" 22 #define GType int 23 #define HtVectorGType HtVector_int 24 #include "HtVectorGenericCode.h" 25 26 27 #define GType char 28 #define HtVectorGType HtVector_char 29 #include "HtVectorGeneric.h" 30 #define GType char 31 #define HtVectorGType HtVector_char 32 #include "HtVectorGenericCode.h" 33 34 #include"HtVector_String.h" 35 #define GType String 36 #define HtVectorGType HtVector_String 37 #include "HtVectorGenericCode.h" 38 39 40 #define GType double 41 #define HtVectorGType HtVector_double 42 #include "HtVectorGeneric.h" 43 #define GType double 44 #define HtVectorGType HtVector_double 45 #include "HtVectorGenericCode.h" 46 47 #include<stdio.h> 48 49 // this is just to check if it compiles ok 50 51 class ZOZO 52 { 53 int a,b,c; 54 public: show()55 void show(){printf("ZOZO SHOW:%d %d %d\n",a,b,c);} ZOZO()56 ZOZO() 57 { 58 a=1; 59 b=2; 60 c=3; 61 } 62 }; 63 64 65 #define HTVECTORGENERIC_NOTCOMPARABLE 66 #define GType ZOZO 67 #define HtVectorGType HtVector_ZOZO 68 #include "HtVectorGeneric.h" 69 #define HTVECTORGENERIC_NOTCOMPARABLE 70 #define GType ZOZO 71 #define HtVectorGType HtVector_ZOZO 72 #include "HtVectorGenericCode.h" 73 74 void test_HtVectorGeneric()75test_HtVectorGeneric() 76 { 77 HtVector_int intv; 78 HtVector_char charv; 79 HtVector_ZOZO vz; 80 ZOZO zz; 81 vz.push_back(zz); 82 vz.push_back(zz); 83 vz.push_back(zz); 84 85 int i; 86 for(i=0;i<vz.size();i++) 87 { 88 vz[i].show(); 89 } 90 } 91 92