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 
30 namespace 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
CommonStorage.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::Collection
Definition: Collection.h:33
armarx::navigation::algorithms::save
bool save(const Costmap &costmap, const std::filesystem::path &directory)
Definition: persistence.cpp:105
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
ARMARXCOMPONENT_IMPORT_EXPORT
#define ARMARXCOMPONENT_IMPORT_EXPORT
Definition: ImportExportComponent.h:38
armarx::armem::server::ltm::util::mongodb::detail::insert
bool insert(mongocxx::collection &coll, const nlohmann::json &value)
Definition: mongodb.cpp:44
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:68
IceUtil::Handle< CommonStorage >
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
ImportExportComponent.h