KADATH
param.hpp
1 /*
2  Copyright 2017 Philippe Grandclement
3 
4  This file is part of Kadath.
5 
6  Kadath is free software: you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  Kadath 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 General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License
17  along with Kadath. If not, see <http://www.gnu.org/licenses/>.
18 */
19 
20 #ifndef __PARAM_HPP_
21 #define __PARAM_HPP_
22 
23 namespace Kadath {
30 class Param {
31 
32  // Data :
33  // -----
34  private:
35  int n_int ;
37  int* p_int ;
38 
39  int n_double ;
41  double* p_double ;
42 
43  // Constructors - Destructor
44  // -------------------------
45 
46  public:
47  Param() ;
48 
49  private:
53  Param(const Param& ) ;
54 
55  public:
56  ~Param() ;
57 
58 
59  // Assignment
60  // -----------
61  private:
65  void operator=(const Param& ) ;
66 
67 
68  // Addition/Extraction of one element
69  // ----------------------------------
70  public:
71 
73  int get_n_int() const ;
74 
84  void add_int(int n, int position = 0) ;
85 
95  const int& get_int(int position = 0) const;
96 
98  int get_n_int_mod() const ;
99 
100 
102  int get_n_double() const ;
103 
113  void add_double(double x, int position = 0) ;
114 
124  const double& get_double(int position = 0) const;
125 
126  };
127 }
128 #endif
Parameter storage.
Definition: param.hpp:30
Param(const Param &)
Copy constructor (private and not implemented to make Param a non-copyable class)
int n_double
Number of double 's (double precis.
Definition: param.hpp:39
~Param()
Destructor.
Definition: param.cpp:39
Param()
Default constructor is the only constructor.
Definition: param.cpp:30
void operator=(const Param &)
Assignment operator (private and not implemented to make Param a non-copyable class)
int get_n_double() const
Returns the number of stored double 's addresses.
Definition: param.cpp:108
int * p_int
Array (size n_int ) of the int 's addresses.
Definition: param.hpp:37
int n_int
Number of int 's (integers).
Definition: param.hpp:35
double * p_double
Array (size n_double ) of the double 's addresses.
Definition: param.hpp:41
void add_double(double x, int position=0)
Adds the the address of a new double to the list.
Definition: param.cpp:115
void add_int(int n, int position=0)
Adds the address of a new int to the list.
Definition: param.cpp:60
int get_n_int_mod() const
Returns the number of modifiable int 's addresses in the list.
const double & get_double(int position=0) const
Returns the reference of a double stored in the list.
Definition: param.cpp:148
const int & get_int(int position=0) const
Returns the reference of a int stored in the list.
Definition: param.cpp:92
int get_n_int() const
Returns the number of stored int 's addresses.
Definition: param.cpp:53