15 #ifndef CORE_OPERATION_OPERATION_H_
16 #define CORE_OPERATION_OPERATION_H_
79 "AgentOperationImpl do not support this function operator");
89 "StandaloneOperationImpl do not support this function operator");
104 explicit Operation(
const std::string &name);
111 Operation(
const std::string &name, uint32_t frequency);
137 template <
typename T>
139 T *implementation =
nullptr;
142 if (
dynamic_cast<T *
>(imp)) {
143 implementation =
dynamic_cast<T *
>(imp);
146 return implementation;
179 if (filter ==
nullptr) {
Contains code required by all agents.
static void Fatal(const std::string &location, const Args &... parts)
Prints fatal error message.
std::string OpComputeTargetString(OpComputeTarget t)
Interface for implementing an operation.
bool IsStandalone() override
Returns whether or not this operations is a stand-alone operation.
void operator()() override
OpComputeTarget target_
The target that this operation implementation is supposed to run on.
bool IsGpuOperation() const
Returns whether or not this operation is supposed to run on a GPU.
virtual bool IsStandalone()=0
Returns whether or not this operations is a stand-alone operation.
virtual OperationImpl * Clone()=0
virtual void operator()(Agent *agent)=0
virtual void operator()()=0
virtual ~OperationImpl()=default
T * GetImplementation()
Returns the implementation corresponding to the template argument.
bool IsExcluded(Functor< bool, Agent * > *filter)
std::string name_
Operation name / unique identifier.
void SelectComputeTarget(OpComputeTarget target)
bool IsComputeTargetSupported(OpComputeTarget target)
void TearDown()
Forwards call to implementation's TearDown function.
std::vector< OperationImpl * > implementations_
The different operation implementations for each supported compute target.
void SetExcludeFilters(const std::set< Functor< bool, Agent * > * > &exclude_filters)
std::set< Functor< bool, Agent * > * > exclude_filters_
If this is an agent operation don't run it for this list of filters.
Operation(const std::string &name)
OpComputeTarget active_target_
The compute target that this operation will be executed on.
void AddOperationImpl(OpComputeTarget target, OperationImpl *impl)
void SetUp()
Forwards call to implementation's Setup function.
Interface for implementing an operation that should run on a GPU.
bool IsStandalone() override
Returns whether or not this operations is a stand-alone operation.
void operator()(Agent *agent) override