PersistentEntitySegment.cpp
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::Core
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 
24 
25 #include <iostream>
26 
27 #include <Ice/ObjectAdapter.h>
28 #include <IceUtil/UUID.h>
29 
32 #include <ArmarXCore/interface/serialization/JSONSerialization.h>
34 
35 #include "SegmentedMemory.h"
39 
40 namespace memoryx
41 {
42  PersistentEntitySegment::PersistentEntitySegment(CollectionInterfacePrx entityCollection,
44  bool useMongoIds /* = true */) :
45  useMongoIds(useMongoIds)
46  {
48  setSingleRWCollection(entityCollection);
49  }
50 
52  {
53  }
54 
55  NameList
56  PersistentEntitySegment::getReadCollectionsNS(const ::Ice::Current& c) const
57  {
58  memoryx::NameList result;
59  auto lock = getReadLock(c);
60 
61  for (CollectionPrxList::const_iterator it = readCollections.begin();
62  it != readCollections.end();
63  ++it)
64  {
65  if (!*it)
66  {
67  continue;
68  }
69 
70  result.push_back((*it)->getNS());
71  }
72 
73  return result;
74  }
75 
76  void
78  {
79  ARMARX_INFO_S << "Clearing read collections";
80  auto lock = getWriteLock(c);
81  readCollections.clear();
82  }
83 
84  void
85  PersistentEntitySegment::addReadCollection(const CollectionInterfacePrx& coll,
86  const ::Ice::Current& c)
87  {
88  if (coll)
89  {
91 
92  bool found = false;
93  const std::string newName = coll->getNS();
94 
95  for (CollectionPrxList::iterator it = readCollections.begin();
96  it != readCollections.end();
97  it++)
98  {
100 
101  if (newName == (*it)->getNS())
102  {
103  found = true;
104  break;
105  }
106  }
107 
108  if (!found)
109  {
110  readCollections.push_back(coll);
111  ARMARX_INFO_S << coll->getNS() << " collection added to list";
112  }
113  else
114  {
115  ARMARX_INFO_S << coll->getNS() << " collection already in list";
116  }
117  }
118  }
119 
120  std::string
122  {
123  return writeCollection->getNS();
124  }
125 
126  void
127  PersistentEntitySegment::setWriteCollection(const CollectionInterfacePrx& coll,
128  const ::Ice::Current& c)
129  {
130  if (coll)
131  {
132  writeCollection = coll;
133  }
134  }
135 
136  void
137  PersistentEntitySegment::setSingleRWCollection(const CollectionInterfacePrx& coll,
138  const ::Ice::Current& c)
139  {
140  setWriteCollection(coll);
142  addReadCollection(coll);
143  }
144 
145  std::string
146  PersistentEntitySegment::getObjectTypeId(const ::Ice::Current& c) const
147  {
148  return objectTypeId;
149  }
150 
151  std::string
152  PersistentEntitySegment::addEntity(const EntityBasePtr& entity, const ::Ice::Current& c)
153  {
155  return addEntityThreadUnsafe(entity);
156  }
157 
158  std::string
160  {
161  DBStorableData dbEntity;
162  {
163  std::unique_lock lock(dbSerializerMutex);
164  dbEntity = dbSerializer->serializeIceObject(entity);
165  }
166  return writeCollection->insert(dbEntity);
167  }
168 
169  std::string
170  PersistentEntitySegment::upsertEntity(const std::string& entityId,
171  const EntityBasePtr& entity,
172  const Ice::Current& c)
173  {
175  return upsertEntityThreadUnsafe(entityId, entity);
176  }
177 
178  std::string
180  const EntityBasePtr& entity)
181  {
182  if (hasEntityByIdThreadUnsafe(entityId))
183  {
184  updateEntityThreadUnsafe(entityId, entity);
185  return entityId;
186  }
187  else
188  {
189  return addEntityThreadUnsafe(entity);
190  }
191  }
192 
193  EntityIdList
194  PersistentEntitySegment::upsertEntityList(const EntityBaseList& entityList,
195  const Ice::Current& c)
196  {
198  return upsertEntityListThreadUnsafe(entityList);
199  }
200 
201  EntityIdList
203  {
204  EntityIdList entityIds(entityList.size(), "");
205 
206  for (size_t i = 0; i < entityList.size(); i++)
207  {
208  try
209  {
210  entityIds[i] = upsertEntityThreadUnsafe(entityList[i]->getId(), entityList[i]);
211  }
212  catch (const memoryx::InvalidEntityException& e)
213  {
214  // don't handle this exception but return an empty string as ID for this specific entity
215  }
216  }
217 
218  return entityIds;
219  }
220 
221  std::string
222  PersistentEntitySegment::upsertEntityByName(const std::string& entityName,
223  const EntityBasePtr& entity,
224  const Ice::Current& c)
225  {
227  return upsertEntityByNameThreadUnsafe(entityName, entity);
228  }
229 
230  std::string
232  const EntityBasePtr& entity)
233  {
234  auto oldEntity = getEntityByNameThreadUnsafe(entityName);
235  if (oldEntity)
236  {
237  updateEntityThreadUnsafe(oldEntity->getId(), entity);
238  return oldEntity->getId();
239  }
240  else
241  {
242  return addEntityThreadUnsafe(entity);
243  }
244  }
245 
246  EntityIdList
247  PersistentEntitySegment::addEntityList(const EntityBaseList& entityList, const Ice::Current& c)
248  {
250  return addEntityListThreadUnsafe(entityList);
251  }
252 
253  EntityIdList
254  PersistentEntitySegment::addEntityListThreadUnsafe(const EntityBaseList& entityList)
255  {
256  DBStorableDataList dbEntities;
257  dbEntities.reserve(entityList.size());
258 
259  for (size_t i = 0; i < entityList.size(); i++)
260  {
261  std::unique_lock lock(dbSerializerMutex);
262 
263  dbEntities.push_back(dbSerializer->serializeIceObject(entityList[i]));
264  }
265 
266  return writeCollection->insertList(dbEntities);
267  }
268 
269  void
270  PersistentEntitySegment::updateEntity(const ::std::string& entityId,
271  const EntityBasePtr& update,
272  const ::Ice::Current& c)
273  {
275  updateEntityThreadUnsafe(entityId, update);
276  }
277 
278  void
280  const EntityBasePtr& update)
281  {
282  update->setId(entityId);
283  DBStorableData dbEntity;
284  {
285  std::unique_lock lock(dbSerializerMutex);
286  dbEntity = dbSerializer->serializeIceObject(update);
287  }
288 
289  writeCollection->update(dbEntity);
290  }
291 
292  void
293  PersistentEntitySegment::removeEntity(const ::std::string& entityId, const ::Ice::Current& c)
294  {
296  removeEntityThreadUnsafe(entityId);
297  }
298 
299  void
301  {
302  if (useMongoIds)
303  {
304  writeCollection->removeByMongoId(entityId);
305  }
306  else
307  {
308  writeCollection->removeByFieldValue("_id", entityId);
309  }
310  }
311 
312  void
314  {
316 
317  auto ids = getAllEntityIdsThreadUnsafe();
318 
319  for (auto& id : ids)
320  {
322  }
323  }
324 
325  bool
326  PersistentEntitySegment::hasEntityById(const std::string& entityId, const Ice::Current& c) const
327  {
329  return hasEntityByIdThreadUnsafe(entityId);
330  }
331 
332  bool
333  PersistentEntitySegment::hasEntityByIdThreadUnsafe(const std::string& entityId) const
334  {
335  if (entityId.empty() || entityId.size() != 24)
336  {
337  return false;
338  }
339  try
340  {
341  for (CollectionPrxList::const_iterator it = readCollections.begin();
342  it != readCollections.end();
343  ++it)
344  {
345  if (!*it)
346  {
347  continue;
348  }
349 
350  const DBStorableData dbEntity = useMongoIds
351  ? (*it)->findByMongoId(entityId)
352  : (*it)->findOneByFieldValue("_id", entityId);
353 
354  if (!dbEntity.JSON.empty())
355  {
356  return true;
357  }
358  }
359  }
360  catch (...)
361  {
362  }
363 
364  return false;
365  }
366 
367  bool
368  PersistentEntitySegment::hasEntityByName(const std::string& entityName,
369  const Ice::Current& c) const
370  {
372  return hasEntityByNameThreadUnsafe(entityName);
373  }
374 
375  bool
376  PersistentEntitySegment::hasEntityByNameThreadUnsafe(const std::string& entityName) const
377  {
378  for (CollectionPrxList::const_iterator it = readCollections.begin();
379  it != readCollections.end();
380  ++it)
381  {
382  CollectionInterfacePrx coll = *it;
383 
384  if (!coll)
385  {
386  continue;
387  }
388 
389  const DBStorableData dbEntity = coll->findOneByFieldValue("name", entityName);
390 
391  if (!dbEntity.JSON.empty())
392  {
393  return true;
394  }
395  }
396 
397  return false;
398  }
399 
400  EntityBasePtr
401  PersistentEntitySegment::getEntityById(const ::std::string& entityId,
402  const ::Ice::Current& c) const
403  {
405 
406  return getEntityByIdThreadUnsafe(entityId);
407  }
408 
409  EntityBasePtr
410  PersistentEntitySegment::getEntityByIdThreadUnsafe(const std::string& entityId) const
411  {
412  if (entityId.empty())
413  {
414  ARMARX_ERROR_S << "Entity id must not be empty!";
415  return EntityBasePtr();
416  }
417 
418 
419  for (CollectionPrxList::const_iterator it = readCollections.begin();
420  it != readCollections.end();
421  ++it)
422  {
423  if (!*it)
424  {
425  continue;
426  }
427 
428  const DBStorableData dbEntity = useMongoIds
429  ? (*it)->findByMongoId(entityId)
430  : (*it)->findOneByFieldValue("_id", entityId);
431 
432  if (!dbEntity.JSON.empty())
433  {
434  return deserializeEntity(dbEntity);
435  }
436  }
437 
438  return EntityBasePtr();
439  }
440 
441  EntityBasePtr
442  PersistentEntitySegment::getEntityByName(const ::std::string& name,
443  const ::Ice::Current& c) const
444  {
446  return getEntityByNameThreadUnsafe(name);
447  }
448 
449  EntityBasePtr
451  {
452  for (CollectionPrxList::const_iterator it = readCollections.begin();
453  it != readCollections.end();
454  ++it)
455  {
456  if (!*it)
457  {
458  continue;
459  }
460 
461  const DBStorableData dbEntity = (*it)->findOneByFieldValue("name", name);
462 
463  if (!dbEntity.JSON.empty())
464  {
465  return deserializeEntity(dbEntity);
466  }
467  }
468 
469  return EntityBasePtr();
470  }
471 
472  EntityBaseList
473  PersistentEntitySegment::getEntitiesByAttrValue(const ::std::string& attrName,
474  const ::std::string& attrValue,
475  const ::Ice::Current& c) const
476  {
477  EntityBaseList result;
478  const std::string fieldName = "attrs." + attrName + ".value.value";
480 
481  for (CollectionPrxList::const_iterator itColl = readCollections.begin();
482  itColl != readCollections.end();
483  ++itColl)
484  {
485  if (!*itColl)
486  {
487  continue;
488  }
489 
490  const DBStorableDataList dbEntities = (*itColl)->findByFieldValue(fieldName, attrValue);
491 
492  for (DBStorableDataList::const_iterator itEntity = dbEntities.begin();
493  itEntity != dbEntities.end();
494  ++itEntity)
495  {
496  EntityBasePtr entity = deserializeEntity(*itEntity);
497 
498  if (entity)
499  {
500  result.push_back(entity);
501  }
502  }
503  }
504 
505  return result;
506  }
507 
508  EntityBaseList
510  const NameList& attrValueList,
511  const ::Ice::Current& c) const
512  {
513  EntityBaseList result;
514  const std::string fieldName = "attrs." + attrName + ".value.value";
516 
517  for (CollectionPrxList::const_iterator itColl = readCollections.begin();
518  itColl != readCollections.end();
519  ++itColl)
520  {
521  if (!*itColl)
522  {
523  continue;
524  }
525 
526  const DBStorableDataList dbEntities =
527  (*itColl)->findByFieldValueList(fieldName, attrValueList);
528 
529  for (DBStorableDataList::const_iterator itEntity = dbEntities.begin();
530  itEntity != dbEntities.end();
531  ++itEntity)
532  {
533  EntityBasePtr entity = deserializeEntity(*itEntity);
534 
535  if (entity)
536  {
537  result.push_back(entity);
538  }
539  }
540  }
541 
542  return result;
543  }
544 
545  Ice::Int
546  PersistentEntitySegment::size(const ::Ice::Current& c) const
547  {
548  Ice::Int result = 0;
550 
551  for (CollectionPrxList::const_iterator it = readCollections.begin();
552  it != readCollections.end();
553  ++it)
554  {
555  if (!*it)
556  {
557  continue;
558  }
559 
560  result += (*it)->count();
561  }
562 
563  return result;
564  }
565 
566  void
567  PersistentEntitySegment::print(const ::Ice::Current& c) const
568  {
569  //TODO implement
570  }
571 
572  void
573  PersistentEntitySegment::clear(const ::Ice::Current& c)
574  {
575  writeCollection->clear();
576  }
577 
579  PersistentEntitySegment::getIceId(const Ice::Current&) const
580  {
581  Ice::Identity id;
582  id.name = (parentMemory ? parentMemory->getMemoryName() : "") + "_" + segmentName;
583  return id;
584  }
585 
586  std::string
587  PersistentEntitySegment::getSegmentName(const Ice::Current&) const
588  {
589  return segmentName;
590  }
591 
592  EntityIdList
593  PersistentEntitySegment::getAllEntityIds(const ::Ice::Current& c) const
594  {
597  }
598 
599  EntityIdList
601  {
602  EntityIdList result;
603 
604  for (CollectionPrxList::const_iterator it = readCollections.begin();
605  it != readCollections.end();
606  ++it)
607  {
608  if (!*it)
609  {
610  continue;
611  }
612 
613  const EntityIdList collIds = (*it)->findAllIds();
614  result.insert(result.end(), collIds.begin(), collIds.end());
615  }
616  return result;
617  }
618 
619  EntityBaseList
620  PersistentEntitySegment::getAllEntities(const ::Ice::Current& c) const
621  {
622  EntityBaseList result;
624 
625  for (const auto& col : readCollections)
626  {
627  if (!col)
628  {
629  continue;
630  }
631 
632  for (const auto& dbEntity : col->findAll())
633  {
634  auto entity = deserializeEntity(dbEntity);
635 
636  if (entity)
637  {
638  result.push_back(std::move(entity));
639  }
640  }
641  }
642 
643  return result;
644  }
645 
646  IdEntityMap
647  PersistentEntitySegment::getIdEntityMap(const ::Ice::Current& c) const
648  {
649  IdEntityMap result;
650 
651  for (auto&& entity : getAllEntities())
652  {
653  result.insert({entity->getId(), std::move(entity)});
654  }
655 
656  return result;
657  }
658 
659  EntityBasePtr
660  PersistentEntitySegment::deserializeEntity(const DBStorableData& dbEntity) const
661  {
662  std::unique_lock lock(dbSerializerMutex);
663  EntityBasePtr entity;
664 
665  try
666  {
667  entity = EntityBasePtr::dynamicCast(dbSerializer->deserializeIceObject(dbEntity));
668  }
669  catch (const armarx::JSONException& ex)
670  {
671  entity = EntityBasePtr();
672  }
673 
674  return entity;
675  }
676 
677  EntityRefBasePtr
679  const Ice::Current& c) const
680  {
681  auto entity = getEntityById(id);
682 
683  if (!entity)
684  {
685  return NULL;
686  }
687 
688  auto proxy =
689  EntityMemorySegmentInterfacePrx::uncheckedCast(c.adapter->createProxy(getIceId()));
690  SegmentedMemoryPtr mem = SegmentedMemoryPtr::dynamicCast(parentMemory);
691  std::string memName = mem->getMemoryName();
692  auto memoryProxy =
693  MemoryInterfacePrx::checkedCast(c.adapter->getCommunicator()->stringToProxy(memName));
694  EntityRefPtr ref = new EntityRef(entity, segmentName, memName, memoryProxy, proxy);
695  return ref;
696  }
697 
698  EntityRefBasePtr
700  const Ice::Current& c) const
701  {
702  auto entity = getEntityByName(name);
703 
704  if (!entity)
705  {
706  return NULL;
707  }
708 
709  auto proxy =
710  EntityMemorySegmentInterfacePrx::uncheckedCast(c.adapter->createProxy(getIceId()));
711  SegmentedMemoryPtr mem = SegmentedMemoryPtr::dynamicCast(parentMemory);
712  std::string memName = mem->getMemoryName();
713  auto memoryProxy =
714  MemoryInterfacePrx::checkedCast(c.adapter->getCommunicator()->stringToProxy(memName));
715  EntityRefPtr ref = new EntityRef(entity, segmentName, memName, memoryProxy, proxy);
716  return ref;
717  }
718 
719  void
720  PersistentEntitySegment::setEntityAttribute(const std::string& entityId,
721  const EntityAttributeBasePtr& attribute,
722  const Ice::Current& c)
723  {
724  EntityBasePtr entity = getEntityById(entityId);
725  if (!entity)
726  {
727  throw EntityNotFoundException();
728  }
729  entity->putAttribute(attribute);
730  DBStorableData dbEntity;
731  {
732  std::unique_lock lock(dbSerializerMutex);
733  dbEntity = dbSerializer->serializeIceObject(entity);
734  }
736 
737  writeCollection->update(dbEntity);
738  }
739 
740  void
741  PersistentEntitySegment::setEntityAttributes(const std::string& entityId,
742  const EntityAttributeList& attributeMap,
743  const Ice::Current& c)
744  {
745  EntityBasePtr entity = getEntityById(entityId);
746  if (!entity)
747  {
748  throw EntityNotFoundException();
749  }
750  for (auto attribute : attributeMap)
751  {
752  entity->putAttribute(attribute);
753  }
754  {
755  DBStorableData dbEntity;
756  {
757  std::unique_lock lock(dbSerializerMutex);
758  dbEntity = dbSerializer->serializeIceObject(entity);
759  }
761  writeCollection->update(dbEntity);
762  }
763  }
764 
765  void
766  memoryx::PersistentEntitySegment::setParentMemory(const MemoryInterfacePtr& memory,
767  const Ice::Current&)
768  {
769  this->parentMemory = memory;
770  }
771 
772  EntityRefList
773  PersistentEntitySegment::findRefsByQuery(const std::string& query, const Ice::Current& c)
774  {
775  EntityRefList result;
777 
778  for (CollectionPrxList::const_iterator it = readCollections.begin();
779  it != readCollections.end();
780  ++it)
781  {
782  if (!*it)
783  {
784  continue;
785  }
786 
787  CollectionInterfacePrx prx = *it;
788  const DBStorableDataList data = prx->findByQuery(query);
789 
790  for (const DBStorableData& e : data)
791  {
792  EntityBasePtr entity = deserializeEntity(e);
793 
794  if (entity)
795  {
796  auto proxy = EntityMemorySegmentInterfacePrx::uncheckedCast(
797  c.adapter->createProxy(getIceId()));
798  SegmentedMemoryPtr mem = SegmentedMemoryPtr::dynamicCast(parentMemory);
799  std::string memName = mem->getMemoryName();
800  auto memoryProxy = MemoryInterfacePrx::checkedCast(
801  c.adapter->getCommunicator()->stringToProxy(memName));
802  EntityRefPtr ref =
803  new EntityRef(entity, segmentName, memName, memoryProxy, proxy);
804  result.push_back(ref);
805  }
806  }
807  }
808 
809  return result;
810  }
811 
812  void
813  PersistentEntitySegment::setSegmentName(const std::string& segmentName, const Ice::Current&)
814  {
815  this->segmentName = segmentName;
816  }
817 } // namespace memoryx
memoryx::PersistentEntitySegment::setSingleRWCollection
void setSingleRWCollection(const CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:137
memoryx::PersistentEntitySegment::getReadCollectionsNS
NameList getReadCollectionsNS(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:56
memoryx::PersistentEntitySegment::getIdEntityMap
IdEntityMap getIdEntityMap(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:647
memoryx::PersistentEntitySegment::addEntityList
EntityIdList addEntityList(const EntityBaseList &entityList, const Ice::Current &=Ice::emptyCurrent) override
addEntityList adds all entities contained in \entityList to this segment and returns a list of create...
Definition: PersistentEntitySegment.cpp:247
memoryx::PersistentEntitySegment::findRefsByQuery
EntityRefList findRefsByQuery(const std::string &query, const Ice::Current &c) override
retrieves Entity Refs that match the query.
Definition: PersistentEntitySegment.cpp:773
cyberglove_with_calib_22dof.ic
ic
Definition: cyberglove_with_calib_22dof.py:22
SegmentedMemory.h
memoryx::PersistentEntitySegment::setEntityAttributes
void setEntityAttributes(const std::string &entityId, const EntityAttributeList &attributeMap, const Ice::Current &) override
Definition: PersistentEntitySegment.cpp:741
armarx::VariantType::EntityRef
const armarx::VariantTypeId EntityRef
Definition: EntityRef.h:30
memoryx::PersistentEntitySegment::updateEntity
void updateEntity(const ::std::string &entityId, const EntityBasePtr &update, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:270
memoryx::PersistentEntitySegment::dbSerializerMutex
std::recursive_mutex dbSerializerMutex
Definition: PersistentEntitySegment.h:261
memoryx::PersistentEntitySegment::setWriteCollection
void setWriteCollection(const CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:127
JSONObject.h
memoryx::PersistentEntitySegment::parentMemory
MemoryInterfacePtr parentMemory
Definition: PersistentEntitySegment.h:254
memoryx::PersistentEntitySegment::setParentMemory
void setParentMemory(const MemoryInterfacePtr &memory, const Ice::Current &) override
Definition: PersistentEntitySegment.cpp:766
memoryx::PersistentEntitySegment::updateEntityThreadUnsafe
virtual void updateEntityThreadUnsafe(const ::std::string &entityId, const EntityBasePtr &update)
Definition: PersistentEntitySegment.cpp:279
memoryx::PersistentEntitySegment::print
void print(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:567
memoryx::PersistentEntitySegment::addEntity
std::string addEntity(const EntityBasePtr &entity, const ::Ice::Current &c=Ice::emptyCurrent) override
addEntity add new entity and return the newly generated entity ID
Definition: PersistentEntitySegment.cpp:152
memoryx::SegmentUtilImplementations::getReadLock
ScopedSharedLockPtr getReadLock(const Ice::Current &c) const
Definition: SegmentUtilImplementations.cpp:45
memoryx::PersistentEntitySegment::getEntityRefByName
EntityRefBasePtr getEntityRefByName(const std::string &name, const Ice::Current &c) const override
Definition: PersistentEntitySegment.cpp:699
PersistentEntitySegment.h
MongoSerializer.h
memoryx::PersistentEntitySegment::removeAllEntities
void removeAllEntities(const ::Ice::Current &c=Ice::emptyCurrent) override
removeAllEntities collects all entities managed by this memory segment and removes them from the segm...
Definition: PersistentEntitySegment.cpp:313
memoryx
VirtualRobot headers.
Definition: CommonPlacesTester.cpp:48
c
constexpr T c
Definition: UnscentedKalmanFilterTest.cpp:46
memoryx::PersistentEntitySegment::getObjectTypeId
std::string getObjectTypeId(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:146
memoryx::PersistentEntitySegment::removeEntityThreadUnsafe
virtual void removeEntityThreadUnsafe(const ::std::string &entityId)
Definition: PersistentEntitySegment.cpp:300
memoryx::PersistentEntitySegment::size
Ice::Int size(const ::Ice::Current &=Ice::emptyCurrent) const override
size counts the number of memoryx::Entity instances contained available reachable throuhg memoryx::Pe...
Definition: PersistentEntitySegment.cpp:546
memoryx::PersistentEntitySegment::getSegmentName
std::string getSegmentName(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:587
memoryx::PersistentEntitySegment::addEntityThreadUnsafe
virtual std::string addEntityThreadUnsafe(const EntityBasePtr &entity)
Definition: PersistentEntitySegment.cpp:159
memoryx::PersistentEntitySegment::setSegmentName
void setSegmentName(const std::string &segmentName, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:813
memoryx::PersistentEntitySegment::getAllEntities
EntityBaseList getAllEntities(const ::Ice::Current &=Ice::emptyCurrent) const override
getAllEntities returns a list of all entities managed by this memory segment
Definition: PersistentEntitySegment.cpp:620
memoryx::PersistentEntitySegment::~PersistentEntitySegment
~PersistentEntitySegment() override
Definition: PersistentEntitySegment.cpp:51
memoryx::PersistentEntitySegment::getAllEntityIdsThreadUnsafe
virtual EntityIdList getAllEntityIdsThreadUnsafe() const
Definition: PersistentEntitySegment.cpp:600
memoryx::PersistentEntitySegment::writeCollection
CollectionInterfacePrx writeCollection
Definition: PersistentEntitySegment.h:259
IceInternal::Handle<::Ice::Communicator >
memoryx::PersistentEntitySegment::upsertEntityByNameThreadUnsafe
virtual std::string upsertEntityByNameThreadUnsafe(const std::string &entityName, const EntityBasePtr &entity)
Definition: PersistentEntitySegment.cpp:231
memoryx::PersistentEntitySegment::PersistentEntitySegment
PersistentEntitySegment(CollectionInterfacePrx entityCollection, Ice::CommunicatorPtr ic, bool useMongoIds=true)
Definition: PersistentEntitySegment.cpp:42
EntityRef.h
memoryx::PersistentEntitySegment::getEntityByNameThreadUnsafe
virtual EntityBasePtr getEntityByNameThreadUnsafe(const ::std::string &name) const
Definition: PersistentEntitySegment.cpp:450
GfxTL::Identity
void Identity(MatrixXX< N, N, T > *a)
Definition: MatrixXX.h:570
memoryx::SegmentUtilImplementations::getWriteLock
ScopedUniqueLockPtr getWriteLock(const Ice::Current &c) const
Definition: SegmentUtilImplementations.cpp:57
memoryx::PersistentEntitySegment::getEntityById
EntityBasePtr getEntityById(const ::std::string &entityId, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:401
ARMARX_ERROR_S
#define ARMARX_ERROR_S
Definition: Logging.h:216
data
uint8_t data[1]
Definition: EtherCATFrame.h:68
memoryx::PersistentEntitySegment::getEntityByName
EntityBasePtr getEntityByName(const ::std::string &name, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:442
memoryx::PersistentEntitySegment::getEntityRefById
EntityRefBasePtr getEntityRefById(const std::string &id, const Ice::Current &) const override
Definition: PersistentEntitySegment.cpp:678
memoryx::PersistentEntitySegment::deserializeEntity
EntityBasePtr deserializeEntity(const DBStorableData &dbEntity) const
Definition: PersistentEntitySegment.cpp:660
memoryx::PersistentEntitySegment::upsertEntityListThreadUnsafe
virtual EntityIdList upsertEntityListThreadUnsafe(const EntityBaseList &entityList)
Definition: PersistentEntitySegment.cpp:202
memoryx::PersistentEntitySegment::addReadCollection
void addReadCollection(const CollectionInterfacePrx &coll, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:85
memoryx::PersistentEntitySegment::getEntityByIdThreadUnsafe
virtual EntityBasePtr getEntityByIdThreadUnsafe(const ::std::string &entityId) const
Definition: PersistentEntitySegment.cpp:410
memoryx::PersistentEntitySegment::upsertEntity
std::string upsertEntity(const std::string &entityId, const EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:170
memoryx::PersistentEntitySegment::hasEntityByNameThreadUnsafe
bool hasEntityByNameThreadUnsafe(const std::string &entityName) const
Definition: PersistentEntitySegment.cpp:376
memoryx::PersistentEntitySegment::setEntityAttribute
void setEntityAttribute(const std::string &entityId, const EntityAttributeBasePtr &attribute, const Ice::Current &) override
Definition: PersistentEntitySegment.cpp:720
memoryx::PersistentEntitySegment::hasEntityByIdThreadUnsafe
bool hasEntityByIdThreadUnsafe(const std::string &entityId) const
Definition: PersistentEntitySegment.cpp:333
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
memoryx::PersistentEntitySegment::upsertEntityList
EntityIdList upsertEntityList(const EntityBaseList &entityList, const Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:194
memoryx::PersistentEntitySegment::getIceId
::Ice::Identity getIceId(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:579
memoryx::PersistentEntitySegment::addEntityListThreadUnsafe
virtual EntityIdList addEntityListThreadUnsafe(const EntityBaseList &entityList)
Definition: PersistentEntitySegment.cpp:254
ExpressionException.h
memoryx::PersistentEntitySegment::getEntitiesByAttrValue
EntityBaseList getEntitiesByAttrValue(const ::std::string &attrName, const ::std::string &attrValue, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:473
memoryx::PersistentEntitySegment::clear
void clear(const ::Ice::Current &=Ice::emptyCurrent) override
clear removes all elements from the current memoryx::PersistentEntitySegment::writeCollection
Definition: PersistentEntitySegment.cpp:573
memoryx::MongoSerializer
Definition: MongoSerializer.h:40
memoryx::SegmentUtilImplementations::ScopedUniqueLockPtr
std::unique_ptr< ScopedSharedLock > ScopedUniqueLockPtr
Definition: SegmentUtilImplementations.h:68
memoryx::PersistentEntitySegment::useMongoIds
bool useMongoIds
Definition: PersistentEntitySegment.h:263
ARMARX_CHECK_EXPRESSION
#define ARMARX_CHECK_EXPRESSION(expression)
This macro evaluates the expression and if it turns out to be false it will throw an ExpressionExcept...
Definition: ExpressionException.h:73
memoryx::PersistentEntitySegment::removeEntity
void removeEntity(const ::std::string &entityId, const ::Ice::Current &=Ice::emptyCurrent) override
removeEntity removes an entity with the ID entityId
Definition: PersistentEntitySegment.cpp:293
memoryx::PersistentEntitySegment::hasEntityByName
bool hasEntityByName(const std::string &entityName, const Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:368
memoryx::PersistentEntitySegment::upsertEntityByName
std::string upsertEntityByName(const std::string &entityName, const EntityBasePtr &entity, const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:222
Entity.h
memoryx::PersistentEntitySegment::clearReadCollections
void clearReadCollections(const ::Ice::Current &=Ice::emptyCurrent) override
Definition: PersistentEntitySegment.cpp:77
armarx::VariantType::Int
const VariantTypeId Int
Definition: Variant.h:917
ARMARX_INFO_S
#define ARMARX_INFO_S
Definition: Logging.h:202
memoryx::PersistentEntitySegment::getAllEntityIds
EntityIdList getAllEntityIds(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:593
memoryx::PersistentEntitySegment::getEntitiesByAttrValueList
EntityBaseList getEntitiesByAttrValueList(const ::std::string &attrName, const NameList &attrValueList, const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:509
Logging.h
memoryx::PersistentEntitySegment::upsertEntityThreadUnsafe
virtual std::string upsertEntityThreadUnsafe(const std::string &entityId, const EntityBasePtr &entity)
Definition: PersistentEntitySegment.cpp:179
memoryx::SegmentUtilImplementations::ScopedSharedLockPtr
std::unique_ptr< ScopedSharedLock > ScopedSharedLockPtr
Definition: SegmentUtilImplementations.h:66
memoryx::PersistentEntitySegment::readCollections
CollectionPrxList readCollections
Definition: PersistentEntitySegment.h:256
memoryx::PersistentEntitySegment::dbSerializer
MongoSerializerPtr dbSerializer
Definition: PersistentEntitySegment.h:260
memoryx::PersistentEntitySegment::hasEntityById
bool hasEntityById(const std::string &entityId, const Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:326
memoryx::PersistentEntitySegment::segmentName
std::string segmentName
Definition: PersistentEntitySegment.h:266
memoryx::PersistentEntitySegment::getWriteCollectionNS
std::string getWriteCollectionNS(const ::Ice::Current &=Ice::emptyCurrent) const override
Definition: PersistentEntitySegment.cpp:121