rdbxx  1.0.7_02
simpleRDBTable.h
1 #ifndef simpleRDBTable_H
2 #define simpleRDBTable_H
3 
4 /* --8<--8<--8<--8<--
5  *
6  * Copyright (C) 2006 Smithsonian Astrophysical Observatory
7  *
8  * This file is part of RDB
9  *
10  * RDB is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU General Public License
12  * as published by the Free Software Foundation; either version 2
13  * of the License, or (at your option) any later version.
14  *
15  * RDB is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the
22  * Free Software Foundation, Inc.
23  * 51 Franklin Street, Fifth Floor
24  * Boston, MA 02110-1301, USA
25  *
26  * -->8-->8-->8-->8-- */
27 
28 #include <iostream>
29 
30 using namespace std;
31 
32 #include <suplibxx/str.h>
33 #include <Exception/Exception.h>
34 
35 #include <rdbxx/RDBColumn.h>
36 #include <rdbxx/RDB.h>
37 
47 template< class Type >
48 class simpleRDBTable : public RDB {
49 
50  friend ostream& operator << ( ostream& os, simpleRDBTable< Type >& a ) {
51  a.print( os );
52  return os;
53  }
54 
55  friend ostream& operator << ( ostream& os, simpleRDBTable< Type >* a ) {
56  a->print( os );
57  return os;
58  }
59 
60 public:
61 
62  ~simpleRDBTable( );
63 
64  simpleRDBTable( const string& fname, const int mode,
65  const char* header[] )
66  ;
67 
69  static void getData( RDBColumn* rdbcol, string& val );
70 
72  static void getData( RDBColumn* rdbcol, int& val );
73 
75  static void getData( RDBColumn* rdbcol, long& val );
76 
78  static void getData( RDBColumn* rdbcol, double& val );
79 
80  void print( ostream& os ) const;
81 
83  Type* readRow( );
84 
85 protected:
86 
87  const char** rdb_header;
88 
89  RDBColumn** rdb_column;
90 
91 private:
92 
94  simpleRDBTable( ) : rdb_header( NULL ), rdb_column( NULL ) { }
95 
96  // Declare but (purposedly) not define
98 
99  // Declare but (purposedly) not define
100  simpleRDBTable< Type >& operator = ( const simpleRDBTable< Type >& rhs );
101 
102  size_t count_num_args( const char* str[] );
103 
104 };
105 
106 #ifndef simpleRDBTable_cc
107 #include <rdbxx/simpleRDBTable.cc>
108 #endif
109 
110 #endif
Provides interface for manipulating RDB tables.
Definition: RDB.h:43
A simple interface to the RDB++ read a row of an rdb table to initialize a class Type.
Provides interface for general column related methods.
Definition: RDBColumn.h:43