-
Notifications
You must be signed in to change notification settings - Fork 7
/
rcpp_interface_base.hpp
76 lines (66 loc) · 2.21 KB
/
rcpp_interface_base.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* File: rcpp_interface_base.hpp
*
* This File is part of the NOAA, National Marine Fisheries Service
* Fisheries Integrated Modeling System project. See LICENSE file
* for reuse information.
*
*/
#ifndef FIMS_INTERFACE_RCPP_RCPP_OBJECTS_RCPP_INTERFACE_BASE_HPP
#define FIMS_INTERFACE_RCPP_RCPP_OBJECTS_RCPP_INTERFACE_BASE_HPP
#include <map>
#include <vector>
#include "../../../common/def.hpp"
#include "../../../common/information.hpp"
#include "../../interface.hpp"
#define RCPP_NO_SUGAR
#include <Rcpp.h>
/**
* @brief RcppInterface class that defines
* the interface between R and C++ for parameter types.
*/
class Parameter {
public:
double value_m; /**< initial value of the parameter*/
double min_m =
std::numeric_limits<double>::min(); /**< min value of the parameter*/
double max_m =
std::numeric_limits<double>::max(); /**< max value of the parameter*/
bool is_random_effect_m = false; /**< Is the parameter a random effect
parameter? Default value is false.*/
bool estimated_m =
false; /**< Is the parameter estimated? Default value is false.*/
/**
* @brief Constructor for initializing Parameter.
* @details Inputs include value, min, max, estimated.
*/
Parameter(double value, double min, double max, bool estimated)
: value_m(value), min_m(min), max_m(max), estimated_m(estimated) {}
/**
* @brief Constructor for initializing Parameter.
* @details Inputs include value.
*/
Parameter(double value) { value_m = value; }
/**
* @brief Constructor for initializing Parameter.
* @details Set value to 0 when there is no input value.
*/
Parameter() { value_m = 0; }
};
/**
*@brief Base class for all interface objects
*/
class FIMSRcppInterfaceBase {
public:
/**< FIMS interface object vectors */
static std::vector<FIMSRcppInterfaceBase *> fims_interface_objects;
/** @brief virtual method to inherit to add objects to the TMB model */
virtual bool add_to_fims_tmb() {
std::cout << "fims_rcpp_interface_base::add_to_fims_tmb(): Not yet "
"implemented.\n";
return false;
}
};
std::vector<FIMSRcppInterfaceBase *>
FIMSRcppInterfaceBase::fims_interface_objects;
#endif