Collection.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 2012
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#pragma once
24
26
27#include "CommonStorage.h"
28#include <MemoryX/interface/components/CommonStorageInterface.h>
29
30namespace memoryx
31{
32
33 class ARMARXCOMPONENT_IMPORT_EXPORT Collection : virtual public CollectionInterface
34 {
35 public:
36 Collection(const CommonStoragePtr& dbConn, const std::string& collNS);
37
38 // inherited from CollectionInterface
39 Ice::Int count(const ::Ice::Current& = Ice::emptyCurrent) override;
40 std::string getNS(const ::Ice::Current& = Ice::emptyCurrent) override;
41
42 DBStorableData findByMongoId(const std::string& id, const ::Ice::Current& c) override;
43 DBStorableDataList findByFieldValue(const std::string& fieldName,
44 const ::std::string& fieldValue,
45 const ::Ice::Current& = Ice::emptyCurrent) override;
46 DBStorableData findOneByFieldValue(const std::string& fieldName,
47 const ::std::string& fieldValue,
48 const ::Ice::Current& = Ice::emptyCurrent) override;
49 DBStorableDataList findByFieldValueList(const std::string& fieldName,
50 const NameList& fieldValueList,
51 const ::Ice::Current& = Ice::emptyCurrent) override;
52 DBStorableDataList findByQuery(const std::string& query, const ::Ice::Current& c) override;
53 DBStorableDataList findByConstraintQuery(const std::string& query,
54 const std::string& where,
55 const Ice::Current&) override;
56 DBStorableData findOneByQuery(const std::string& query, const ::Ice::Current& c) override;
57 DBStorableDataList findAll(const ::Ice::Current& = Ice::emptyCurrent) override;
58 DBStorableData findAllUniqueByFieldName(const std::string& fieldName,
59 const ::Ice::Current& = Ice::emptyCurrent) override;
60 EntityIdList findAllIds(const ::Ice::Current& = Ice::emptyCurrent) override;
61 NameList findAllFieldValues(const std::string& fieldName,
62 const ::Ice::Current& = Ice::emptyCurrent) override;
63
64 std::string insert(const DBStorableData& obj,
65 const ::Ice::Current& = Ice::emptyCurrent) override;
66 std::vector<std::string> insertList(const DBStorableDataList& objectList,
67 const Ice::Current& = Ice::emptyCurrent) override;
68 bool update(const DBStorableData& obj, const ::Ice::Current& = Ice::emptyCurrent) override;
69 bool updateByQuery(const std::string& query,
70 const DBStorableData& obj,
71 const ::Ice::Current& = Ice::emptyCurrent) override;
72 bool updateWithUserKey(const DBStorableData& obj,
73 const std::string& keyField,
74 const ::Ice::Current& = Ice::emptyCurrent) override;
75 std::string save(const DBStorableData& obj,
76 const ::Ice::Current& = Ice::emptyCurrent) override;
77 bool saveWithUserKey(const DBStorableData& obj,
78 const std::string& keyField,
79 const ::Ice::Current& = Ice::emptyCurrent) override;
80
81 bool removeByMongoId(const std::string& id,
82 const ::Ice::Current& = Ice::emptyCurrent) override;
83 bool removeByFieldValue(const std::string& fieldName,
84 const std::string& fieldValue,
85 const ::Ice::Current& = Ice::emptyCurrent) override;
86 bool removeByQuery(const std::string& query,
87 const ::Ice::Current& = Ice::emptyCurrent) override;
88 bool clear(const ::Ice::Current& c) override;
89
90 bool ensureIndex(const std::string& fieldName,
91 bool unique,
92 const ::Ice::Current& = Ice::emptyCurrent) override;
93
94 Ice::Identity getIceId() const;
95
96 private:
97 CommonStoragePtr dbConn;
98 std::mutex dbConnectionMutex;
99 std::string ns;
100
101 Ice::Identity iceId;
102 };
103
105} // namespace memoryx
#define ARMARXCOMPONENT_IMPORT_EXPORT
constexpr T c
EntityIdList findAllIds(const ::Ice::Current &=Ice::emptyCurrent) override
bool update(const DBStorableData &obj, const ::Ice::Current &=Ice::emptyCurrent) override
std::string save(const DBStorableData &obj, const ::Ice::Current &=Ice::emptyCurrent) override
Ice::Identity getIceId() const
Collection(const CommonStoragePtr &dbConn, const std::string &collNS)
DBStorableDataList findByQuery(const std::string &query, const ::Ice::Current &c) override
std::string getNS(const ::Ice::Current &=Ice::emptyCurrent) override
bool updateByQuery(const std::string &query, const DBStorableData &obj, const ::Ice::Current &=Ice::emptyCurrent) override
std::string insert(const DBStorableData &obj, const ::Ice::Current &=Ice::emptyCurrent) override
bool removeByQuery(const std::string &query, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableDataList findByFieldValueList(const std::string &fieldName, const NameList &fieldValueList, const ::Ice::Current &=Ice::emptyCurrent) override
bool clear(const ::Ice::Current &c) override
bool removeByFieldValue(const std::string &fieldName, const std::string &fieldValue, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableData findAllUniqueByFieldName(const std::string &fieldName, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableData findOneByFieldValue(const std::string &fieldName, const ::std::string &fieldValue, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableData findOneByQuery(const std::string &query, const ::Ice::Current &c) override
DBStorableDataList findAll(const ::Ice::Current &=Ice::emptyCurrent) override
NameList findAllFieldValues(const std::string &fieldName, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableDataList findByFieldValue(const std::string &fieldName, const ::std::string &fieldValue, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableData findByMongoId(const std::string &id, const ::Ice::Current &c) override
std::vector< std::string > insertList(const DBStorableDataList &objectList, const Ice::Current &=Ice::emptyCurrent) override
Ice::Int count(const ::Ice::Current &=Ice::emptyCurrent) override
bool removeByMongoId(const std::string &id, const ::Ice::Current &=Ice::emptyCurrent) override
bool saveWithUserKey(const DBStorableData &obj, const std::string &keyField, const ::Ice::Current &=Ice::emptyCurrent) override
DBStorableDataList findByConstraintQuery(const std::string &query, const std::string &where, const Ice::Current &) override
bool ensureIndex(const std::string &fieldName, bool unique, const ::Ice::Current &=Ice::emptyCurrent) override
bool updateWithUserKey(const DBStorableData &obj, const std::string &keyField, const ::Ice::Current &=Ice::emptyCurrent) override
VirtualRobot headers.
IceUtil::Handle< Collection > CollectionPtr
Definition Collection.h:104
IceUtil::Handle< CommonStorage > CommonStoragePtr