@@ -53,11 +53,9 @@ void Activity::pushBackParameter(const std::string& title, double value, gsoap_r
5353 if (maxOccurs > -1 && static_cast <uint64_t >(maxOccurs) <= getParameterCount (title)) {
5454 throw invalid_argument (" The max number of occurrences has already been reached for parameter " + title);
5555 }
56- if (dynamic_cast <EML2_NS::ActivityTemplate*>(activityTemplate) != nullptr ) {
57- vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = static_cast <EML2_NS::ActivityTemplate*>(activityTemplate)->getParameterAllowedKinds (title);
58- if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::floatingPoint) == allowedKinds.end ())
59- throw invalid_argument (" The parameter template " + title + " does not allow a double datatype." );
60- }
56+ vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = activityTemplate->getParameterAllowedKinds (title);
57+ if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::floatingPoint) == allowedKinds.end ())
58+ throw invalid_argument (" The parameter template " + title + " does not allow a double datatype." );
6159 }
6260
6361 _eml23__Activity* activity = static_cast <_eml23__Activity*>(gsoapProxy2_3);
@@ -80,11 +78,9 @@ void Activity::pushBackParameter(const std::string& title, const std::string & v
8078 if (maxOccurs > -1 && static_cast <uint64_t >(maxOccurs) <= getParameterCount (title)) {
8179 throw invalid_argument (" The max number of occurrences has already been reached for parameter " + title);
8280 }
83- if (dynamic_cast <EML2_NS::ActivityTemplate*>(activityTemplate) != nullptr ) {
84- vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = static_cast <EML2_NS::ActivityTemplate*>(activityTemplate)->getParameterAllowedKinds (title);
85- if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::string) == allowedKinds.end ())
86- throw invalid_argument (" The parameter template " + title + " does not allow a string datatype." );
87- }
81+ vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = activityTemplate->getParameterAllowedKinds (title);
82+ if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::string) == allowedKinds.end ())
83+ throw invalid_argument (" The parameter template " + title + " does not allow a string datatype." );
8884 }
8985
9086 _eml23__Activity* activity = static_cast <_eml23__Activity*>(gsoapProxy2_3);
@@ -106,11 +102,9 @@ void Activity::pushBackParameter(const std::string& title, int64_t value)
106102 if (maxOccurs > -1 && static_cast <uint64_t >(maxOccurs) <= getParameterCount (title)) {
107103 throw invalid_argument (" The max number of occurrences has already been reached for parameter " + title);
108104 }
109- if (dynamic_cast <EML2_NS::ActivityTemplate*>(activityTemplate) != nullptr ) {
110- vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = static_cast <EML2_NS::ActivityTemplate*>(activityTemplate)->getParameterAllowedKinds (title);
111- if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::integer) == allowedKinds.end ())
112- throw invalid_argument (" The parameter template " + title + " does not allow an integer datatype." );
113- }
105+ vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = activityTemplate->getParameterAllowedKinds (title);
106+ if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::integer) == allowedKinds.end ())
107+ throw invalid_argument (" The parameter template " + title + " does not allow an integer datatype." );
114108 }
115109
116110 _eml23__Activity* activity = static_cast <_eml23__Activity*>(gsoapProxy2_3);
@@ -134,11 +128,9 @@ void Activity::pushBackParameter(const std::string& title, AbstractObject* resqm
134128 int64_t maxOccurs = activityTemplate->getParameterMaxOccurences (title);
135129 if (maxOccurs > -1 && static_cast <uint64_t >(maxOccurs) <= getParameterCount (title))
136130 throw invalid_argument (" The max number of occurrences has already been reached for parameter " + title);
137- if (dynamic_cast <EML2_NS::ActivityTemplate*>(activityTemplate) != nullptr ) {
138- vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = static_cast <EML2_NS::ActivityTemplate*>(activityTemplate)->getParameterAllowedKinds (title);
139- if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::dataObject) == allowedKinds.end ())
140- throw invalid_argument (" The parameter template " + title + " does not allow a data object datatype." );
141- }
131+ vector<gsoap_resqml2_0_1::resqml20__ParameterKind> allowedKinds = activityTemplate->getParameterAllowedKinds (title);
132+ if (allowedKinds.size () > 0 && find (allowedKinds.begin (), allowedKinds.end (), gsoap_resqml2_0_1::resqml20__ParameterKind::dataObject) == allowedKinds.end ())
133+ throw invalid_argument (" The parameter template " + title + " does not allow a data object datatype." );
142134 }
143135
144136 getRepository ()->addRelationship (this , resqmlObject);
@@ -260,7 +252,7 @@ vector<gsoap_resqml2_0_1::resqml20__ResqmlUom> Activity::getFloatingPointQuantit
260252 throw range_error (" The parameter " + paramTitle + " is not in the parameter range." );
261253
262254 vector<gsoap_resqml2_0_1::resqml20__ResqmlUom> result;
263- for (unsigned int i = 0 ; i < param.size (); ++i)
255+ for (size_t i = 0 ; i < param.size (); ++i)
264256 {
265257 if (param[i]->soap_type () != SOAP_TYPE_gsoap_eml2_3_eml23__DoubleQuantityParameter)
266258 throw invalid_argument (" The parameter " + paramTitle + " contains some non double values." );
@@ -373,8 +365,9 @@ vector<string> Activity::getStringParameterValue(const std::string & paramTitle)
373365{
374366 vector<gsoap_eml2_3::eml23__AbstractActivityParameter*> param = getParameterFromTitle (paramTitle);
375367
376- if (param.size () < 1 )
377- invalid_argument (" There exists no " + paramTitle + " parameter in this activity." );
368+ if (param.size () < 1 ) {
369+ throw invalid_argument (" There exists no " + paramTitle + " parameter in this activity." );
370+ }
378371
379372 vector<string> result;
380373 for (size_t i = 0 ; i < param.size (); ++i)
@@ -412,7 +405,7 @@ bool Activity::isAResqmlObjectParameter(const std::string & paramTitle) const
412405 throw invalid_argument (" There exists no " + paramTitle + " parameter in this activity." );
413406 }
414407
415- for (unsigned int i = 0 ; i < param.size (); ++i) {
408+ for (size_t i = 0 ; i < param.size (); ++i) {
416409 if (param[i]->soap_type () != SOAP_TYPE_gsoap_eml2_3_eml23__DataObjectParameter)
417410 return false ;
418411 }
@@ -422,17 +415,16 @@ bool Activity::isAResqmlObjectParameter(const std::string & paramTitle) const
422415
423416bool Activity::isAResqmlObjectParameter (uint64_t index) const
424417{
425- _eml23__Activity* activity = static_cast <_eml23__Activity*>(gsoapProxy2_3);
426-
427- return activity->Parameter .at (index)->soap_type () == SOAP_TYPE_gsoap_eml2_3_eml23__DataObjectParameter;
418+ return static_cast <_eml23__Activity*>(gsoapProxy2_3)->Parameter .at (index)->soap_type () == SOAP_TYPE_gsoap_eml2_3_eml23__DataObjectParameter;
428419}
429420
430421vector<COMMON_NS::AbstractObject*> Activity::getResqmlObjectParameterValue (const std::string & paramTitle) const
431422{
432423 vector<gsoap_eml2_3::eml23__AbstractActivityParameter*> param = getParameterFromTitle (paramTitle);
433424
434- if (param.size () < 1 )
435- invalid_argument (" There exists no " + paramTitle + " parameter in this activity." );
425+ if (param.size () < 1 ) {
426+ throw invalid_argument (" There exists no " + paramTitle + " parameter in this activity." );
427+ }
436428
437429 vector<COMMON_NS::AbstractObject*> result;
438430 for (size_t i = 0 ; i < param.size (); ++i)
0 commit comments