Database.h
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package MemoryX::CommonStorage
17 * @author Alexey Kozlov ( kozlov at kit dot edu)
18 * @date 2013
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 
24 #pragma once
25 
26 #include <MemoryX/interface/components/CommonStorageInterface.h>
27 
28 #include <mutex>
29 
30 namespace memoryx
31 {
32  /*!
33  * \brief The Database class provides an interface to a database.
34  */
35  class Database :
36  virtual public DatabaseInterface
37  {
38  public:
39  Database(const CommonStorageInterfacePtr& dbConn, const std::string& dbName);
40  ~Database() override;
41 
42  CollectionInterfacePrx requestCollection(const ::std::string& collName, const ::Ice::Current& = Ice::emptyCurrent) override;
43  void releaseCollection(const ::memoryx::CollectionInterfacePrx& coll, const ::Ice::Current& = Ice::emptyCurrent) override;
44  void dropCollection(const ::std::string& collName, const ::Ice::Current& = Ice::emptyCurrent) override;
45 
46  std::string getName(const ::Ice::Current& = Ice::emptyCurrent) override;
47 
48  Ice::Identity getIceId() const;
49 
50  private:
51  CommonStorageInterfacePtr dbConn;
52  std::mutex dbConnectionMutex;
53  std::string dbName;
54 
55  Ice::Identity iceId;
56 
57  std::string getCollectionNS(std::string collName);
58  };
59 
61 
62 }
63 
memoryx::Database::requestCollection
CollectionInterfacePrx requestCollection(const ::std::string &collName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Database.cpp:39
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
memoryx::Database::releaseCollection
void releaseCollection(const ::memoryx::CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Database.cpp:45
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
memoryx::Database::getIceId
Ice::Identity getIceId() const
Definition: Database.cpp:62
memoryx::Database::Database
Database(const CommonStorageInterfacePtr &dbConn, const std::string &dbName)
Definition: Database.cpp:29
memoryx::Database
The Database class provides an interface to a database.
Definition: Database.h:35
memoryx::Database::dropCollection
void dropCollection(const ::std::string &collName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Database.cpp:51
IceUtil::Handle
Definition: forward_declarations.h:29
memoryx::Database::~Database
~Database() override
memoryx::Database::getName
std::string getName(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: Database.cpp:57