Ignition Physics

API Reference

2.0.0
OperateOnSpecifiedData< Specification, SpecFinder, Operation, Performer > Class Template Reference

OperateOnSpecifiedData allows us to statically analyze whether a class (Performer) can perform an operation on all the relevant types within a CompositeData Specification. It also provides functions for performing that operation. More...

#include <OperateOnSpecifiedData.hh>

Static Public Member Functions

template<typename CompositeType >
static void Operate (Performer *_performer, CompositeType &_data, const DataStatusMask &_mask, const bool _onlyCompile=false)
 Operate is the recommended entry point for using OperateOnSpecifiedData. This can be given a performer, a CompositeType object, and a DataStatusMask to determine its behavior. More...
 

Detailed Description

template<typename Specification, template< typename > class SpecFinder, template< typename, typename, typename > class Operation, class Performer>
class ignition::physics::OperateOnSpecifiedData< Specification, SpecFinder, Operation, Performer >

OperateOnSpecifiedData allows us to statically analyze whether a class (Performer) can perform an operation on all the relevant types within a CompositeData Specification. It also provides functions for performing that operation.

Specification can be created using SpecifyData, ExpectData, and RequireData.

SpecFinder is a templated class that can be passed a Specification and return a Data type (or return void if Specification does not contain the desired data specification). This is already implemented as FindExpected and FindRequired, but custom SpecFinders are permitted.

Operation is a templated class which accepts template arguments of Data, Performer, and CompositeType. It must also provide a static function called Operate which accepts arguments of type Performer* and CompositeData&.

Performer is the type of class which is expected to perform the operation.

Member Function Documentation

◆ Operate()

static void Operate ( Performer *  _performer,
CompositeType &  _data,
const DataStatusMask _mask,
const bool  _onlyCompile = false 
)
static

Operate is the recommended entry point for using OperateOnSpecifiedData. This can be given a performer, a CompositeType object, and a DataStatusMask to determine its behavior.

For each type in Specification, the _performer will query _data for the type, and then perform Operation on that data type. The _mask information is used to tune the behavior to only perform the operations on components of _data that meet the criteria.

Setting onlyCompile to true will short-circuit the entire operation. This can be useful for static analysis. The function will cost very nearly nothing during run-time, but it will prevent code from compiling if its conditions are not met.

Parameters
[in,out]_performerThe object that will perform the operation.
[in,out]_dataThe object that will be operated on.
[in]_maskAn object to tune which data components are operated on.
[in]_onlyCompileHave this function compile to make sure that it can compile, but do not perform any operations.

The documentation for this class was generated from the following file: