rasdaman complete source
database.hh
Go to the documentation of this file.
1 /*
2 * This file is part of rasdaman community.
3 *
4 * Rasdaman community is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * Rasdaman community is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
16 *
17 * Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
18 rasdaman GmbH.
19 *
20 * For more information please see <http://www.rasdaman.org>
21 * or contact Peter Baumann via <baumann@rasdaman.com>.
22 /
33 #ifndef _D_DATABASE_
34 #define _D_DATABASE_
35 
36 #include "raslib/rminit.hh"
37 #include "raslib/error.hh"
38 #include "rasodmg/object.hh"
39 #include "raslib/mddtypes.hh"
40 
41 // forward declarations
42 class r_Object;
43 class r_Transaction;
44 class ClientComm;
45 class r_Ref_Any;
46 
47 //@ManMemo: Module: {\bf rasodmg}
48 
49 /*@Doc:
50 
51  A database object must be instantiated and opened before
52  starting any transaction which uses the database, and closed
53  after ending these transactions.
54 
55 */
56 
60 class r_Database
61 {
62 public:
64  enum access_status { not_open, read_write, read_only, exclusive };
65 
67  enum type_schema
68  {
69  CELL = 3,
70  MARRAY = 2,
71  COLLECTION = 1
72  };
73 
75  r_Database();
76 
78  r_Database( const char* name ) throw(r_Error);
85  ~r_Database();
87 
89  void open( const char* database_name, access_status status = read_write )
90  throw( r_Error );
107  void close();
109 
111  void create( const char* name ) throw( r_Error );
120  void destroy( const char* name ) throw( r_Error );
130  void set_servername( const char* name, int port = RASMGRPORT) throw(r_Error);
137  void set_useridentification( const char* name, const char *plain_pass ) throw(r_Error);
145  inline access_status get_status() const;
147 
149  void set_object_name( r_Object& obj, const char* name ) throw(r_Error);
159  r_Ref_Any lookup_object( const char* name ) const
161  throw( r_Error );
176  r_Ref_Any lookup_object( const r_OId& oid ) const
178  throw( r_Error );
193  r_Type* get_type_schema(const char* typeName, type_schema typetype) throw (r_Error);
210  void set_transfer_format( r_Data_Format format, const char *formatParams=NULL ) throw( r_Error );
225  void set_storage_format( r_Data_Format format, const char *formatParams=NULL) throw( r_Error );
232  static r_Database* actual_database;
234 
235 
236  //@Man: Methods for internal use only:
238  const r_OId get_new_oid( unsigned short objType ) const throw(r_Error);
241 
242 
243 
244  // creates an empty MDD collection on the server
245  void insertColl( const char* collName, const char* typeName, const r_OId& oid ) throw( r_Error );
246 
248  void removeObjFromColl( const char* name, const r_OId& oid ) throw ( r_Error );
249 
250  ClientComm* getComm();
251 private:
253  ClientComm* communication;
254 
256  access_status db_status;
257 
259  char* rasmgrName;
260 
262  int rasmgrPort;
263 
265  char* userName;
266 
268  char* plainPass;
269 };
270 
271 #include "rasodmg/database.icc"
272 #include "rasodmg/ref.hh"
273 
274 #endif
Definition: raslib/type.hh:56
#define MARRAY
Definition: oql.h:255
#define COLLECTION
Definition: oql.h:289
const int RASMGRPORT
Definition: rminit.hh:59