36 std::vector<SharedMemoryInstance<Grain>>
_grains;
47 _grains.reserve(flowInfo()->config.discrete.grainCount);
51 :
FlowData{flowFilePath, mode, lockMode}
72 throw std::invalid_argument{
73 fmt::format(
"Unsupported grain version: {}, supported version is: {}", grain.get()->header.info.version,
GRAIN_HEADER_VERSION)};
77 return _grains.emplace_back(std::move(grain)).get();
92 if (
auto const grain =
grainAt(i); grain !=
nullptr)
94 return &grain->header.info;
101 if (
auto const grain =
grainAt(i); grain !=
nullptr)
103 return &grain->header.info;
112 auto const mapped =
_grains[i].mappedSize();
113 return (mapped >
sizeof(
Grain)) ? (mapped -
sizeof(
Grain)) : 0U;
Internal shared-memory headers for discrete grains and event slots.
Grain * emplaceGrain(char const *grainFilePath, std::size_t grainPayloadSize)
Grain * grainAt(std::size_t i) noexcept
std::size_t grainCount() const noexcept
DiscreteFlowData(SharedMemoryInstance< Flow > &&flowSegement) noexcept
mxlGrainInfo * grainInfoAt(std::size_t i) noexcept
std::vector< SharedMemoryInstance< Grain > > _grains
std::size_t grainPayloadCapacityAt(std::size_t i) const noexcept
Return the number of payload bytes mapped after the header of grain i, or 0 if i is out of range.
constexpr AccessMode accessMode() const noexcept
constexpr bool created() const noexcept
constexpr FlowData(SharedMemoryInstance< Flow > &&flowSegement) noexcept
constexpr mxlFlowInfo * flowInfo() noexcept
struct mxlGrainInfo_t mxlGrainInfo
constexpr auto GRAIN_HEADER_VERSION
The version of the grain header structs in shared memory that we expect an support.