Antares Simulator
Power System Simulator
operator.list.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_OPERATOR_LIST_H__
22 #define __ANTARES_TOOLBOX_FILTER_OPERATOR_LIST_H__
23 
24 #include <wx/string.h>
25 #include <yuni/yuni.h>
26 #include <vector>
27 
28 namespace Antares::Toolbox::Filter
29 {
30 // Forward declaration
31 class AFilterBase;
32 
33 namespace Operator
34 {
35 // Forward declaration
36 class AOperator;
37 
41 class List
42 {
43 public:
45 
46  List(AFilterBase* parent);
49  ~List();
51 
55  void clear();
56 
63  bool add(const wxString& name);
64 
65  void addStdArithmetic(bool withModulo = true);
66  void addStdWeekday(bool withModulo = false);
67  void addStdMonth(bool withModulo = false);
68 
69  uint size() const
70  {
71  return (uint)pItems.size();
72  }
73 
74  uint count() const
75  {
76  return (uint)pItems.size();
77  }
78 
80  bool empty() const
81  {
82  return pItems.empty();
83  }
84 
87  {
88  return pParentFilter;
89  }
90 
94  AOperator* at(const int indx) const throw()
95  {
96  return pItems[indx];
97  }
98 
100  AOperator* operator[](const int indx) const throw()
101  {
102  return pItems[indx];
103  }
104 
105 private:
106  bool internalAdd(const wxString& name);
107 
108 private:
110  AFilterBase* pParentFilter;
112  using OperatorList = std::vector<AOperator*>;
114  OperatorList pItems;
115 
116 }; // class List
117 
118 } // namespace Operator
119 } // namespace Antares::Toolbox::Filter
120 
121 #include "operator.h"
122 
123 #endif // __ANTARES_TOOLBOX_FILTER_OPERATOR_LIST_H__
Abstract Filter.
Definition: filter.h:48
Operator list.
Definition: operator.list.h:42
AFilterBase * parentFilter() const
Get the parent filter.
Definition: operator.list.h:86
bool add(const wxString &name)
Add an operator from its given name.
Definition: operator.list.cpp:108
List(AFilterBase *parent)
Constructor.
Definition: operator.list.cpp:30
~List()
Destructor.
Definition: operator.list.cpp:35
AOperator * operator[](const int indx) const
Operator [].
Definition: operator.list.h:100
AOperator * at(const int indx) const
Get the operator at a given index.
Definition: operator.list.h:94
bool empty() const
Get if the list is empty.
Definition: operator.list.h:80
void clear()
Clear the container.
Definition: operator.list.cpp:161