WSF
WsfCoverageGridAction.hpp
Go to the documentation of this file.
1// ****************************************************************************
2// CUI
3//
4// The Advanced Framework for Simulation, Integration, and Modeling (AFSIM)
5//
6// Copyright 2020 Infoscitex, a DCS Company. All rights reserved.
7//
8// The use, dissemination or disclosure of data in this file is subject to
9// limitation or restriction. See accompanying README and LICENSE for details.
10// ****************************************************************************
11
12#ifndef WSFCOVERAGEGRIDACTION_HPP
13#define WSFCOVERAGEGRIDACTION_HPP
14
15#include <memory>
16#include <utility>
17
18#include "UtMemory.hpp"
19
20namespace wsf
21{
22namespace coverage
23{
24
25class Grid;
26class Point;
27
30{
31public:
32 virtual ~GridAction() = default;
33
34 virtual void Call(const Grid& aGrid, const Point& aPoint) = 0;
35};
36
41template<typename Callable>
42class GridActionT : public GridAction
43{
44public:
45 explicit GridActionT(Callable&& aCallable)
46 : mCallable{aCallable}
47 {
48 }
49 ~GridActionT() override = default;
50
51 void Call(const Grid& aGrid, const Point& aPoint) override { mCallable(aGrid, aPoint); }
52
53private:
54 Callable mCallable;
55};
56
61template<typename Callable>
62std::unique_ptr<GridAction> CreateGridAction(Callable&& aCallable)
63{
64 return ut::make_unique<GridActionT<Callable>>(std::forward<Callable>(aCallable));
65}
66
67} // namespace coverage
68} // namespace wsf
69
70#endif // WSFCOVERAGEGRIDACTION_HPP
GridActionT(Callable &&aCallable)
Definition WsfCoverageGridAction.hpp:45
void Call(const Grid &aGrid, const Point &aPoint) override
Definition WsfCoverageGridAction.hpp:51
~GridActionT() override=default
An object that can be invoked for each point in a grid.
Definition WsfCoverageGridAction.hpp:30
virtual void Call(const Grid &aGrid, const Point &aPoint)=0
virtual ~GridAction()=default
The Grid object defines the region over which coverage can be computed.
Definition WsfCoverageGrid.hpp:38
A point in a coverage grid.
Definition WsfCoverageGridPoint.hpp:40
Definition WsfCoverage.cpp:35
std::unique_ptr< GridAction > CreateGridAction(Callable &&aCallable)
Definition WsfCoverageGridAction.hpp:62
Function definitions for those who need run-time access to the version.
Definition WsfComm.cpp:32
Copyrights Multiple, All Rights Reserved