rasdaman client API  10.6.3
The Array Analytics Engine: Datacubes at Your Fingertips
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/mddtypes.hh"
37 #include "globals.hh"
38 #include <string>
39 
40 // forward declarations
41 class r_Object;
42 class r_OId;
43 class r_Type;
44 class r_Ref_Any;
45 class ClientComm;
46 
47 //@ManMemo: Module: {\bf rasodmg}
48 
60 {
61 public:
64  {
68  exclusive
69  };
70 
73  {
74  CELL = 3,
75  MARRAY = 2,
76  COLLECTION = 1
77  };
78 
81 
83  explicit r_Database(const char *name);
92 
94  void open(const char *database_name, access_status status = read_write);
114  void close();
115 
117  void create(const char *name);
127  void destroy(const char *name);
137  void set_servername(const char *name, int port = DEFAULT_PORT);
144  void set_useridentification(const char *name, const char *plain_pass);
153 
155  void set_object_name(r_Object &obj, const char *name);
166  r_Ref_Any lookup_object(const char *name) const;
184  r_Ref_Any lookup_object(const r_OId &oid) const;
201  r_Type *get_type_schema(const char *typeName, type_schema typetype);
221  void set_transfer_format(r_Data_Format format, const char *formatParams = NULL);
237  void set_storage_format(r_Data_Format format, const char *formatParams = NULL);
245 
246  //@Man: Methods for internal use only:
248  const r_OId get_new_oid(unsigned short objType) const;
251 
252 
253  // creates an empty MDD collection on the server
254  void insertColl(const char *collName, const char *typeName, const r_OId &oid);
255 
257  void removeObjFromColl(const char *name, const r_OId &oid);
258 
260 
261 private:
263  ClientComm *communication{NULL};
264 
266  access_status db_status{not_open};
267 
269  std::string rasmgrName;
270 
272  int rasmgrPort;
273 
275  std::string userName;
276 
278  std::string plainPass;
279 };
280 
281 #endif
The class ClientComm represents one connection between one client entity (for example an object of cl...
Definition: clientcomm.hh:51
A database object must be instantiated and opened before starting any transaction which uses the data...
Definition: database.hh:60
const r_OId get_new_oid(unsigned short objType) const
ClientComm * getComm()
void set_transfer_format(r_Data_Format format, const char *formatParams=NULL)
The method looks up the type structure with typeName as its name.
~r_Database()
One error situations can occur which raise an exception of type r_Error with one of the following kin...
static r_Database * actual_database
This method sets the storage format to use for MDD created by this client in the RasDaMan database.
Definition: database.hh:244
void set_useridentification(const char *name, const char *plain_pass)
One of error situations can occur will raise an exception of type r_Error with one of the following k...
r_Ref_Any lookup_object(const char *name) const
The method gives the name to the object obj.
void set_object_name(r_Object &obj, const char *name)
give a name to an object (signature is not ODMG conformant because of compiler bug)
void insertColl(const char *collName, const char *typeName, const r_OId &oid)
access_status
possible database states
Definition: database.hh:64
@ read_write
Definition: database.hh:66
@ exclusive
Definition: database.hh:68
@ not_open
Definition: database.hh:65
@ read_only
Definition: database.hh:67
access_status get_status() const
One of error situations can occur will raise an exception of type r_Error with one of the following k...
void removeObjFromColl(const char *name, const r_OId &oid)
removes an object from a collection
void create(const char *name)
create a database with fixed schema RasDaSchema
type_schema
possible types define by symbolic names
Definition: database.hh:73
@ COLLECTION
Definition: database.hh:76
@ MARRAY
Definition: database.hh:75
@ CELL
Definition: database.hh:74
void destroy(const char *name)
This method works only if a server host name has been specified with set_servername().
void set_servername(const char *name, int port=DEFAULT_PORT)
This method works only if a server host name has been specified with set_servername().
r_Database(const char *name)
constructor getting the rasmgr name
void close()
The method opens the database specified with database_name.
void set_storage_format(r_Data_Format format, const char *formatParams=NULL)
The method sets the transfer compression used for the communications of this client with the server.
r_Ref_Any lookup_object(const r_OId &oid) const
The method looks up an object with name.
r_Database()
default constructor
void open(const char *database_name, access_status status=read_write)
open a database
r_Type * get_type_schema(const char *typeName, type_schema typetype)
The method looks up an object with oid.
Class r_OId represents an object identifier.
Definition: oid.hh:39
Through inheritance of this class, the type definer specifies that the subclass is capable of having ...
Definition: object.hh:62
The class r_Ref_Any is defined to support a reference to any type.
Definition: ref.hh:65
This class the superclass for all types in the ODMG conformant representation of the RasDaMan type sy...
Definition: type.hh:51
r_Data_Format
\begin{tabular}{ll} <tt>r_Array</tt> && no compression, row-major memory representation\...
Definition: mddtypes.hh:94