World Builder  0.1.0-pre
A geodyanmic initial conditions generator
list.cc
Go to the documentation of this file.
1 /*
2  Copyright (C) 2018 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 */
20 #include <world_builder/assert.h>
21 
22 namespace WorldBuilder
23 {
24  namespace Types
25  {
26  List::List(const Interface &type, const std::string &description)
27  :
28  inner_type_ptr(type.clone()),
29  inner_type(type.get_type()),
30  description(description)
31  {
32  this->type_name = type::List;
33  }
34 
36  :
37  inner_type_ptr(nullptr),
38  name(type.name),
39  inner_type(type.inner_type),
42  {
43  this->type_name = type::List;
44  }
45 
46  List::List(const std::string &name, const std::vector<unsigned int> &inner_type_index, const Types::type inner_type, const std::string &description)
47  :
48  inner_type_ptr(nullptr),
49  name(name),
50  inner_type_index(inner_type_index),
51  inner_type(inner_type),
52  description(description)
53  {
54  this->type_name = type::List;
55  }
56 
57 
59  {}
60 
61  std::unique_ptr<Interface>
62  List::clone() const
63  {
64  return std::unique_ptr<Interface>(new List(name,inner_type_index, inner_type, description));
65  }
66  }
67 }
68 
std::string description
Definition: list.h:109
Types::type inner_type
Definition: list.h:81
std::unique_ptr< Interface > inner_type_ptr
Definition: list.h:92
virtual std::unique_ptr< Interface > clone() const
Definition: list.cc:62
List(const Interface &type, const std::string &description)
Definition: list.cc:26
std::vector< unsigned int > inner_type_index
Definition: list.h:103
std::string name
Definition: list.h:75