Skip to content
Snippets Groups Projects
Commit 08228568 authored by Rainer Kartmann's avatar Rainer Kartmann
Browse files

Update usages of id() and aronType()

parent 5a65fd97
No related branches found
No related tags found
2 merge requests!140armem/dev -> master,!136Memory structure changes, query_proc structure changes (Base classes / templated)
Showing with 27 additions and 39 deletions
...@@ -36,14 +36,6 @@ ...@@ -36,14 +36,6 @@
using armarx::armem::example::ExampleData; using armarx::armem::example::ExampleData;
namespace armem = armarx::armem; namespace armem = armarx::armem;
/*
BOOST_AUTO_TEST_CASE(test_ExampleData)
{
ExampleData data;
BOOST_CHECK(true);
}
*/
BOOST_AUTO_TEST_CASE(test_ExampleData_type) BOOST_AUTO_TEST_CASE(test_ExampleData_type)
{ {
...@@ -55,5 +47,5 @@ BOOST_AUTO_TEST_CASE(test_ExampleData_type) ...@@ -55,5 +47,5 @@ BOOST_AUTO_TEST_CASE(test_ExampleData_type)
armem::wm::CoreSegment& core = memory.addCoreSegment("ExampleData", type); armem::wm::CoreSegment& core = memory.addCoreSegment("ExampleData", type);
armem::wm::ProviderSegment& prov = core.addProviderSegment("Provider"); armem::wm::ProviderSegment& prov = core.addProviderSegment("Provider");
BOOST_CHECK_EQUAL(core.aronType, prov.aronType); BOOST_CHECK_EQUAL(core.aronType(), prov.aronType());
} }
...@@ -19,12 +19,12 @@ namespace armarx::armem::base ...@@ -19,12 +19,12 @@ namespace armarx::armem::base
public: public:
EntityInstanceBase& operator=(const EntityInstanceBase& other)
using DerivedT = _DerivedT; using DerivedT = _DerivedT;
public: public:
EntityInstanceBase& operator=(const EntityInstanceBase& other)
{ {
//other._copySelf(*this); //other._copySelf(*this);
return *this; return *this;
......
...@@ -18,7 +18,7 @@ namespace armarx::armem::d_ltm ...@@ -18,7 +18,7 @@ namespace armarx::armem::d_ltm
} }
EntityInstance::EntityInstance(const EntityInstance& other) : EntityInstance::EntityInstance(const EntityInstance& other) :
base::detail::MemoryItem(other.id) base::detail::MemoryItem(other.id())
{ {
} }
...@@ -40,7 +40,7 @@ namespace armarx::armem::d_ltm ...@@ -40,7 +40,7 @@ namespace armarx::armem::d_ltm
bool EntityInstance::equalsDeep(const EntityInstance& other) const bool EntityInstance::equalsDeep(const EntityInstance& other) const
{ {
return id == other.id; return id() == other.id();
} }
void EntityInstance::update(const EntityUpdate& update, int index) void EntityInstance::update(const EntityUpdate& update, int index)
...@@ -73,7 +73,7 @@ namespace armarx::armem::d_ltm ...@@ -73,7 +73,7 @@ namespace armarx::armem::d_ltm
std::filesystem::path EntityInstance::_fullPath(const std::filesystem::path& path) const std::filesystem::path EntityInstance::_fullPath(const std::filesystem::path& path) const
{ {
return path / id.memoryName / id.coreSegmentName / id.providerSegmentName / id.entityName / std::to_string(id.timestamp.toMicroSeconds()) / std::to_string(id.instanceIndex); return path / id().memoryName / id().coreSegmentName / id().providerSegmentName / id().entityName / std::to_string(id().timestamp.toMicroSeconds()) / std::to_string(id().instanceIndex);
} }
wm::EntityInstance EntityInstance::convert(const aron::typenavigator::NavigatorPtr& expectedStructure) const wm::EntityInstance EntityInstance::convert(const aron::typenavigator::NavigatorPtr& expectedStructure) const
...@@ -143,7 +143,7 @@ namespace armarx::armem::d_ltm ...@@ -143,7 +143,7 @@ namespace armarx::armem::d_ltm
wm::EntityInstance EntityInstance::unwrapData(const aron::datanavigator::DictNavigatorPtr& dataWrapped) const wm::EntityInstance EntityInstance::unwrapData(const aron::datanavigator::DictNavigatorPtr& dataWrapped) const
{ {
wm::EntityInstance e(id); wm::EntityInstance e(id());
wm::EntityInstanceMetadata& metadata = e.metadata(); wm::EntityInstanceMetadata& metadata = e.metadata();
if (dataWrapped->hasElement(DATA_WRAPPER_DATA_FIELD)) if (dataWrapped->hasElement(DATA_WRAPPER_DATA_FIELD))
...@@ -193,7 +193,7 @@ namespace armarx::armem::d_ltm ...@@ -193,7 +193,7 @@ namespace armarx::armem::d_ltm
dataWrapped->addElement(DATA_WRAPPER_TIME_ARRIVED_FIELD, timeArrived); dataWrapped->addElement(DATA_WRAPPER_TIME_ARRIVED_FIELD, timeArrived);
auto confidence = std::make_shared<aron::datanavigator::DoubleNavigator>(); auto confidence = std::make_shared<aron::datanavigator::DoubleNavigator>();
confidence->setValue(metadata.confidence); confidence->setValue(static_cast<double>(metadata.confidence));
dataWrapped->addElement(DATA_WRAPPER_CONFIDENCE_FIELD, confidence); dataWrapped->addElement(DATA_WRAPPER_CONFIDENCE_FIELD, confidence);
return dataWrapped; return dataWrapped;
......
...@@ -18,7 +18,7 @@ namespace armarx::armem::ltm ...@@ -18,7 +18,7 @@ namespace armarx::armem::ltm
} }
EntityInstance::EntityInstance(const EntityInstance& other) : EntityInstance::EntityInstance(const EntityInstance& other) :
MemoryItem(other.id), MemoryItem(other.id()),
_metadata(other._metadata) _metadata(other._metadata)
{ {
} }
......
...@@ -19,7 +19,7 @@ namespace armarx::armem::wm ...@@ -19,7 +19,7 @@ namespace armarx::armem::wm
} }
EntityInstance::EntityInstance(const EntityInstance& other) : EntityInstance::EntityInstance(const EntityInstance& other) :
base::detail::MemoryItem(other.id), base::detail::MemoryItem(other.id()),
_metadata(other._metadata), _metadata(other._metadata),
_data(other._data) _data(other._data)
{ {
......
...@@ -54,10 +54,10 @@ BOOST_AUTO_TEST_CASE(test_entity) ...@@ -54,10 +54,10 @@ BOOST_AUTO_TEST_CASE(test_entity)
armem::data::EntityPtr ice; armem::data::EntityPtr ice;
armem::toIce(ice, entity); armem::toIce(ice, entity);
BOOST_CHECK_EQUAL(ice->id().memoryName, entity.id.memoryName); BOOST_CHECK_EQUAL(ice->id.memoryName, entity.id().memoryName);
BOOST_CHECK_EQUAL(ice->id().coreSegmentName, entity.id.coreSegmentName); BOOST_CHECK_EQUAL(ice->id.coreSegmentName, entity.id().coreSegmentName);
BOOST_CHECK_EQUAL(ice->id().providerSegmentName, entity.id.providerSegmentName); BOOST_CHECK_EQUAL(ice->id.providerSegmentName, entity.id().providerSegmentName);
BOOST_CHECK_EQUAL(ice->id().entityName, entity.id.entityName); BOOST_CHECK_EQUAL(ice->id.entityName, entity.id().entityName);
BOOST_CHECK_EQUAL(ice->history.size(), entity.history().size()); BOOST_CHECK_EQUAL(ice->history.size(), entity.history().size());
......
...@@ -98,7 +98,7 @@ namespace armarx::armem::gui::instance ...@@ -98,7 +98,7 @@ namespace armarx::armem::gui::instance
instance = &memory.getEntityInstance(id); instance = &memory.getEntityInstance(id);
if (useTypeInfo) if (useTypeInfo)
{ {
aronType = memory.getCoreSegment(id.coreSegmentName).getProviderSegment(id.providerSegmentName).aronType; aronType = memory.getCoreSegment(id.coreSegmentName).getProviderSegment(id.providerSegmentName).aronType();
} }
} }
catch (const armem::error::ArMemError& e) catch (const armem::error::ArMemError& e)
...@@ -124,7 +124,7 @@ namespace armarx::armem::gui::instance ...@@ -124,7 +124,7 @@ namespace armarx::armem::gui::instance
{ {
if (currentInstance) if (currentInstance)
{ {
updateInstanceID(currentInstance->id); updateInstanceID(currentInstance->id());
updateMetaData(currentInstance->metadata()); updateMetaData(currentInstance->metadata());
updateData(currentInstance->data(), currentAronType); updateData(currentInstance->data(), currentAronType);
updateImageView(currentInstance->data()); updateImageView(currentInstance->data());
......
...@@ -261,11 +261,11 @@ namespace armarx::armem::gui::memory ...@@ -261,11 +261,11 @@ namespace armarx::armem::gui::memory
columns.insert(int(Columns::SIZE), ""); columns.insert(int(Columns::SIZE), "");
columns.insert(int(Columns::TYPE), ""); columns.insert(int(Columns::TYPE), "");
columns.insert(int(Columns::LEVEL), QString::fromStdString(simox::alg::capitalize_words(memoryItem.getLevelName()))); columns.insert(int(Columns::LEVEL), QString::fromStdString(simox::alg::capitalize_words(memoryItem.getLevelName())));
columns.insert(int(Columns::ID), QString::fromStdString(memoryItem.id.str())); columns.insert(int(Columns::ID), QString::fromStdString(memoryItem.id().str()));
QTreeWidgetItem* item = new QTreeWidgetItem(columns); QTreeWidgetItem* item = new QTreeWidgetItem(columns);
item->setData(int(Columns::LEVEL), Qt::UserRole, QString::fromStdString(memoryItem.getLevelName())); item->setData(int(Columns::LEVEL), Qt::UserRole, QString::fromStdString(memoryItem.getLevelName()));
item->setData(int(Columns::ID), Qt::UserRole, QString::fromStdString(memoryItem.id.str())); item->setData(int(Columns::ID), Qt::UserRole, QString::fromStdString(memoryItem.id().str()));
item->setTextAlignment(int(Columns::SIZE), Qt::AlignRight); item->setTextAlignment(int(Columns::SIZE), Qt::AlignRight);
return item; return item;
} }
...@@ -289,9 +289,9 @@ namespace armarx::armem::gui::memory ...@@ -289,9 +289,9 @@ namespace armarx::armem::gui::memory
{ {
updateContainerItem(container, item); updateContainerItem(container, item);
std::string typeName; std::string typeName;
if (container.aronType) if (container.aronType())
{ {
typeName = container.aronType->getName(); typeName = container.aronType()->getName();
std::string del = "::"; std::string del = "::";
size_t find = typeName.rfind(del); size_t find = typeName.rfind(del);
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include <RobotAPI/libraries/armem/core/workingmemory/CoreSegment.h> #include <RobotAPI/libraries/armem/core/workingmemory/CoreSegment.h>
#include <RobotAPI/libraries/armem/core/workingmemory/EntityInstance.h> #include <RobotAPI/libraries/armem/core/workingmemory/EntityInstance.h>
#include <RobotAPI/libraries/armem/core/workingmemory/Memory.h> #include <RobotAPI/libraries/armem/core/workingmemory/Memory.h>
#include <RobotAPI/libraries/armem/core/workingmemory/Entity.h>
#include <RobotAPI/libraries/armem/core/workingmemory/ProviderSegment.h> #include <RobotAPI/libraries/armem/core/workingmemory/ProviderSegment.h>
#include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h> #include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
#include <RobotAPI/libraries/armem/util/util.h> #include <RobotAPI/libraries/armem/util/util.h>
...@@ -38,11 +39,6 @@ ...@@ -38,11 +39,6 @@
#include <RobotAPI/libraries/armem_robot_mapping/types.h> #include <RobotAPI/libraries/armem_robot_mapping/types.h>
namespace armarx::armem
{
class Entity;
} // namespace armarx
namespace armarx::armem namespace armarx::armem
{ {
...@@ -108,7 +104,7 @@ namespace armarx::armem ...@@ -108,7 +104,7 @@ namespace armarx::armem
.coreSegments().withName(properties.mappingMemoryName) .coreSegments().withName(properties.mappingMemoryName)
.providerSegments().withName(query.agent) .providerSegments().withName(query.agent)
.entities().withNames(query.sensorList) .entities().withNames(query.sensorList)
.snapshots().timeRange(query.timeRange.min,query.timeRange.max); .snapshots().timeRange(query.timeRange.min, query.timeRange.max);
// clang-format on // clang-format on
} }
...@@ -116,7 +112,7 @@ namespace armarx::armem ...@@ -116,7 +112,7 @@ namespace armarx::armem
} }
std::vector<LaserScanStamped> asLaserScans(const std::map<std::string, Entity>& entities) std::vector<LaserScanStamped> asLaserScans(const std::map<std::string, wm::Entity>& entities)
{ {
std::vector<LaserScanStamped> outV; std::vector<LaserScanStamped> outV;
...@@ -125,7 +121,7 @@ namespace armarx::armem ...@@ -125,7 +121,7 @@ namespace armarx::armem
ARMARX_WARNING << "No entities!"; ARMARX_WARNING << "No entities!";
} }
const auto convert = [](const arondto::LaserScanStamped & aronLaserScanStamped, const EntityInstance & ei) -> LaserScanStamped const auto convert = [](const arondto::LaserScanStamped & aronLaserScanStamped, const wm::EntityInstance & ei) -> LaserScanStamped
{ {
LaserScanStamped laserScanStamped; LaserScanStamped laserScanStamped;
fromAron(aronLaserScanStamped, laserScanStamped); fromAron(aronLaserScanStamped, laserScanStamped);
...@@ -145,16 +141,16 @@ namespace armarx::armem ...@@ -145,16 +141,16 @@ namespace armarx::armem
// loop over all entities and their snapshots // loop over all entities and their snapshots
for (const auto &[s, entity] : entities) for (const auto &[s, entity] : entities)
{ {
if (entity.history.empty()) if (entity.empty())
{ {
ARMARX_WARNING << "Empty history for " << s; ARMARX_WARNING << "Empty history for " << s;
} }
ARMARX_INFO << "History size: " << entity.history.size(); ARMARX_INFO << "History size: " << entity.size();
for (const auto &[ss, entitySnapshot] : entity.history) for (const auto &[ss, entitySnapshot] : entity)
{ {
for (const auto& entityInstance : entitySnapshot.instances) for (const auto& entityInstance : entitySnapshot.instances())
{ {
const auto o = tryCast<arondto::LaserScanStamped>(entityInstance); const auto o = tryCast<arondto::LaserScanStamped>(entityInstance);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment