Skip to content

Commit

Permalink
Merge pull request #1504 from tier4/refactor/parameter_value_distribu…
Browse files Browse the repository at this point in the history
…tion
  • Loading branch information
HansRobo authored Jan 17, 2025
2 parents 22f11aa + 6257eaf commit ea32884
Show file tree
Hide file tree
Showing 33 changed files with 408 additions and 348 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__EXPRESSION__ATTRIBUTE_HPP_
#define OPENSCENARIO_INTERPRETER__EXPRESSION__ATTRIBUTE_HPP_
#ifndef OPENSCENARIO_INTERPRETER__READER__EVALUATE_HPP_
#define OPENSCENARIO_INTERPRETER__READER__EVALUATE_HPP_

#include <iomanip>
#include <openscenario_interpreter/object.hpp>
Expand All @@ -33,4 +33,4 @@ std::string evaluate(const std::string &, const Scope &);
} // namespace reader
} // namespace openscenario_interpreter

#endif // OPENSCENARIO_INTERPRETER__EXPRESSION__ATTRIBUTE_HPP_
#endif // OPENSCENARIO_INTERPRETER__READER__EVALUATE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_parameter_distribution.hpp>
Expand All @@ -23,15 +23,17 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- Deterministic 1.2 ------------------------------------------------------
*
* <xsd:complexType name="Deterministic">
* <xsd:sequence>
* <xsd:group ref="DeterministicParameterDistribution" minOccurs="0" maxOccurs="unbounded"/>
* </xsd:sequence>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
/*
Deterministic (OpenSCENARIO XML 1.3.1)
Top level container containing all deterministic distribution elements.
<xsd:complexType name="Deterministic">
<xsd:sequence>
<xsd:group ref="DeterministicParameterDistribution" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
*/
struct Deterministic
{
const std::list<DeterministicParameterDistribution> deterministic_parameter_distributions;
Expand All @@ -40,4 +42,4 @@ struct Deterministic
};
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_multi_parameter_distribution_type.hpp>
Expand All @@ -23,19 +23,21 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicMultiParameterDistribution 1.2 ----------------------------
*
* <xsd:complexType name="DeterministicMultiParameterDistribution">
* <xsd:sequence>
* <xsd:group ref="DeterministicMultiParameterDistributionType"/>
* </xsd:sequence>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
/*
DeterministicMultiParameterDistribution (OpenSCENARIO XML 1.3.1)
Container for a deterministic distribution which is applied to multiple parameters.
<xsd:complexType name="DeterministicMultiParameterDistribution">
<xsd:sequence>
<xsd:group ref="DeterministicMultiParameterDistributionType"/>
</xsd:sequence>
</xsd:complexType>
*/
struct DeterministicMultiParameterDistribution : public DeterministicMultiParameterDistributionType
{
explicit DeterministicMultiParameterDistribution(const pugi::xml_node &, Scope & scope);
};
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/value_set_distribution.hpp>
Expand All @@ -23,15 +23,17 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicMultiParameterDistributionType 1.2 ------------------------
*
* <xsd:group name="DeterministicMultiParameterDistributionType">
* <xsd:sequence>
* <xsd:element name="ValueSetDistribution" type="ValueSetDistribution"/>
* </xsd:sequence>
* </xsd:group>
*
* -------------------------------------------------------------------------- */
/*
DeterministicMultiParameterDistributionType (OpenSCENARIO XML 1.3.1)
A deterministic distribution type which can be applied to multiple parameters.
<xsd:group name="DeterministicMultiParameterDistributionType">
<xsd:sequence>
<xsd:element name="ValueSetDistribution" type="ValueSetDistribution"/>
</xsd:sequence>
</xsd:group>
*/
struct DeterministicMultiParameterDistributionType : public ValueSetDistribution
{
explicit DeterministicMultiParameterDistributionType(const pugi::xml_node &, Scope & scope);
Expand All @@ -43,4 +45,4 @@ struct DeterministicMultiParameterDistributionType : public ValueSetDistribution
//);
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_MULTI_PARAMETER_DISTRIBUTION_TYPE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_multi_parameter_distribution.hpp>
Expand All @@ -24,18 +24,18 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicParameterDistribution 1.2 ---------------------------------
*
* <xsd:group name="DeterministicParameterDistribution">
* <xsd:choice>
* <xsd:element name="DeterministicMultiParameterDistribution"
* type="DeterministicMultiParameterDistribution"/>
* <xsd:element name="DeterministicSingleParameterDistribution"
* type="DeterministicSingleParameterDistribution"/>
* </xsd:choice>
* </xsd:group>
*
* -------------------------------------------------------------------------- */
/*
DeterministicParameterDistribution (OpenSCENARIO XML 1.3.1)
Either a DeterministicMultiParameterDistribution or a DeterministicSingleParameterDistribution
<xsd:group name="DeterministicParameterDistribution">
<xsd:choice>
<xsd:element name="DeterministicMultiParameterDistribution" type="DeterministicMultiParameterDistribution"/>
<xsd:element name="DeterministicSingleParameterDistribution" type="DeterministicSingleParameterDistribution"/>
</xsd:choice>
</xsd:group>
*/
struct DeterministicParameterDistribution : public Group
{
explicit DeterministicParameterDistribution(const pugi::xml_node &, Scope & scope);
Expand All @@ -48,4 +48,4 @@ DEFINE_LAZY_VISITOR(
);
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_PARAMETER_DISTRIBUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic_single_parameter_distribution_type.hpp>
Expand All @@ -23,16 +23,18 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicSingleParameterDistribution 1.2 ---------------------------
*
* <xsd:complexType name="DeterministicSingleParameterDistribution">
* <xsd:sequence>
* <xsd:group ref="DeterministicSingleParameterDistributionType"/>
* </xsd:sequence>
* <xsd:attribute name="parameterName" type="String" use="required"/>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
/*
DeterministicSingleParameterDistribution (OpenSCENARIO XML 1.3.1)
Container for a deterministic distribution which is applied to a single parameter.
<xsd:complexType name="DeterministicSingleParameterDistribution">
<xsd:sequence>
<xsd:group ref="DeterministicSingleParameterDistributionType"/>
</xsd:sequence>
<xsd:attribute name="parameterName" type="String" use="required"/>
</xsd:complexType>
*/
struct DeterministicSingleParameterDistribution
: public DeterministicSingleParameterDistributionType
{
Expand All @@ -42,4 +44,4 @@ struct DeterministicSingleParameterDistribution
};
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_TYPE_HPP_
#define OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_TYPE_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_TYPE_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_TYPE_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/distribution_range.hpp>
Expand All @@ -25,17 +25,19 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DeterministicSingleParameterDistributionType 1.2 -----------------------
*
* <xsd:group name="DeterministicSingleParameterDistributionType">
* <xsd:choice>
* <xsd:element name="DistributionSet" type="DistributionSet"/>
* <xsd:element name="DistributionRange" type="DistributionRange"/>
* <xsd:element name="UserDefinedDistribution" type="UserDefinedDistribution"/>
* </xsd:choice>
* </xsd:group>
*
* -------------------------------------------------------------------------- */
/*
DeterministicSingleParameterDistributionType (OpenSCENARIO XML 1.3.1)
A deterministic distribution type which can be applied to a single parameter.
<xsd:group name="DeterministicSingleParameterDistributionType">
<xsd:choice>
<xsd:element name="DistributionSet" type="DistributionSet"/>
<xsd:element name="DistributionRange" type="DistributionRange"/>
<xsd:element name="UserDefinedDistribution" type="UserDefinedDistribution"/>
</xsd:choice>
</xsd:group>
*/
struct DeterministicSingleParameterDistributionType : public Group
{
explicit DeterministicSingleParameterDistributionType(const pugi::xml_node &, Scope & scope);
Expand All @@ -49,4 +51,4 @@ DEFINE_LAZY_VISITOR(
);
} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_TYPE_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DETERMINISTIC_SINGLE_PARAMETER_DISTRIBUTION_TYPE_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef OPENSCENARIO_INTERPRETER__DISTRIBUTION_DEFINITION_HPP_
#define OPENSCENARIO_INTERPRETER__DISTRIBUTION_DEFINITION_HPP_
#ifndef OPENSCENARIO_INTERPRETER__SYNTAX__DISTRIBUTION_DEFINITION_HPP_
#define OPENSCENARIO_INTERPRETER__SYNTAX__DISTRIBUTION_DEFINITION_HPP_

#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/deterministic.hpp>
Expand All @@ -24,16 +24,18 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DistributionDefinition 1.2 ---------------------------------------------
*
* <xsd:group name="DistributionDefinition">
* <xsd:choice>
* <xsd:element name="Deterministic" type="Deterministic"/>
* <xsd:element name="Stochastic" type="Stochastic"/>
* </xsd:choice>
* </xsd:group>
*
* -------------------------------------------------------------------------- */
/*
DistributionDefinition (OpenSCENARIO XML 1.3.1)
Indicates whether the content defines a deterministic or stochastic parameter distribution.
<xsd:group name="DistributionDefinition">
<xsd:choice>
<xsd:element name="Deterministic" type="Deterministic"/>
<xsd:element name="Stochastic" type="Stochastic"/>
</xsd:choice>
</xsd:group>
*/
struct DistributionDefinition : public Group
{
explicit DistributionDefinition(const pugi::xml_node &, Scope & scope);
Expand All @@ -47,4 +49,4 @@ DEFINE_LAZY_VISITOR(

} // namespace syntax
} // namespace openscenario_interpreter
#endif // OPENSCENARIO_INTERPRETER__DISTRIBUTION_DEFINITION_HPP_
#endif // OPENSCENARIO_INTERPRETER__SYNTAX__DISTRIBUTION_DEFINITION_HPP_
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,21 @@ namespace openscenario_interpreter
{
inline namespace syntax
{
/* ---- DistributionRange 1.2 --------------------------------------------------
*
* <xsd:complexType name="DistributionRange">
* <xsd:all>
* <xsd:element name="Range" type="Range"/>
* </xsd:all>
* </xsd:complexType>
*
* -------------------------------------------------------------------------- */
/*
DistributionRange (OpenSCENARIO XML 1.3.1)
A range of values used for a deterministic distribution.
The range starts with lower limit, Each additional value is defined
by adding the step value to the previous value until the value is greater than upper limit.
Upper limit can be part of the range.
<xsd:complexType name="DistributionRange">
<xsd:all>
<xsd:element name="Range" type="Range"/>
</xsd:all>
<xsd:attribute name="stepWidth" type="Double" use="required"/>
</xsd:complexType>
*/
struct DistributionRange : private Scope, public ComplexType
{
const Range range;
Expand Down
Loading

0 comments on commit ea32884

Please sign in to comment.