World Builder  1.1.0-pre
A geodynamic initial conditions generator
array.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2018-2024 by the authors of the World Builder code.
3 
4  This file is part of the World Builder.
5 
6  This program is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published
8  by the Free Software Foundation, either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef WORLD_BUILDER_TYPES_ARRAY_H
21 #define WORLD_BUILDER_TYPES_ARRAY_H
22 
23 
25 
26 
27 namespace WorldBuilder
28 {
29  class Parameters;
30 
31  namespace Types
32  {
43  class Array final: public Interface
44  {
45  public:
49  Array(const Interface &type,
50  const unsigned int min_items = 0,
51  const unsigned int max_items = std::numeric_limits<unsigned int>::max(),
52  const bool unique_items = false);
53 
57  Array(Array const &other);
58 
59 
63  ~Array() override final;
64 
68  void write_schema(Parameters &prm,
69  const std::string &name,
70  const std::string &documentation) const override final;
71 
77 
87  std::unique_ptr<Interface> inner_type_ptr;
88 
89 
93  bool required;
94 
98  unsigned int min_items;
99 
103  unsigned int max_items;
104 
109 
110  protected:
111  Array *clone_impl() const override final
112  {
113  return new Array(*this);
114  };
115  };
116  } // namespace Types
117 } // namespace WorldBuilder
118 
119 #endif
unsigned int min_items
Definition: array.h:98
Array(const Interface &type, const unsigned int min_items=0, const unsigned int max_items=std::numeric_limits< unsigned int >::max(), const bool unique_items=false)
Definition: array.cc:27
std::unique_ptr< Interface > inner_type_ptr
Definition: array.h:87
unsigned int max_items
Definition: array.h:103
Types::type inner_type
Definition: array.h:76
Array * clone_impl() const override final
Definition: array.h:111
void write_schema(Parameters &prm, const std::string &name, const std::string &documentation) const override final
Definition: array.cc:59
~Array() override final