1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

lib/memory-manager: pass strings as const reference

This commit is contained in:
Daniel Krebs 2018-02-13 19:54:18 +01:00
parent 73c6ae1f71
commit e8ef3e4380
2 changed files with 10 additions and 5 deletions

View file

@ -152,7 +152,8 @@ public:
/// Create a default mapping
MappingId
createMapping(uintptr_t src, uintptr_t dest, size_t size, std::string name,
createMapping(uintptr_t src, uintptr_t dest, size_t size,
const std::string& name,
AddressSpaceId fromAddrSpace,
AddressSpaceId toAddrSpace);
@ -167,7 +168,7 @@ public:
AddressSpaceId
findAddressSpace(std::string name);
findAddressSpace(const std::string& name);
MemoryTranslation
getTranslation(AddressSpaceId fromAddrSpaceId, AddressSpaceId toAddrSpaceId);
@ -177,9 +178,13 @@ public:
{ return getTranslation(getProcessAddressSpace(), foreignAddrSpaceId); }
static std::string
getSlaveAddrSpaceName(std::string ipInstance, std::string memoryBlock)
getSlaveAddrSpaceName(const std::string& ipInstance, const std::string& memoryBlock)
{ return ipInstance + "/" + memoryBlock; }
static std::string
getMasterAddrSpaceName(const std::string& ipInstance, const std::string& busInterface)
{ return ipInstance + ":" + busInterface; }
void
dump()
{ memoryGraph.dump(); }

View file

@ -39,7 +39,7 @@ MemoryManager::getOrCreateAddressSpace(std::string name)
MemoryManager::MappingId
MemoryManager::createMapping(uintptr_t src, uintptr_t dest, size_t size,
std::string name,
const std::string& name,
MemoryManager::AddressSpaceId fromAddrSpace,
MemoryManager::AddressSpaceId toAddrSpace)
{
@ -62,7 +62,7 @@ MemoryManager::addMapping(std::shared_ptr<Mapping> mapping,
}
MemoryManager::AddressSpaceId
MemoryManager::findAddressSpace(std::string name)
MemoryManager::findAddressSpace(const std::string& name)
{
return memoryGraph.findVertex(
[&](const std::shared_ptr<AddressSpace>& v) {