simpleRDBTable.h
00001 #ifndef simpleRDBTable_H
00002 #define simpleRDBTable_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <iostream>
00029
00030 using namespace std;
00031
00032 #include <suplibxx/str.h>
00033 #include <Exception/Exception.h>
00034
00035 #include <rdbxx/RDBColumn.h>
00036 #include <rdbxx/RDB.h>
00037
00047 template< class Type >
00048 class simpleRDBTable : public RDB {
00049
00050 friend ostream& operator << ( ostream& os, simpleRDBTable< Type >& a ) {
00051 a.print( os );
00052 return os;
00053 }
00054
00055 friend ostream& operator << ( ostream& os, simpleRDBTable< Type >* a ) {
00056 a->print( os );
00057 return os;
00058 }
00059
00060 public:
00061
00062 ~simpleRDBTable( );
00063
00064 simpleRDBTable( const string& fname, const int mode,
00065 const char* header[] )
00066 throw( Exception );
00067
00069 static void getData( RDBColumn* rdbcol, string& val ) throw ( Exception );
00070
00072 static void getData( RDBColumn* rdbcol, int& val ) throw ( Exception );
00073
00075 static void getData( RDBColumn* rdbcol, long& val ) throw ( Exception );
00076
00078 static void getData( RDBColumn* rdbcol, double& val ) throw ( Exception );
00079
00080 void print( ostream& os ) const;
00081
00083 Type* readRow( ) throw( Exception );
00084
00085 protected:
00086
00087 const char** rdb_header;
00088
00089 RDBColumn** rdb_column;
00090
00091 private:
00092
00094 simpleRDBTable( ) : rdb_header( NULL ), rdb_column( NULL ) { }
00095
00096
00097 simpleRDBTable< Type >( const simpleRDBTable< Type >& c );
00098
00099
00100 simpleRDBTable< Type >& operator = ( const simpleRDBTable< Type >& rhs );
00101
00102 size_t count_num_args( const char* str[] );
00103
00104 };
00105
00106 #ifndef simpleRDBTable_cc
00107 #include <rdbxx/simpleRDBTable.cc>
00108 #endif
00109
00110 #endif