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 =
255 std::make_shared<LengthCompDataInterface>(*
this);
291 std::stringstream
ss;
294 ss <<
" \"name\": \"LengthComp\",\n";
295 ss <<
" \"id\":" << this->
id <<
",\n";
296 ss <<
" \"type\": \"data\",\n";
297 ss <<
" \"dimensionality\": {\n";
298 ss <<
" \"header\": [" <<
"\"n_lengths\", \"n_years\"" <<
"],\n";
299 ss <<
" \"dimensions\": [" <<
lmax <<
", " <<
ymax <<
"]\n},\n";
300 ss <<
" \"value\": [";
305 ss <<
"\"uncertainty\": [ ";
315 template <
typename Type>
318 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax,
320 length_comp_data->id = this->
id;
321 for (
int y = 0;
y <
ymax;
y++) {
322 for (
int l = 0;
l <
lmax;
l++) {
329 std::shared_ptr<fims_info::Information<Type>>
info =
376 std::make_shared<IndexDataInterface>(*
this);
411 std::stringstream
ss;
414 ss <<
" \"name\": \"Index\",\n";
415 ss <<
" \"id\": " << this->
id <<
",\n";
416 ss <<
" \"type\": \"data\",\n";
417 ss <<
" \"dimensionality\": {\n";
418 ss <<
" \"header\": [" <<
"\"n_years\"" <<
"],\n";
419 ss <<
" \"dimensions\": [" <<
ymax <<
"]\n},\n";
420 ss <<
" \"value\": [";
425 ss <<
"\"uncertainty\": [ ";
436 template <
typename Type>
438 std::shared_ptr<fims_data_object::DataObject<Type>> data =
439 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax);
443 for (
int y = 0;
y <
ymax;
y++) {
444 data->
at(
y) = this->index_data[
y];
445 data->uncertainty[
y] = this->uncertainty[
y];
448 std::shared_ptr<fims_info::Information<Type>>
info =
451 info->data_objects[this->
id] = data;
497 std::make_shared<LandingsDataInterface>(*
this);
532 std::stringstream
ss;
535 ss <<
" \"name\": \"Landings\",\n";
536 ss <<
" \"id\": " << this->
id <<
",\n";
537 ss <<
" \"type\": \"data\",\n";
538 ss <<
" \"dimensionality\": {\n";
539 ss <<
" \"header\": [" <<
"\"n_years\"" <<
"],\n";
540 ss <<
" \"dimensions\": [" <<
ymax <<
"]\n},\n";
541 ss <<
" \"value\": [";
546 ss <<
"\"uncertainty\": [ ";
557 template <
typename Type>
559 std::shared_ptr<fims_data_object::DataObject<Type>> data =
560 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax);
564 for (
int y = 0;
y <
ymax;
y++) {
565 data->
at(
y) = this->landings_data[
y];
566 data->uncertainty[
y] = this->uncertainty[
y];
569 std::shared_ptr<fims_info::Information<Type>>
info =
572 info->data_objects[this->
id] = data;
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:574
static std::vector< std::shared_ptr< FIMSRcppInterfaceBase > > fims_interface_objects
FIMS interface object vectors.
Definition rcpp_interface_base.hpp:584
The Rcpp interface for Index to instantiate the object from R: fleet <- methods::new(Index).
Definition rcpp_data.hpp:352
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:410
fims_int ymax
An integer that specifies the second dimension of the data.
Definition rcpp_data.hpp:357
IndexDataInterface(int ymax=0)
The constructor.
Definition rcpp_data.hpp:371
RealVector index_data
The vector of index data that is being passed from R.
Definition rcpp_data.hpp:361
virtual ~IndexDataInterface()
The destructor.
Definition rcpp_data.hpp:395
RealVector uncertainty
The vector of index uncertainty that is being passed from R.
Definition rcpp_data.hpp:366
IndexDataInterface(const IndexDataInterface &other)
Construct a new Index Data Interface object.
Definition rcpp_data.hpp:386
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:401
The Rcpp interface for Landings to instantiate the object from R: fleet <- methods::new(Landings).
Definition rcpp_data.hpp:473
LandingsDataInterface(int ymax=0)
The constructor.
Definition rcpp_data.hpp:492
LandingsDataInterface(const LandingsDataInterface &other)
Construct a new Landings Data Interface object.
Definition rcpp_data.hpp:507
RealVector uncertainty
The vector of landings uncertainty that is being passed from R.
Definition rcpp_data.hpp:487
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:531
RealVector landings_data
The vector of landings data that is being passed from R.
Definition rcpp_data.hpp:482
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:522
fims_int ymax
An integer that specifies the second dimension of the data.
Definition rcpp_data.hpp:478
virtual ~LandingsDataInterface()
The destructor.
Definition rcpp_data.hpp:516
The Rcpp interface for LengthComp to instantiate the object from R: lcomp <- methods::new(LengthComp)...
Definition rcpp_data.hpp:224
fims_int lmax
The first dimension of the data, which relates to the number of length bins.
Definition rcpp_data.hpp:230
RealVector length_comp_data
The vector of length-composition data that is being passed from R.
Definition rcpp_data.hpp:239
fims_int ymax
The second dimension of the data, which relates to the number of time steps or years.
Definition rcpp_data.hpp:235
LengthCompDataInterface(const LengthCompDataInterface &other)
Construct a new Length Comp Data Interface object.
Definition rcpp_data.hpp:265
RealVector uncertainty
The vector of length-composition uncertainty that is being passed from R.
Definition rcpp_data.hpp:244
virtual ~LengthCompDataInterface()
The destructor.
Definition rcpp_data.hpp:275
LengthCompDataInterface(int ymax=0, int lmax=0)
The constructor.
Definition rcpp_data.hpp:249
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:290
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:281
An Rcpp interface class that defines the RealVector class.
Definition rcpp_interface_base.hpp:374
size_t size()
Returns the size of a RealVector.
Definition rcpp_interface_base.hpp:535
void resize(size_t size)
Resizes a RealVector to the desired length.
Definition rcpp_interface_base.hpp:542
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:496
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:239
The Rcpp interface to declare objects that are used ubiquitously throughout the Rcpp interface,...