template <size_t NUM_REGISTRIES>
class OperationRegistryT : public OperationRegistryI {
+ Operation::id_t next_id = 0;
std::array<
op_list,
NUM_REGISTRIES
> registries;
- std::array<
- uint64_t,
- NUM_REGISTRIES
- > op_id_counters = {};
-
protected:
void do_register(Operation *op) final {
const auto op_type = op->get_type();
registries[op_type].push_back(*op);
- op->set_id(++op_id_counters[op_type]);
+ op->set_id(++next_id);
}
bool registries_empty() const final {
}
protected:
- OperationRegistryT(core_id_t core) {
+ OperationRegistryT(core_id_t core)
// Use core to initialize upper 8 bits of counters to ensure that
// ids generated by different cores are disjoint
- op_id_counters.fill(
- static_cast<id_t>(core) <<
- (std::numeric_limits<id_t>::digits - 8));
- }
+ : next_id(static_cast<id_t>(core) <<
+ (std::numeric_limits<id_t>::digits - 8))
+ {}
template <size_t REGISTRY_INDEX>
const op_list& get_registry() const {