9#ifndef FIMS_INTERFACE_RCPP_RCPP_OBJECTS_RCPP_DATA_HPP
10#define FIMS_INTERFACE_RCPP_RCPP_OBJECTS_RCPP_DATA_HPP
12#include "../../../common/information.hpp"
43 static std::map<uint32_t, std::shared_ptr<DataInterfaceBase>>
live_objects;
84std::map<uint32_t, std::shared_ptr<DataInterfaceBase>>
122 std::make_shared<AgeCompDataInterface>(*
this);
158 std::stringstream
ss;
161 ss <<
" \"name\": \"AgeComp\",\n";
162 ss <<
" \"id\":" << this->
id <<
",\n";
163 ss <<
" \"type\": \"data\",\n";
164 ss <<
" \"dimensionality\": {\n";
165 ss <<
" \"header\": [" <<
"\"n_ages\", \"n_years\"" <<
"],\n";
166 ss <<
" \"dimensions\": [" <<
amax <<
", " <<
ymax <<
"]\n},\n";
167 ss <<
" \"value\": [";
172 ss <<
"\"uncertainty\":[ ";
183 template <
typename Type>
185 std::shared_ptr<fims_data_object::DataObject<Type>>
age_comp_data =
186 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax,
189 age_comp_data->id = this->
id;
190 for (
int y = 0;
y <
ymax;
y++) {
191 for (
int a = 0;
a <
amax;
a++) {
198 std::shared_ptr<fims_info::Information<Type>>
info =
211#ifdef TMBAD_FRAMEWORK
262 std::make_shared<LengthCompDataInterface>(*
this);
298 std::stringstream
ss;
301 ss <<
" \"name\": \"LengthComp\",\n";
302 ss <<
" \"id\":" << this->
id <<
",\n";
303 ss <<
" \"type\": \"data\",\n";
304 ss <<
" \"dimensionality\": {\n";
305 ss <<
" \"header\": [" <<
"\"n_lengths\", \"n_years\"" <<
"],\n";
306 ss <<
" \"dimensions\": [" <<
lmax <<
", " <<
ymax <<
"]\n},\n";
307 ss <<
" \"value\": [";
312 ss <<
"\"uncertainty\": [ ";
322 template <
typename Type>
325 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax,
327 length_comp_data->id = this->
id;
328 for (
int y = 0;
y <
ymax;
y++) {
329 for (
int l = 0;
l <
lmax;
l++) {
336 std::shared_ptr<fims_info::Information<Type>>
info =
347#ifdef TMBAD_FRAMEWORK
390 std::make_shared<IndexDataInterface>(*
this);
425 std::stringstream
ss;
428 ss <<
" \"name\": \"Index\",\n";
429 ss <<
" \"id\": " << this->
id <<
",\n";
430 ss <<
" \"type\": \"data\",\n";
431 ss <<
" \"dimensionality\": {\n";
432 ss <<
" \"header\": [" <<
"\"n_years\"" <<
"],\n";
433 ss <<
" \"dimensions\": [" <<
ymax <<
"]\n},\n";
434 ss <<
" \"value\": [";
439 ss <<
"\"uncertainty\": [ ";
450 template <
typename Type>
452 std::shared_ptr<fims_data_object::DataObject<Type>> data =
453 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax);
457 for (
int y = 0;
y <
ymax;
y++) {
458 data->
at(
y) = this->index_data[
y];
459 data->uncertainty[
y] = this->uncertainty[
y];
462 std::shared_ptr<fims_info::Information<Type>>
info =
465 info->data_objects[this->
id] = data;
474#ifdef TMBAD_FRAMEWORK
518 std::make_shared<LandingsDataInterface>(*
this);
553 std::stringstream
ss;
556 ss <<
" \"name\": \"Landings\",\n";
557 ss <<
" \"id\": " << this->
id <<
",\n";
558 ss <<
" \"type\": \"data\",\n";
559 ss <<
" \"dimensionality\": {\n";
560 ss <<
" \"header\": [" <<
"\"n_years\"" <<
"],\n";
561 ss <<
" \"dimensions\": [" <<
ymax <<
"]\n},\n";
562 ss <<
" \"value\": [";
567 ss <<
"\"uncertainty\": [ ";
578 template <
typename Type>
580 std::shared_ptr<fims_data_object::DataObject<Type>> data =
581 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax);
585 for (
int y = 0;
y <
ymax;
y++) {
586 data->
at(
y) = this->landings_data[
y];
587 data->uncertainty[
y] = this->uncertainty[
y];
590 std::shared_ptr<fims_info::Information<Type>>
info =
593 info->data_objects[this->
id] = data;
602#ifdef TMBAD_FRAMEWORK
The Rcpp interface for AgeComp to instantiate the object from R: acomp <- methods::new(AgeComp).
Definition rcpp_data.hpp:91
RealVector uncertainty
The vector of age-composition uncertainty that is being passed from R.
Definition rcpp_data.hpp:111
virtual ~AgeCompDataInterface()
The destructor.
Definition rcpp_data.hpp:142
fims_int amax
The first dimension of the data, which relates to the number of age bins.
Definition rcpp_data.hpp:97
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:157
RealVector age_comp_data
The vector of age-composition data that is being passed from R.
Definition rcpp_data.hpp:106
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:148
AgeCompDataInterface(const AgeCompDataInterface &other)
Construct a new Age Comp Data Interface object.
Definition rcpp_data.hpp:132
AgeCompDataInterface(int ymax=0, int amax=0)
The constructor.
Definition rcpp_data.hpp:116
fims_int ymax
The second dimension of the data, which relates to the number of time steps or years.
Definition rcpp_data.hpp:102
Rcpp interface that serves as the parent class for Rcpp data interfaces. This type should be inherite...
Definition rcpp_data.hpp:19
virtual bool add_to_fims_tmb()
Adds the parameters to the TMB model.
Definition rcpp_data.hpp:78
virtual ~DataInterfaceBase()
The destructor.
Definition rcpp_data.hpp:68
DataInterfaceBase()
The constructor.
Definition rcpp_data.hpp:48
static uint32_t id_g
The static id of the DataInterfaceBase object.
Definition rcpp_data.hpp:32
uint32_t id
The local id of the DataInterfaceBase object.
Definition rcpp_data.hpp:37
virtual uint32_t get_id()
Get the ID for the child data interface objects to inherit.
Definition rcpp_data.hpp:73
Rcpp::NumericVector uncertainty
The vector of uncertainty that is being passed from R.
Definition rcpp_data.hpp:28
DataInterfaceBase(const DataInterfaceBase &other)
Construct a new Data Interface Base object.
Definition rcpp_data.hpp:60
static std::map< uint32_t, std::shared_ptr< DataInterfaceBase > > live_objects
The map associating the IDs of DataInterfaceBase to the objects. This is a live object,...
Definition rcpp_data.hpp:43
Rcpp::NumericVector observed_data
The vector of data that is being passed from R.
Definition rcpp_data.hpp:24
Base class for all interface objects.
Definition rcpp_interface_base.hpp:634
static std::vector< std::shared_ptr< FIMSRcppInterfaceBase > > fims_interface_objects
FIMS interface object vectors.
Definition rcpp_interface_base.hpp:644
The Rcpp interface for Index to instantiate the object from R: fleet <- methods::new(Index).
Definition rcpp_data.hpp:366
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:424
fims_int ymax
An integer that specifies the second dimension of the data.
Definition rcpp_data.hpp:371
IndexDataInterface(int ymax=0)
The constructor.
Definition rcpp_data.hpp:385
RealVector index_data
The vector of index data that is being passed from R.
Definition rcpp_data.hpp:375
virtual ~IndexDataInterface()
The destructor.
Definition rcpp_data.hpp:409
RealVector uncertainty
The vector of index uncertainty that is being passed from R.
Definition rcpp_data.hpp:380
IndexDataInterface(const IndexDataInterface &other)
Construct a new Index Data Interface object.
Definition rcpp_data.hpp:400
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:415
The Rcpp interface for Landings to instantiate the object from R: fleet <- methods::new(Landings).
Definition rcpp_data.hpp:494
LandingsDataInterface(int ymax=0)
The constructor.
Definition rcpp_data.hpp:513
LandingsDataInterface(const LandingsDataInterface &other)
Construct a new Landings Data Interface object.
Definition rcpp_data.hpp:528
RealVector uncertainty
The vector of landings uncertainty that is being passed from R.
Definition rcpp_data.hpp:508
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:552
RealVector landings_data
The vector of landings data that is being passed from R.
Definition rcpp_data.hpp:503
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:543
fims_int ymax
An integer that specifies the second dimension of the data.
Definition rcpp_data.hpp:499
virtual ~LandingsDataInterface()
The destructor.
Definition rcpp_data.hpp:537
The Rcpp interface for LengthComp to instantiate the object from R: lcomp <- methods::new(LengthComp)...
Definition rcpp_data.hpp:231
fims_int lmax
The first dimension of the data, which relates to the number of length bins.
Definition rcpp_data.hpp:237
RealVector length_comp_data
The vector of length-composition data that is being passed from R.
Definition rcpp_data.hpp:246
fims_int ymax
The second dimension of the data, which relates to the number of time steps or years.
Definition rcpp_data.hpp:242
LengthCompDataInterface(const LengthCompDataInterface &other)
Construct a new Length Comp Data Interface object.
Definition rcpp_data.hpp:272
RealVector uncertainty
The vector of length-composition uncertainty that is being passed from R.
Definition rcpp_data.hpp:251
virtual ~LengthCompDataInterface()
The destructor.
Definition rcpp_data.hpp:282
LengthCompDataInterface(int ymax=0, int lmax=0)
The constructor.
Definition rcpp_data.hpp:256
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:297
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:288
An Rcpp interface class that defines the RealVector class.
Definition rcpp_interface_base.hpp:434
size_t size()
Returns the size of a RealVector.
Definition rcpp_interface_base.hpp:595
void resize(size_t size)
Resizes a RealVector to the desired length.
Definition rcpp_interface_base.hpp:602
SEXP at(R_xlen_t pos)
The accessor where the first index starts at one. This function is for calling accessing from R.
Definition rcpp_interface_base.hpp:556
A class that provides shared ownership of an integer value.
Definition rcpp_shared_primitive.hpp:24
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:279
The Rcpp interface to declare objects that are used ubiquitously throughout the Rcpp interface,...