9#ifndef FIMS_INTERFACE_RCPP_RCPP_OBJECTS_RCPP_DATA_HPP
10#define FIMS_INTERFACE_RCPP_RCPP_OBJECTS_RCPP_DATA_HPP
43 static std::map<uint32_t, std::shared_ptr<DataInterfaceBase>>
live_objects;
116 std::make_shared<AgeCompDataInterface>(*
this);
152 std::stringstream
ss;
155 ss <<
" \"name\": \"AgeComp\",\n";
156 ss <<
" \"id\":" << this->
id <<
",\n";
157 ss <<
" \"type\": \"data\",\n";
158 ss <<
" \"dimensionality\": {\n";
159 ss <<
" \"header\": [" <<
"\"n_ages\", \"n_years\"" <<
"],\n";
160 ss <<
" \"dimensions\": [" <<
amax <<
", " <<
ymax <<
"]\n},\n";
161 ss <<
" \"value\": [";
166 ss <<
"\"uncertainty\":[ ";
177 template <
typename Type>
179 std::shared_ptr<fims_data_object::DataObject<Type>>
age_comp_data =
180 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax,
183 age_comp_data->id = this->
id;
184 for (
int y = 0;
y <
ymax;
y++) {
185 for (
int a = 0;
a <
amax;
a++) {
192 std::shared_ptr<fims_info::Information<Type>>
info =
249 std::make_shared<LengthCompDataInterface>(*
this);
285 std::stringstream
ss;
288 ss <<
" \"name\": \"LengthComp\",\n";
289 ss <<
" \"id\":" << this->
id <<
",\n";
290 ss <<
" \"type\": \"data\",\n";
291 ss <<
" \"dimensionality\": {\n";
292 ss <<
" \"header\": [" <<
"\"n_lengths\", \"n_years\"" <<
"],\n";
293 ss <<
" \"dimensions\": [" <<
lmax <<
", " <<
ymax <<
"]\n},\n";
294 ss <<
" \"value\": [";
299 ss <<
"\"uncertainty\": [ ";
309 template <
typename Type>
312 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax,
314 length_comp_data->id = this->
id;
315 for (
int y = 0;
y <
ymax;
y++) {
316 for (
int l = 0;
l <
lmax;
l++) {
323 std::shared_ptr<fims_info::Information<Type>>
info =
370 std::make_shared<IndexDataInterface>(*
this);
405 std::stringstream
ss;
408 ss <<
" \"name\": \"Index\",\n";
409 ss <<
" \"id\": " << this->
id <<
",\n";
410 ss <<
" \"type\": \"data\",\n";
411 ss <<
" \"dimensionality\": {\n";
412 ss <<
" \"header\": [" <<
"\"n_years\"" <<
"],\n";
413 ss <<
" \"dimensions\": [" <<
ymax <<
"]\n},\n";
414 ss <<
" \"value\": [";
419 ss <<
"\"uncertainty\": [ ";
430 template <
typename Type>
432 std::shared_ptr<fims_data_object::DataObject<Type>> data =
433 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax);
437 for (
int y = 0;
y <
ymax;
y++) {
438 data->
at(
y) = this->index_data[
y];
439 data->uncertainty[
y] = this->uncertainty[
y];
442 std::shared_ptr<fims_info::Information<Type>>
info =
445 info->data_objects[this->
id] = data;
491 std::make_shared<LandingsDataInterface>(*
this);
526 std::stringstream
ss;
529 ss <<
" \"name\": \"Landings\",\n";
530 ss <<
" \"id\": " << this->
id <<
",\n";
531 ss <<
" \"type\": \"data\",\n";
532 ss <<
" \"dimensionality\": {\n";
533 ss <<
" \"header\": [" <<
"\"n_years\"" <<
"],\n";
534 ss <<
" \"dimensions\": [" <<
ymax <<
"]\n},\n";
535 ss <<
" \"value\": [";
540 ss <<
"\"uncertainty\": [ ";
551 template <
typename Type>
553 std::shared_ptr<fims_data_object::DataObject<Type>> data =
554 std::make_shared<fims_data_object::DataObject<Type>>(this->
ymax);
558 for (
int y = 0;
y <
ymax;
y++) {
559 data->
at(
y) = this->landings_data[
y];
560 data->uncertainty[
y] = this->uncertainty[
y];
563 std::shared_ptr<fims_info::Information<Type>>
info =
566 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:85
RealVector uncertainty
The vector of age-composition uncertainty that is being passed from R.
Definition rcpp_data.hpp:105
virtual ~AgeCompDataInterface()
The destructor.
Definition rcpp_data.hpp:136
fims_int amax
The first dimension of the data, which relates to the number of age bins.
Definition rcpp_data.hpp:91
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:151
RealVector age_comp_data
The vector of age-composition data that is being passed from R.
Definition rcpp_data.hpp:100
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:142
AgeCompDataInterface(const AgeCompDataInterface &other)
Construct a new Age Comp Data Interface object.
Definition rcpp_data.hpp:126
AgeCompDataInterface(int ymax=0, int amax=0)
The constructor.
Definition rcpp_data.hpp:110
fims_int ymax
The second dimension of the data, which relates to the number of time steps or years.
Definition rcpp_data.hpp:96
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:628
static std::vector< std::shared_ptr< FIMSRcppInterfaceBase > > fims_interface_objects
FIMS interface object vectors.
Definition rcpp_interface_base.hpp:638
The Rcpp interface for Index to instantiate the object from R: fleet <- methods::new(Index).
Definition rcpp_data.hpp:346
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:404
fims_int ymax
An integer that specifies the second dimension of the data.
Definition rcpp_data.hpp:351
IndexDataInterface(int ymax=0)
The constructor.
Definition rcpp_data.hpp:365
RealVector index_data
The vector of index data that is being passed from R.
Definition rcpp_data.hpp:355
virtual ~IndexDataInterface()
The destructor.
Definition rcpp_data.hpp:389
RealVector uncertainty
The vector of index uncertainty that is being passed from R.
Definition rcpp_data.hpp:360
IndexDataInterface(const IndexDataInterface &other)
Construct a new Index Data Interface object.
Definition rcpp_data.hpp:380
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:395
The Rcpp interface for Landings to instantiate the object from R: fleet <- methods::new(Landings).
Definition rcpp_data.hpp:467
LandingsDataInterface(int ymax=0)
The constructor.
Definition rcpp_data.hpp:486
LandingsDataInterface(const LandingsDataInterface &other)
Construct a new Landings Data Interface object.
Definition rcpp_data.hpp:501
RealVector uncertainty
The vector of landings uncertainty that is being passed from R.
Definition rcpp_data.hpp:481
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:525
RealVector landings_data
The vector of landings data that is being passed from R.
Definition rcpp_data.hpp:476
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:516
fims_int ymax
An integer that specifies the second dimension of the data.
Definition rcpp_data.hpp:472
virtual ~LandingsDataInterface()
The destructor.
Definition rcpp_data.hpp:510
The Rcpp interface for LengthComp to instantiate the object from R: lcomp <- methods::new(LengthComp)...
Definition rcpp_data.hpp:218
fims_int lmax
The first dimension of the data, which relates to the number of length bins.
Definition rcpp_data.hpp:224
RealVector length_comp_data
The vector of length-composition data that is being passed from R.
Definition rcpp_data.hpp:233
fims_int ymax
The second dimension of the data, which relates to the number of time steps or years.
Definition rcpp_data.hpp:229
LengthCompDataInterface(const LengthCompDataInterface &other)
Construct a new Length Comp Data Interface object.
Definition rcpp_data.hpp:259
RealVector uncertainty
The vector of length-composition uncertainty that is being passed from R.
Definition rcpp_data.hpp:238
virtual ~LengthCompDataInterface()
The destructor.
Definition rcpp_data.hpp:269
LengthCompDataInterface(int ymax=0, int lmax=0)
The constructor.
Definition rcpp_data.hpp:243
virtual std::string to_json()
Converts the data to json representation for the output.
Definition rcpp_data.hpp:284
virtual uint32_t get_id()
Gets the ID of the interface base object.
Definition rcpp_data.hpp:275
An Rcpp interface class that defines the RealVector class.
Definition rcpp_interface_base.hpp:413
size_t size()
Returns the size of a RealVector.
Definition rcpp_interface_base.hpp:584
void resize(size_t size)
Resizes a RealVector to the desired length.
Definition rcpp_interface_base.hpp:591
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:545
A class that provides shared ownership of an integer value.
Definition rcpp_shared_primitive.hpp:29
void clear_internal()
Clears the internal objects.
Definition rcpp_interface.hpp:235
The Rcpp interface to declare objects that are used ubiquitously throughout the Rcpp interface,...