Antares Simulator
Power System Simulator
operator.h
1 /*
2  * Copyright 2007-2025, RTE (https://www.rte-france.com)
3  * See AUTHORS.txt
4  * SPDX-License-Identifier: MPL-2.0
5  * This file is part of Antares-Simulator,
6  * Adequacy and Performance assessment for interconnected energy networks.
7  *
8  * Antares_Simulator is free software: you can redistribute it and/or modify
9  * it under the terms of the Mozilla Public Licence 2.0 as published by
10  * the Mozilla Foundation, either version 2 of the License, or
11  * (at your option) any later version.
12  *
13  * Antares_Simulator is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * Mozilla Public Licence 2.0 for more details.
17  *
18  * You should have received a copy of the Mozilla Public Licence 2.0
19  * along with Antares_Simulator. If not, see <https://opensource.org/license/mpl-2-0/>.
20  */
21 #ifndef __ANTARES_TOOLBOX_FILTER_OPERATION_H__
22 #define __ANTARES_TOOLBOX_FILTER_OPERATION_H__
23 
24 #include <wx/sizer.h>
25 #include "filter.h"
26 #include "parameter/parameter.h"
27 
28 namespace Antares::Toolbox::Filter
29 {
30 // Forward declaration
31 class AFilterBase;
32 
33 namespace Operator
34 {
35 class AOperator
36 {
37 public:
39 
40  AOperator(AFilterBase* parent, const wxChar* name, const wxChar* caption);
43  virtual ~AOperator();
44 
46 
48 
49  const wxString& name() const
51  {
52  return pName;
53  }
54 
56 
58 
59  const wxString& caption() const
61  {
62  return pCaption;
63  }
64 
66  void caption(const wxString& v);
68 
69  virtual bool compute(const int a) const = 0;
70  virtual bool compute(const double a) const = 0;
71  virtual bool compute(const wxString& a) const = 0;
72 
74  template<typename U>
75  bool operator()(const U& a, const U& b) const
76  {
77  return compute(a, b);
78  }
79 
83  wxSizer* sizer(wxWindow* parent);
84 
85  void refreshAttachedGrid();
86 
87 public:
89  Parameter::List parameters;
90 
91 private:
92  AFilterBase* pParentFilter;
94  const wxString pName;
96  wxString pCaption;
98  wxSizer* pSizer;
99 
100 }; // class AOperator
101 
102 } // namespace Operator
103 } // namespace Antares::Toolbox::Filter
104 
105 #endif // __ANTARES_TOOLBOX_FILTER_OPERATION_H__
Abstract Filter.
Definition: filter.h:48
const wxString & name() const
Get the name of the operator.
Definition: operator.h:50
bool operator()(const U &a, const U &b) const
Operator ()
Definition: operator.h:75
virtual ~AOperator()
Destructor.
Definition: operator.cpp:35
wxSizer * sizer(wxWindow *parent)
Get the sizer with all controls to interact with parameters.
Definition: operator.cpp:39
Parameter::List parameters
Additional parameters.
Definition: operator.h:89
void caption(const wxString &v)
Set the caption of the filter.
const wxString & caption() const
Get the caption of the filter.
Definition: operator.h:60
AOperator(AFilterBase *parent, const wxChar *name, const wxChar *caption)
namespace Constructor & Destructor
Definition: operator.cpp:26