First step for better vector encapsulation
This commit is contained in:
committed by
Patrick Niklaus
parent
4c2d578561
commit
f558b16147
@@ -4,6 +4,7 @@
|
||||
#include "storage/block.hpp"
|
||||
#include "storage/io_fwd.hpp"
|
||||
|
||||
#include "util/vector_view.hpp"
|
||||
#include "util/exception.hpp"
|
||||
#include "util/exception_utils.hpp"
|
||||
#include "util/log.hpp"
|
||||
@@ -86,6 +87,18 @@ class DataLayout
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
util::vector_view<T> GetVector(char* shared_memory, const std::string& name) const
|
||||
{
|
||||
return util::vector_view<T>(GetBlockPtr<T>(shared_memory, name), GetBlockEntries(name));
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
util::vector_view<T> GetWritableVector(char* shared_memory, const std::string& name) const
|
||||
{
|
||||
return util::vector_view<T>(GetBlockPtr<T, true>(shared_memory, name), GetBlockEntries(name));
|
||||
}
|
||||
|
||||
template <typename T, bool WRITE_CANARY = false>
|
||||
inline T *GetBlockPtr(char *shared_memory, const std::string &name) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user