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 
25 #include "CommonStorage.h"
26 
28 #include <MemoryX/interface/components/CommonStorageInterface.h>
29 
30 namespace memoryx
31 {
32 
34  virtual public CollectionInterface
35  {
36  public:
37  Collection(const CommonStoragePtr& dbConn, const std::string& collNS);
38 
39  // inherited from CollectionInterface
40  Ice::Int count(const ::Ice::Current& = Ice::emptyCurrent) override;
41  std::string getNS(const ::Ice::Current& = Ice::emptyCurrent) override;
42 
43  DBStorableData findByMongoId(const std::string& id, const ::Ice::Current& c) override;
44  DBStorableDataList findByFieldValue(const std::string& fieldName, const ::std::string& fieldValue, const ::Ice::Current& = Ice::emptyCurrent) override;
45  DBStorableData findOneByFieldValue(const std::string& fieldName, const ::std::string& fieldValue, const ::Ice::Current& = Ice::emptyCurrent) override;
46  DBStorableDataList findByFieldValueList(const std::string& fieldName, const NameList& fieldValueList, const ::Ice::Current& = Ice::emptyCurrent) override;
47  DBStorableDataList findByQuery(const std::string& query, const ::Ice::Current& c) override;
48  DBStorableDataList findByConstraintQuery(const std::string& query, const std::string& where, const Ice::Current&) override;
49  DBStorableData findOneByQuery(const std::string& query, const ::Ice::Current& c) override;
50  DBStorableDataList findAll(const ::Ice::Current& = Ice::emptyCurrent) override;
51  DBStorableData findAllUniqueByFieldName(const std::string& fieldName, const ::Ice::Current& = Ice::emptyCurrent) override;
52  EntityIdList findAllIds(const ::Ice::Current& = Ice::emptyCurrent) override;
53  NameList findAllFieldValues(const std::string& fieldName, const ::Ice::Current& = Ice::emptyCurrent) override;
54 
55  std::string insert(const DBStorableData& obj, const ::Ice::Current& = Ice::emptyCurrent) override;
56  std::vector<std::string> insertList(const DBStorableDataList& objectList, const Ice::Current& = Ice::emptyCurrent) override;
57  bool update(const DBStorableData& obj, const ::Ice::Current& = Ice::emptyCurrent) override;
58  bool updateByQuery(const std::string& query, const DBStorableData& obj, const ::Ice::Current& = Ice::emptyCurrent) override;
59  bool updateWithUserKey(const DBStorableData& obj, const std::string& keyField, const ::Ice::Current& = Ice::emptyCurrent) override;
60  std::string save(const DBStorableData& obj, const ::Ice::Current& = Ice::emptyCurrent) override;
61  bool saveWithUserKey(const DBStorableData& obj, const std::string& keyField, const ::Ice::Current& = Ice::emptyCurrent) override;
62 
63  bool removeByMongoId(const std::string& id, const ::Ice::Current& = Ice::emptyCurrent) override;
64  bool removeByFieldValue(const std::string& fieldName, const std::string& fieldValue, const ::Ice::Current& = Ice::emptyCurrent) override;
65  bool removeByQuery(const std::string& query, const ::Ice::Current& = Ice::emptyCurrent) override;
66  bool clear(const ::Ice::Current& c) override;
67 
68  bool ensureIndex(const std::string& fieldName, bool unique, const ::Ice::Current& = Ice::emptyCurrent) override;
69 
70  Ice::Identity getIceId() const;
71 
72  private:
73  CommonStoragePtr dbConn;
74  std::mutex dbConnectionMutex;
75  std::string ns;
76 
77  Ice::Identity iceId;
78  };
79 
81 }
82 
CommonStorage.h
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:43
memoryx::Collection
Definition: Collection.h:33
armarx::navigation::algorithms::save
bool save(const Costmap &costmap, const std::filesystem::path &directory)
Definition: persistence.cpp:101
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:523
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:43
armarx::armem::server::ltm::util::mongodb::detail::update
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
Definition: mongodb.cpp:67
IceUtil::Handle< CommonStorage >
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:916
ImportExportComponent.h