Skip to content
Snippets Groups Projects
Commit 1d1e408e authored by Fabian Reister's avatar Fabian Reister
Browse files

removing orphaned files

parent 56320099
No related branches found
No related tags found
No related merge requests found
#include "MemoryConnector.h"
#include <ArmarXCore/core/ManagedIceObject.h>
#include <ArmarXCore/core/application/properties/PropertyDefinitionContainer.h>
#include <ArmarXCore/core/exceptions/local/ExpressionException.h>
namespace armarx::armem
{
MemoryConnector::MemoryConnector(ManagedIceObject& component) : component(component) {}
MemoryConnector::~MemoryConnector() = default;
void MemoryConnector::registerPropertyDefinitions(PropertyDefinitionsPtr& def)
{
const std::string prefix = getPropertyPrefix();
ARMARX_INFO << "Memory connector: registerPropertyDefinitions with prefix " << prefix;
def->component(memoryNameSystem, "ArMemMemoryNameSystem", prefix + "ArMemMemoryNameSystem");
}
armem::data::WaitForMemoryResult MemoryConnector::useMemory(const std::string& memoryName)
{
armem::data::WaitForMemoryInput input;
input.name = memoryName;
ARMARX_CHECK_NOT_NULL(memoryNameSystem);
ARMARX_INFO << "Waiting for memory ...";
armem::data::WaitForMemoryResult result = memoryNameSystem->waitForMemory(input);
if (result.success)
{
// Add dependency.
component.usingProxy(result.proxy->ice_getIdentity().name);
}
else
{
ARMARX_WARNING << "Use memory: Failure";
}
return result;
}
const std::string& MemoryConnector::getPropertyPrefix() const
{
return propertyPrefix;
}
} // namespace armarx::armem
/*
* This file is part of ArmarX.
*
* ArmarX is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* ArmarX is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* @package RobotAPI::ArmarXObjects::
* @author Fabian Reister ( fabian dot reister at kit dot edu )
* @date 2021
* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
* GNU General Public License
*/
#pragma once
// TODO(fabian.reister): remove
#include <ArmarXCore/core/application/properties/PropertyDefinitionContainer.h>
#include <RobotAPI/interface/armem/mns/MemoryNameSystemInterface.h>
namespace armarx
{
class ManagedIceObject;
}
namespace armarx::armem
{
/**
* @brief The MemoryConnector class simplifies connecting to the ArMem memory.
*
* Use this as the base class of any class that needs to connect to the memory.
*
*
*/
class MemoryConnector
{
public:
MemoryConnector(ManagedIceObject& component);
virtual ~MemoryConnector();
protected:
armem::data::WaitForMemoryResult useMemory(const std::string& memoryName);
void registerPropertyDefinitions(PropertyDefinitionsPtr& def);
void waitForMemory();
virtual const std::string& getPropertyPrefix() const;
private:
ManagedIceObject& component;
armem::mns::MemoryNameSystemInterfacePrx memoryNameSystem;
const std::string propertyPrefix;
};
} // namespace armarx::armem
\ No newline at end of file
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