00001 //****************************************************
00002 // April, 1993, University of Illinois
00003 // Copyright (C) 1993, 1994 Tianlin Wang
00004 /* Copyright (C) 1994-2003 Matvec Development Team.
00005
00006 This program is free software; you can redistribute it and/or
00007 modify it under the terms of the GNU Library General Public
00008 License as published by the Free Software Foundation; either
00009 version 2 of the License, or (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 GNU
00014 Library General Public License for more details.
00015
00016 You should have received a copy of the GNU Library General Public
00017 License along with this library; if not, write to the Free
00018 Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
00019 MA 02111-1307, USA
00020 */
00021
00022 #ifndef MATVEC_FIELDSTRUCT_H
00023 #define MATVEC_FIELDSTRUCT_H
00024
00025 #include <string>
00026
00027 namespace matvec {
00028 /*!
00029 \class FieldStruct fieldstruct.h
00030 \brief a structure for a data column
00031
00032 \sa Field Data
00033 */
00034
00035 class FieldStruct {
00036 protected:
00037 char mytype,myclassi; // myclassi='I','T','C','U','P','N','F'(default)
00038 unsigned mynlevel, myindex,mynmiss; // mytype = 'S','I', 'F'(default)
00039 double mymean, mystd;
00040
00041 std::string myname; // myindex = field_id - 1
00042
00043 void copyfrom(const FieldStruct& A);
00044
00045 public:
00046
00047 FieldStruct(void);
00048 FieldStruct(const FieldStruct& A); // copy constructor
00049 ~FieldStruct(void) {;}
00050
00051 const FieldStruct& operator=(const FieldStruct& A);
00052
00053 void index(const unsigned k) {myindex = k;}
00054 void nlevel(const unsigned k) {mynlevel = k;}
00055 void nmiss(const unsigned k) {mynmiss = k;}
00056 void mean(const double x) {mymean = x;}
00057 void std(const double x) {mystd = x;}
00058 void count_miss(const int k) {mynmiss += k;}
00059 void classi(const char c) {myclassi = c;}
00060 void type(const char c) {mytype = c;}
00061 void name(const std::string &n) {myname = n;}
00062
00063 unsigned index(void) const {return myindex;}
00064 unsigned nlevel(void) const {return mynlevel;}
00065 unsigned nmiss(void) const {return mynmiss;}
00066 double mean(void) const {return mymean;}
00067 double std(void) const {return mystd;}
00068 char classi(void) const {return myclassi;}
00069 char type(void) const {return mytype;}
00070 const std::string name(void) const {return myname;}
00071
00072 };
00073
00074 inline FieldStruct::FieldStruct(void)
00075 { mytype='F'; myclassi='F'; mynlevel=0; myindex=0; mynmiss=0; }
00076
00077 extern int fieldindex(const std::string &fw,const FieldStruct* field_vec,
00078 const unsigned n);
00079 }
00080 #endif
1.2.16