File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ using namespace fmu4cpp;
1010class BouncingBall : public fmu_base {
1111
1212public:
13- explicit BouncingBall ( const fmu_data &data) : fmu_base(data ) {
13+ FMU4CPP_CTOR (BouncingBall ) {
1414
1515 register_variable (
1616 real (
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ using namespace fmu4cpp;
1010class Resource : public fmu_base {
1111
1212public:
13- explicit Resource ( const fmu_data &data) : fmu_base(data ) {
13+ FMU4CPP_CTOR (Resource ) {
1414
1515 std::ifstream ifs (resourceLocation () / " file.txt" );
1616
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ constexpr double pi = 3.14159265358979323846;
1010class SimplePendulum : public fmu_base {
1111
1212public:
13- explicit SimplePendulum ( const fmu_data &data) : fmu_base(data ) {
13+ FMU4CPP_CTOR (SimplePendulum ) {
1414
1515 register_variable (real (" angle" , &angle_)
1616 .setCausality (causality_t ::OUTPUT)
Original file line number Diff line number Diff line change 1616
1717#include < filesystem>
1818
19- #define FMU4CPP_INSTANTIATE (MODELCLASS ) \
20- std::unique_ptr<fmu4cpp::fmu_base> fmu4cpp::createInstance (const fmu4cpp::fmu_data &data) { \
21- return std::make_unique<MODELCLASS>(data); \
22- }
2319
2420namespace fmu4cpp {
2521
@@ -290,6 +286,15 @@ namespace fmu4cpp {
290286 std::unordered_map<unsigned int , size_t > vrToStringIndices_;
291287 };
292288
289+
290+ #define FMU4CPP_INSTANTIATE (MODELCLASS ) \
291+ std::unique_ptr<fmu4cpp::fmu_base> fmu4cpp::createInstance (const fmu4cpp::fmu_data &data) { \
292+ return std::make_unique<MODELCLASS>(data); \
293+ }
294+
295+ #define FMU4CPP_CTOR (MODELCLASS ) \
296+ explicit MODELCLASS (fmu4cpp::fmu_data data) : fmu_base(std::move(data))
297+
293298 model_info get_model_info();
294299
295300 std::unique_ptr<fmu_base> createInstance (const fmu_data &data);
Original file line number Diff line number Diff line change 1414class Model : public fmu4cpp ::fmu_base {
1515
1616public:
17- explicit Model (const fmu4cpp::fmu_data &data)
18- : fmu_base(data), reals_(4 ) {
17+ FMU4CPP_CTOR (Model), reals_(4 ) {
1918
2019 for (int i = 0 ; i < reals_.size (); i++) {
2120 register_variable (
Original file line number Diff line number Diff line change 1313class Model : public fmu4cpp ::fmu_base {
1414
1515public:
16- explicit Model ( const fmu4cpp::fmu_data &data) : fmu_base(data ) {
16+ FMU4CPP_CTOR (Model ) {
1717
1818 register_variable (integer (" integerIn" , &integer_)
1919 .setCausality (fmu4cpp::causality_t ::INPUT)
Original file line number Diff line number Diff line change 1414class Model : public fmu4cpp ::fmu_base {
1515
1616public:
17- explicit Model (const fmu4cpp::fmu_data &data)
18- : fmu_base(data), reals_(4 ) {
17+ FMU4CPP_CTOR (Model), reals_(4 ) {
1918
2019 for (int i = 0 ; i < reals_.size (); i++) {
2120 register_variable (
Original file line number Diff line number Diff line change 1414class Model : public fmu4cpp ::fmu_base {
1515
1616public:
17- explicit Model ( const fmu4cpp::fmu_data &data) : fmu_base(data ) {
17+ FMU4CPP_CTOR (Model ) {
1818
1919 register_variable (integer (" integerIn" , &integer_)
2020 .setCausality (fmu4cpp::causality_t ::INPUT)
You can’t perform that action at this time.
0 commit comments