Skip to content

Commit

Permalink
Add local memory for testing purposes.
Browse files Browse the repository at this point in the history
  • Loading branch information
ehpor committed Dec 22, 2024
1 parent a724c94 commit cb233fb
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions catkit_core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ add_library(catkit_core STATIC
FreeListAllocator.cpp
MessageBroker.cpp
UuidGenerator.cpp
LocalMemory.cpp
proto/core.pb.cc
proto/logging.pb.cc
proto/testbed.pb.cc
Expand Down
16 changes: 16 additions & 0 deletions catkit_core/LocalMemory.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include "LocalMemory.h"

LocalMemory::LocalMemory(std::size_t num_bytes)
: m_Memory(new char[num_bytes])
{
}

LocalMemory::~LocalMemory()
{
delete[] m_Memory;
}

void *LocalMemory::GetAddress(std::size_t offset)
{
return m_Memory + offset;
}
18 changes: 18 additions & 0 deletions catkit_core/LocalMemory.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#ifndef LOCAL_MEMORY_H
#define LOCAL_MEMORY_H

#include "Memory.h"

class LocalMemory : public Memory
{
public:
LocalMemory(std::size_t num_bytes);
virtual ~LocalMemory();

virtual void *GetAddress(std::size_t offset = 0);

private:
char *m_Memory;
};

#endif // LOCAL_MEMORY_H

0 comments on commit cb233fb

Please sign in to comment.