summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorKenji Hosokawa <khosokawa@jp.adit-jv.com>2020-08-24 21:58:42 +0900
committerKenji Hosokawa <khosokawa@jp.adit-jv.com>2020-08-24 21:58:42 +0900
commit2b4ae7fde370bc3316ab30cc38b74d23e785b360 (patch)
tree41b6eb70b3419c2fbd192ed133c5890a985eddec /src/core
parent6694a4d2952ebd171564932200cac00d6e5792f4 (diff)
Signed-off-by: Kenji Hosokawa <khosokawa@jp.adit-jv.com> Change-Id: I381abb0a6521f5349768a76ef7ceecbce4b2d701
Diffstat (limited to 'src/core')
-rw-r--r--src/core/expression/RBAActionOperator.cpp35
-rw-r--r--src/core/expression/RBAActionOperator.hpp48
-rw-r--r--src/core/expression/RBAActiveContents.cpp108
-rw-r--r--src/core/expression/RBAActiveContents.hpp54
-rw-r--r--src/core/expression/RBAActiveContentsMaker.cpp38
-rw-r--r--src/core/expression/RBAActiveContentsMaker.hpp50
-rw-r--r--src/core/expression/RBAActiveState.cpp83
-rw-r--r--src/core/expression/RBAActiveState.hpp50
-rw-r--r--src/core/expression/RBAActiveStateMaker.cpp37
-rw-r--r--src/core/expression/RBAActiveStateMaker.hpp50
-rw-r--r--src/core/expression/RBAAllocatableOperator.cpp39
-rw-r--r--src/core/expression/RBAAllocatableOperator.hpp49
-rw-r--r--src/core/expression/RBAAllocatedContent.cpp118
-rw-r--r--src/core/expression/RBAAllocatedContent.hpp54
-rw-r--r--src/core/expression/RBAAllocatedContentMaker.cpp37
-rw-r--r--src/core/expression/RBAAllocatedContentMaker.hpp49
-rw-r--r--src/core/expression/RBAAndOperator.cpp113
-rw-r--r--src/core/expression/RBAAndOperator.hpp53
-rw-r--r--src/core/expression/RBAAndOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAAndOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAArithmeticOperator.cpp26
-rw-r--r--src/core/expression/RBAArithmeticOperator.hpp42
-rw-r--r--src/core/expression/RBAContentOperator.cpp40
-rw-r--r--src/core/expression/RBAContentOperator.hpp49
-rw-r--r--src/core/expression/RBAContentValue.cpp116
-rw-r--r--src/core/expression/RBAContentValue.hpp54
-rw-r--r--src/core/expression/RBAContentValueMaker.cpp38
-rw-r--r--src/core/expression/RBAContentValueMaker.hpp49
-rw-r--r--src/core/expression/RBAExecuteResult.hpp40
-rw-r--r--src/core/expression/RBAExistsOperator.cpp175
-rw-r--r--src/core/expression/RBAExistsOperator.hpp56
-rw-r--r--src/core/expression/RBAExistsOperatorMaker.cpp58
-rw-r--r--src/core/expression/RBAExistsOperatorMaker.hpp63
-rw-r--r--src/core/expression/RBAExpression.cpp156
-rw-r--r--src/core/expression/RBAExpression.hpp91
-rw-r--r--src/core/expression/RBAExpressionMaker.cpp55
-rw-r--r--src/core/expression/RBAExpressionMaker.hpp57
-rw-r--r--src/core/expression/RBAExpressionType.hpp56
-rw-r--r--src/core/expression/RBAExpressionVisitor.hpp168
-rw-r--r--src/core/expression/RBAForAllOperator.cpp173
-rw-r--r--src/core/expression/RBAForAllOperator.hpp56
-rw-r--r--src/core/expression/RBAForAllOperatorMaker.cpp58
-rw-r--r--src/core/expression/RBAForAllOperatorMaker.hpp63
-rw-r--r--src/core/expression/RBAGetAllocatables.cpp95
-rw-r--r--src/core/expression/RBAGetAllocatables.hpp56
-rw-r--r--src/core/expression/RBAGetAllocatablesMaker.cpp37
-rw-r--r--src/core/expression/RBAGetAllocatablesMaker.hpp49
-rw-r--r--src/core/expression/RBAGetContentsList.cpp86
-rw-r--r--src/core/expression/RBAGetContentsList.hpp54
-rw-r--r--src/core/expression/RBAGetContentsListMaker.cpp37
-rw-r--r--src/core/expression/RBAGetContentsListMaker.hpp49
-rw-r--r--src/core/expression/RBAGetProperty.cpp101
-rw-r--r--src/core/expression/RBAGetProperty.hpp57
-rw-r--r--src/core/expression/RBAGetPropertyMaker.cpp37
-rw-r--r--src/core/expression/RBAGetPropertyMaker.hpp49
-rw-r--r--src/core/expression/RBAHasBeenDisplayed.cpp102
-rw-r--r--src/core/expression/RBAHasBeenDisplayed.hpp52
-rw-r--r--src/core/expression/RBAHasBeenDisplayedMaker.cpp37
-rw-r--r--src/core/expression/RBAHasBeenDisplayedMaker.hpp49
-rw-r--r--src/core/expression/RBAHasComeEarlierThan.cpp151
-rw-r--r--src/core/expression/RBAHasComeEarlierThan.hpp56
-rw-r--r--src/core/expression/RBAHasComeEarlierThanMaker.cpp37
-rw-r--r--src/core/expression/RBAHasComeEarlierThanMaker.hpp49
-rw-r--r--src/core/expression/RBAHasComeLaterThan.cpp153
-rw-r--r--src/core/expression/RBAHasComeLaterThan.hpp55
-rw-r--r--src/core/expression/RBAHasComeLaterThanMaker.cpp37
-rw-r--r--src/core/expression/RBAHasComeLaterThanMaker.hpp49
-rw-r--r--src/core/expression/RBAIfStatement.cpp268
-rw-r--r--src/core/expression/RBAIfStatement.hpp73
-rw-r--r--src/core/expression/RBAIfStatementMaker.cpp78
-rw-r--r--src/core/expression/RBAIfStatementMaker.hpp58
-rw-r--r--src/core/expression/RBAImpliesOperator.cpp145
-rw-r--r--src/core/expression/RBAImpliesOperator.hpp54
-rw-r--r--src/core/expression/RBAImpliesOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAImpliesOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAIntegerValue.cpp79
-rw-r--r--src/core/expression/RBAIntegerValue.hpp62
-rw-r--r--src/core/expression/RBAIntegerValueMaker.cpp64
-rw-r--r--src/core/expression/RBAIntegerValueMaker.hpp58
-rw-r--r--src/core/expression/RBAIsActive.cpp113
-rw-r--r--src/core/expression/RBAIsActive.hpp54
-rw-r--r--src/core/expression/RBAIsActiveMaker.cpp37
-rw-r--r--src/core/expression/RBAIsActiveMaker.hpp49
-rw-r--r--src/core/expression/RBAIsEqualToOperator.cpp105
-rw-r--r--src/core/expression/RBAIsEqualToOperator.hpp52
-rw-r--r--src/core/expression/RBAIsEqualToOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAIsEqualToOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAIsGreaterThanEqualOperator.cpp105
-rw-r--r--src/core/expression/RBAIsGreaterThanEqualOperator.hpp52
-rw-r--r--src/core/expression/RBAIsGreaterThanEqualOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAIsGreaterThanEqualOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAIsGreaterThanOperator.cpp105
-rw-r--r--src/core/expression/RBAIsGreaterThanOperator.hpp52
-rw-r--r--src/core/expression/RBAIsGreaterThanOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAIsGreaterThanOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAIsLowerThanEqualOperator.cpp106
-rw-r--r--src/core/expression/RBAIsLowerThanEqualOperator.hpp52
-rw-r--r--src/core/expression/RBAIsLowerThanEqualOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAIsLowerThanEqualOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAIsLowerThanOperator.cpp105
-rw-r--r--src/core/expression/RBAIsLowerThanOperator.hpp52
-rw-r--r--src/core/expression/RBAIsLowerThanOperatorMaker.cpp36
-rw-r--r--src/core/expression/RBAIsLowerThanOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAIsOn.cpp132
-rw-r--r--src/core/expression/RBAIsOn.hpp56
-rw-r--r--src/core/expression/RBAIsOnMaker.cpp37
-rw-r--r--src/core/expression/RBAIsOnMaker.hpp50
-rw-r--r--src/core/expression/RBAIsTypeOfOperator.cpp102
-rw-r--r--src/core/expression/RBAIsTypeOfOperator.hpp66
-rw-r--r--src/core/expression/RBAIsTypeOfOperatorMaker.cpp70
-rw-r--r--src/core/expression/RBAIsTypeOfOperatorMaker.hpp58
-rw-r--r--src/core/expression/RBALambdaContext.cpp92
-rw-r--r--src/core/expression/RBALambdaContext.hpp57
-rw-r--r--src/core/expression/RBALambdaContextMaker.cpp65
-rw-r--r--src/core/expression/RBALambdaContextMaker.hpp60
-rw-r--r--src/core/expression/RBALambdaExpression.cpp139
-rw-r--r--src/core/expression/RBALambdaExpression.hpp77
-rw-r--r--src/core/expression/RBALambdaExpressionMaker.cpp75
-rw-r--r--src/core/expression/RBALambdaExpressionMaker.hpp58
-rw-r--r--src/core/expression/RBALetStatement.cpp68
-rw-r--r--src/core/expression/RBALetStatement.hpp54
-rw-r--r--src/core/expression/RBALetStatementMaker.cpp67
-rw-r--r--src/core/expression/RBALetStatementMaker.hpp58
-rw-r--r--src/core/expression/RBALogicalOperator.cpp73
-rw-r--r--src/core/expression/RBALogicalOperator.hpp50
-rw-r--r--src/core/expression/RBAMaxOperator.cpp135
-rw-r--r--src/core/expression/RBAMaxOperator.hpp53
-rw-r--r--src/core/expression/RBAMaxOperatorMaker.cpp60
-rw-r--r--src/core/expression/RBAMaxOperatorMaker.hpp63
-rw-r--r--src/core/expression/RBAMemberFeatureReferenceMaker.cpp94
-rw-r--r--src/core/expression/RBAMemberFeatureReferenceMaker.hpp62
-rw-r--r--src/core/expression/RBAMinOperator.cpp135
-rw-r--r--src/core/expression/RBAMinOperator.hpp51
-rw-r--r--src/core/expression/RBAMinOperatorMaker.cpp60
-rw-r--r--src/core/expression/RBAMinOperatorMaker.hpp63
-rw-r--r--src/core/expression/RBANotOperator.cpp99
-rw-r--r--src/core/expression/RBANotOperator.hpp55
-rw-r--r--src/core/expression/RBANotOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBANotOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAObjectCompare.cpp165
-rw-r--r--src/core/expression/RBAObjectCompare.hpp57
-rw-r--r--src/core/expression/RBAObjectCompareMaker.cpp37
-rw-r--r--src/core/expression/RBAObjectCompareMaker.hpp49
-rw-r--r--src/core/expression/RBAObjectReference.cpp133
-rw-r--r--src/core/expression/RBAObjectReference.hpp63
-rw-r--r--src/core/expression/RBAObjectReferenceMaker.cpp77
-rw-r--r--src/core/expression/RBAObjectReferenceMaker.hpp58
-rw-r--r--src/core/expression/RBAOperator.cpp99
-rw-r--r--src/core/expression/RBAOperator.hpp67
-rw-r--r--src/core/expression/RBAOperatorMaker.cpp61
-rw-r--r--src/core/expression/RBAOperatorMaker.hpp53
-rw-r--r--src/core/expression/RBAOrOperator.cpp100
-rw-r--r--src/core/expression/RBAOrOperator.hpp53
-rw-r--r--src/core/expression/RBAOrOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAOrOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAPlusOperator.cpp33
-rw-r--r--src/core/expression/RBAPlusOperator.hpp46
-rw-r--r--src/core/expression/RBAPlusOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBAPlusOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAPreviousModifier.cpp97
-rw-r--r--src/core/expression/RBAPreviousModifier.hpp75
-rw-r--r--src/core/expression/RBAPreviousModifierMaker.cpp67
-rw-r--r--src/core/expression/RBAPreviousModifierMaker.hpp58
-rw-r--r--src/core/expression/RBAPreviousObjectWrapper.cpp45
-rw-r--r--src/core/expression/RBAPreviousObjectWrapper.hpp52
-rw-r--r--src/core/expression/RBAPropertyOperator.hpp46
-rw-r--r--src/core/expression/RBASceneCondition.hpp44
-rw-r--r--src/core/expression/RBASceneOperator.hpp45
-rw-r--r--src/core/expression/RBASelectOperator.cpp140
-rw-r--r--src/core/expression/RBASelectOperator.hpp59
-rw-r--r--src/core/expression/RBASelectOperatorMaker.cpp60
-rw-r--r--src/core/expression/RBASelectOperatorMaker.hpp63
-rw-r--r--src/core/expression/RBASetExpression.hpp44
-rw-r--r--src/core/expression/RBASetOfOperator.cpp194
-rw-r--r--src/core/expression/RBASetOfOperator.hpp73
-rw-r--r--src/core/expression/RBASetOfOperatorMaker.cpp39
-rw-r--r--src/core/expression/RBASetOfOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBASetOperator.hpp44
-rw-r--r--src/core/expression/RBASizeOperator.cpp84
-rw-r--r--src/core/expression/RBASizeOperator.hpp51
-rw-r--r--src/core/expression/RBASizeOperatorMaker.cpp37
-rw-r--r--src/core/expression/RBASizeOperatorMaker.hpp49
-rw-r--r--src/core/expression/RBAStateValue.cpp107
-rw-r--r--src/core/expression/RBAStateValue.hpp53
-rw-r--r--src/core/expression/RBAStateValueMaker.cpp37
-rw-r--r--src/core/expression/RBAStateValueMaker.hpp49
-rw-r--r--src/core/expression/RBAValueExpression.hpp44
-rw-r--r--src/core/expression/RBAVariable.cpp79
-rw-r--r--src/core/expression/RBAVariable.hpp65
-rw-r--r--src/core/expression/RBAVariableMaker.cpp64
-rw-r--r--src/core/expression/RBAVariableMaker.hpp70
-rw-r--r--src/core/logic/RBAAffectInfo.cpp67
-rw-r--r--src/core/logic/RBAAffectInfo.hpp58
-rw-r--r--src/core/logic/RBAArbitrator.cpp1987
-rw-r--r--src/core/logic/RBABackUpAllocatable.cpp33
-rw-r--r--src/core/logic/RBABackUpAllocatable.hpp42
-rw-r--r--src/core/logic/RBACommonMakerTable.cpp126
-rw-r--r--src/core/logic/RBACommonMakerTable.hpp52
-rw-r--r--src/core/logic/RBAConstraintInfo.cpp695
-rw-r--r--src/core/logic/RBAConstraintInfo.hpp119
-rw-r--r--src/core/logic/RBAConstraintMap.hpp38
-rw-r--r--src/core/logic/RBAContentStatus.cpp72
-rw-r--r--src/core/logic/RBAContentStatus.hpp58
-rw-r--r--src/core/logic/RBARequest.cpp44
-rw-r--r--src/core/logic/RBARequest.hpp59
-rw-r--r--src/core/logic/RBARequestQueMember.cpp48
-rw-r--r--src/core/logic/RBARequestQueMember.hpp64
-rw-r--r--src/core/logic/RBAResultImpl.cpp1088
-rw-r--r--src/core/logic/RBAResultImpl.hpp343
-rw-r--r--src/core/logic/RBAResultSet.cpp996
-rw-r--r--src/core/logic/RBAResultSet.hpp246
-rw-r--r--src/core/logic/RBARollbacker.cpp95
-rw-r--r--src/core/logic/RBARollbacker.hpp84
-rw-r--r--src/core/logic/RBAViewAction.cpp88
-rw-r--r--src/core/logic/RBAViewMove.cpp89
-rw-r--r--src/core/logic/RBAViewMove.hpp62
-rw-r--r--src/core/logic/RBAViewTransition.cpp137
-rw-r--r--src/core/logic/RBAViewTransition.hpp64
-rw-r--r--src/core/model/RBAAbstractAllocatable.cpp56
-rw-r--r--src/core/model/RBAAbstractAllocatable.hpp65
-rw-r--r--src/core/model/RBAAbstractAllocatableMaker.cpp52
-rw-r--r--src/core/model/RBAAbstractAllocatableMaker.hpp53
-rw-r--r--src/core/model/RBAAbstractConstraint.cpp81
-rw-r--r--src/core/model/RBAAbstractConstraint.hpp71
-rw-r--r--src/core/model/RBAAbstractConstraintMaker.cpp52
-rw-r--r--src/core/model/RBAAbstractConstraintMaker.hpp54
-rw-r--r--src/core/model/RBAAbstractContent.cpp31
-rw-r--r--src/core/model/RBAAbstractContent.hpp45
-rw-r--r--src/core/model/RBAAbstractContentMaker.cpp53
-rw-r--r--src/core/model/RBAAbstractContentMaker.hpp53
-rw-r--r--src/core/model/RBAAbstractProperty.cpp46
-rw-r--r--src/core/model/RBAAbstractProperty.hpp61
-rw-r--r--src/core/model/RBAAllocatable.cpp387
-rw-r--r--src/core/model/RBAAllocatable.hpp131
-rw-r--r--src/core/model/RBAAllocatableMaker.cpp82
-rw-r--r--src/core/model/RBAAllocatableMaker.hpp54
-rw-r--r--src/core/model/RBAAllocatableSet.cpp65
-rw-r--r--src/core/model/RBAAllocatableSet.hpp59
-rw-r--r--src/core/model/RBAAllocatableSetMaker.cpp57
-rw-r--r--src/core/model/RBAAllocatableSetMaker.hpp53
-rw-r--r--src/core/model/RBAConstraint.hpp45
-rw-r--r--src/core/model/RBAConstraintImpl.cpp96
-rw-r--r--src/core/model/RBAConstraintImpl.hpp56
-rw-r--r--src/core/model/RBAConstraintMaker.cpp63
-rw-r--r--src/core/model/RBAConstraintMaker.hpp58
-rw-r--r--src/core/model/RBAContent.cpp107
-rw-r--r--src/core/model/RBAContent.hpp87
-rw-r--r--src/core/model/RBAContentMaker.cpp126
-rw-r--r--src/core/model/RBAContentMaker.hpp53
-rw-r--r--src/core/model/RBAContentSet.cpp66
-rw-r--r--src/core/model/RBAContentSet.hpp61
-rw-r--r--src/core/model/RBAContentSetMaker.cpp55
-rw-r--r--src/core/model/RBAContentSetMaker.hpp52
-rw-r--r--src/core/model/RBAContentState.cpp133
-rw-r--r--src/core/model/RBAContentState.hpp74
-rw-r--r--src/core/model/RBAContentStateMaker.cpp79
-rw-r--r--src/core/model/RBAContentStateMaker.hpp58
-rw-r--r--src/core/model/RBAContentStatusType.hpp36
-rw-r--r--src/core/model/RBAIntegerProperty.cpp48
-rw-r--r--src/core/model/RBAIntegerProperty.hpp53
-rw-r--r--src/core/model/RBAModelElement.cpp47
-rw-r--r--src/core/model/RBAModelElement.hpp52
-rw-r--r--src/core/model/RBAModelElementMaker.cpp122
-rw-r--r--src/core/model/RBAModelElementMaker.hpp135
-rw-r--r--src/core/model/RBAModelElementType.hpp116
-rw-r--r--src/core/model/RBAModelImpl.cpp823
-rw-r--r--src/core/model/RBAModelImpl.hpp221
-rw-r--r--src/core/model/RBANamedElement.cpp54
-rw-r--r--src/core/model/RBANamedElement.hpp60
-rw-r--r--src/core/model/RBARuleObject.cpp105
-rw-r--r--src/core/model/RBARuleObject.hpp73
-rw-r--r--src/core/model/RBARuleObjectMaker.cpp62
-rw-r--r--src/core/model/RBARuleObjectMaker.hpp52
-rw-r--r--src/core/model/RBASceneImpl.cpp113
-rw-r--r--src/core/model/RBASceneImpl.hpp65
-rw-r--r--src/core/model/RBASceneMaker.cpp74
-rw-r--r--src/core/model/RBASceneMaker.hpp57
277 files changed, 25055 insertions, 0 deletions
diff --git a/src/core/expression/RBAActionOperator.cpp b/src/core/expression/RBAActionOperator.cpp
new file mode 100644
index 0000000..7cd38ec
--- /dev/null
+++ b/src/core/expression/RBAActionOperator.cpp
@@ -0,0 +1,35 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * Action operator class definition
+ */
+
+#include "RBAActionOperator.hpp"
+#include "RBAExpressionType.hpp"
+
+namespace rba
+{
+
+#ifdef RBA_USE_LOG
+RBAExpressionType
+RBAActionOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::ACTION;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAActionOperator.hpp b/src/core/expression/RBAActionOperator.hpp
new file mode 100644
index 0000000..677f699
--- /dev/null
+++ b/src/core/expression/RBAActionOperator.hpp
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Action operator class
+ */
+
+#ifndef RBAACTIONOPERATOR_HPP
+#define RBAACTIONOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAActionOperator : public RBAOperator
+{
+protected:
+ RBAActionOperator()=default;
+ RBAActionOperator(const RBAActionOperator&)=delete;
+ RBAActionOperator(const RBAActionOperator&&)=delete;
+ RBAActionOperator& operator=(const RBAActionOperator&)=delete;
+ RBAActionOperator& operator=(const RBAActionOperator&&)=delete;
+
+public:
+ // Log
+#ifdef RBA_USE_LOG
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAActiveContents.cpp b/src/core/expression/RBAActiveContents.cpp
new file mode 100644
index 0000000..b5d88a7
--- /dev/null
+++ b/src/core/expression/RBAActiveContents.cpp
@@ -0,0 +1,108 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Select operator class definition
+ */
+
+#include <memory>
+#include "RBAActiveContents.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+RBAActiveContents::RBAActiveContents()
+: RBAAllocatableOperator(),
+ contentSet_{std::make_unique<RBAContentSet>()}
+{
+}
+
+void
+RBAActiveContents::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAActiveContents::getModelElementType() const
+{
+ return RBAModelElementType::ActiveContents;
+}
+
+const RBARuleObject*
+RBAActiveContents::getReferenceObjectCore(RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ LOG_addHierarchy(LOG_getSymbol());
+ const RBARuleObject* returnObj {nullptr};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const lhsObj {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ else if (lhsObj != nullptr) {
+ contentSet_->clear();
+ const RBAAllocatable* const alloc {dynamic_cast<const RBAAllocatable*>(lhsObj->getRawObject())};
+#ifdef RBA_USE_LOG
+ if (arb == nullptr) {
+ // Follow this path when called from createHierarchy()
+ returnObj = alloc->getContentSet();
+ } else {
+#endif
+ for (auto& content : alloc->getInternalContents()) {
+ if (alloc->isPrevious()) {
+ if (arb->getResult()->isPreActive(content)) {
+ contentSet_->addTarget(content);
+ }
+ } else {
+ if (arb->getResult()->isActive(content)) {
+ contentSet_->addTarget(content);
+ }
+ }
+ }
+ returnObj = contentSet_.get();
+#ifdef RBA_USE_LOG
+ }
+#endif
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ std::string objName = "NULL";
+ if (returnObj != nullptr) {
+ objName = returnObj->getElementName();
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + LOG_getExpressionText() + " is " + objName);
+#endif
+ LOG_removeHierarchy();
+ return returnObj;
+}
+#ifdef RBA_USE_LOG
+const std::string
+RBAActiveContents::getSymbol() const
+{
+ return ".activeContents()";
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAActiveContents.hpp b/src/core/expression/RBAActiveContents.hpp
new file mode 100644
index 0000000..3ee9f7d
--- /dev/null
+++ b/src/core/expression/RBAActiveContents.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ActiveContents operator
+ */
+
+#ifndef RBAACTIVECONTENTS_HPP
+#define RBAACTIVECONTENTS_HPP
+
+#include "RBAAllocatableOperator.hpp"
+#include "RBAContentSet.hpp"
+
+namespace rba
+{
+
+class RBAActiveContents : public RBAAllocatableOperator
+{
+ public:
+ RBAActiveContents();
+ RBAActiveContents(const RBAActiveContents&)=delete;
+ RBAActiveContents(const RBAActiveContents&&)=delete;
+ RBAActiveContents& operator=(const RBAActiveContents&)=delete;
+ RBAActiveContents& operator=(const RBAActiveContents&&)=delete;
+ virtual ~RBAActiveContents()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+#endif
+ private:
+ std::unique_ptr<RBAContentSet> contentSet_;
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAActiveContentsMaker.cpp b/src/core/expression/RBAActiveContentsMaker.cpp
new file mode 100644
index 0000000..f883fee
--- /dev/null
+++ b/src/core/expression/RBAActiveContentsMaker.cpp
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAActiveContentsMaker.cpp
+/// @brief ActiveContents object creation class defintion
+///
+
+#include "RBAActiveContentsMaker.hpp"
+#include "RBAActiveContents.hpp"
+
+namespace rba
+{
+
+RBAActiveContentsMaker::RBAActiveContentsMaker()
+ : RBAOperatorMaker{"ActiveContents"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAActiveContentsMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAActiveContents>();
+}
+
+}
diff --git a/src/core/expression/RBAActiveContentsMaker.hpp b/src/core/expression/RBAActiveContentsMaker.hpp
new file mode 100644
index 0000000..493e569
--- /dev/null
+++ b/src/core/expression/RBAActiveContentsMaker.hpp
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAActiveContentsMaker.hpp
+/// @brief ActiveContents object creation class header
+///
+
+#ifndef RBAACTIVECONTENTSMAKER_HPP
+#define RBAACTIVECONTENTSMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ActiveContents object creation class
+class RBAActiveContentsMaker : public RBAOperatorMaker
+{
+public:
+ RBAActiveContentsMaker();
+ RBAActiveContentsMaker(const RBAActiveContentsMaker&)=delete;
+ RBAActiveContentsMaker(const RBAActiveContentsMaker&&)=delete;
+ RBAActiveContentsMaker& operator=(const RBAActiveContentsMaker&)=delete;
+ RBAActiveContentsMaker& operator=(const RBAActiveContentsMaker&&)=delete;
+ virtual ~RBAActiveContentsMaker()=default;
+
+public:
+ /// @brief Empty instanciation
+ /// @details Create an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAActiveState.cpp b/src/core/expression/RBAActiveState.cpp
new file mode 100644
index 0000000..1e0f6b3
--- /dev/null
+++ b/src/core/expression/RBAActiveState.cpp
@@ -0,0 +1,83 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * activeState definition
+ */
+
+#include "RBAActiveState.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentState.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBALogManager.hpp"
+
+namespace rba
+{
+
+void RBAActiveState::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+RBAModelElementType RBAActiveState::getModelElementType() const
+{
+ return RBAModelElementType::ActiveState;
+}
+const RBARuleObject* RBAActiveState::getReferenceObjectCore(
+ RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ LOG_addHierarchy(LOG_getSymbol());
+ const RBARuleObject* returnObj {nullptr};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const ruleObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (ruleObj != nullptr) {
+ const RBAContent* const c {
+ dynamic_cast<const RBAContent*>(ruleObj->getRawObject())};
+ if (ruleObj->isPrevious()) {
+ returnObj = arb->getResult()->getPreActiveState(c);
+ } else {
+ returnObj = arb->getResult()->getActiveState(c);
+ }
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ std::string str;
+ if (info->isExceptionBeforeArbitrate()) {
+ str = " is before arbitrate skip";
+ } else if (ruleObj == nullptr) {
+ str = " no Content";
+ } else if (returnObj == nullptr) {
+ str = " has no Active State";
+ } else {
+ str = " is " + returnObj->getElementName();
+ }
+ LOG_arbitrateConstraintLogicLogLine(" " + getExpressionText() + str);
+#endif
+ LOG_removeHierarchy();
+ return returnObj;
+}
+#ifdef RBA_USE_LOG
+const std::string RBAActiveState::getSymbol() const
+{
+ return ".activeState()";
+}
+#endif
+} /* namespace rba */
diff --git a/src/core/expression/RBAActiveState.hpp b/src/core/expression/RBAActiveState.hpp
new file mode 100644
index 0000000..3876c78
--- /dev/null
+++ b/src/core/expression/RBAActiveState.hpp
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// activeState header
+//
+
+#ifndef RBAACTIVESTATE_HPP
+#define RBAACTIVESTATE_HPP
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class RBAActiveState : public RBAContentOperator
+{
+ public:
+ RBAActiveState()=default;
+ RBAActiveState(const RBAActiveState&)=delete;
+ RBAActiveState(const RBAActiveState&&)=delete;
+ RBAActiveState& operator=(const RBAActiveState&)=delete;
+ RBAActiveState& operator=(const RBAActiveState&&)=delete;
+ virtual ~RBAActiveState()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+#endif
+};
+
+} /* namespace rba */
+
+#endif /* RBAACTIVESTATE_HPP */
diff --git a/src/core/expression/RBAActiveStateMaker.cpp b/src/core/expression/RBAActiveStateMaker.cpp
new file mode 100644
index 0000000..16d8f4c
--- /dev/null
+++ b/src/core/expression/RBAActiveStateMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAActiveStateMaker.cpp
+/// @brief ActiveState objeckt maker class definition
+
+#include "RBAActiveStateMaker.hpp"
+#include "RBAActiveState.hpp"
+
+namespace rba
+{
+
+RBAActiveStateMaker::RBAActiveStateMaker()
+ : RBAOperatorMaker{"ActiveState"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAActiveStateMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAActiveState>();
+}
+
+}
diff --git a/src/core/expression/RBAActiveStateMaker.hpp b/src/core/expression/RBAActiveStateMaker.hpp
new file mode 100644
index 0000000..7d42cbe
--- /dev/null
+++ b/src/core/expression/RBAActiveStateMaker.hpp
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAActiveStateMaker.hpp
+/// @brief ActiveState object maker class header
+///
+
+#ifndef RBAACTIVESTATEMAKER_HPP
+#define RBAACTIVESTATEMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ActiveState object maker class
+class RBAActiveStateMaker : public RBAOperatorMaker
+{
+public:
+ RBAActiveStateMaker();
+ RBAActiveStateMaker(const RBAActiveStateMaker&)=delete;
+ RBAActiveStateMaker(const RBAActiveStateMaker&&)=delete;
+ RBAActiveStateMaker& operator=(const RBAActiveStateMaker&)=delete;
+ RBAActiveStateMaker& operator=(const RBAActiveStateMaker&&)=delete;
+ virtual ~RBAActiveStateMaker()=default;
+
+protected:
+ /// @brief Empty instanciation
+ /// @details Create an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAAllocatableOperator.cpp b/src/core/expression/RBAAllocatableOperator.cpp
new file mode 100644
index 0000000..15a9104
--- /dev/null
+++ b/src/core/expression/RBAAllocatableOperator.cpp
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Allcatable operator class definitio
+ */
+
+#include "RBAAllocatableOperator.hpp"
+
+namespace rba
+{
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAAllocatableOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+
+const std::string
+RBAAllocatableOperator::getCoverageExpressionText() const
+{
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAAllocatableOperator.hpp b/src/core/expression/RBAAllocatableOperator.hpp
new file mode 100644
index 0000000..7a4f40a
--- /dev/null
+++ b/src/core/expression/RBAAllocatableOperator.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Allocatable operator class header
+ */
+
+#ifndef RBAALLOCATABLEOPERATOR_HPP
+#define RBAALLOCATABLEOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAAllocatableOperator : public RBAOperator
+{
+protected:
+ RBAAllocatableOperator()=default;
+ RBAAllocatableOperator(const RBAAllocatableOperator&)=delete;
+ RBAAllocatableOperator(const RBAAllocatableOperator&&)=delete;
+ RBAAllocatableOperator& operator=(const RBAAllocatableOperator&)=delete;
+ RBAAllocatableOperator& operator=(const RBAAllocatableOperator&&)=delete;
+
+public:
+ virtual ~RBAAllocatableOperator()=default;
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAAllocatedContent.cpp b/src/core/expression/RBAAllocatedContent.cpp
new file mode 100644
index 0000000..923717d
--- /dev/null
+++ b/src/core/expression/RBAAllocatedContent.cpp
@@ -0,0 +1,118 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Allocated Content class
+ */
+
+#include "RBAAllocatedContent.hpp"
+
+#include "RBAAllocatable.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAContentState.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void RBAAllocatedContent::accept(RBAExpressionVisitor& visitor)
+{
+ // RBASceneAllocatableCollector which is the only visitor at the moment
+ // does not accept this content, so it will not pass this path.
+ //
+ // However, in the future, another visitor may accept it, so leave this.
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAAllocatedContent::getModelElementType() const
+{
+ return RBAModelElementType::AllocatedContent;
+}
+
+const RBARuleObject*
+RBAAllocatedContent::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ const RBARuleObject* object {nullptr}; // return value
+ const auto leftInfo = info->getChild(0U);
+ const auto ruleObj = getLhsOperand()->getReferenceObject(leftInfo, arb);
+ if (ruleObj != nullptr) {
+ if (!leftInfo->isExceptionBeforeArbitrate()) {
+ const RBAAllocatable* const alloc {dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())};
+ if (ruleObj->isPrevious() == true) {
+ const auto contentState = arb->getResult()->getDirectPreContentState(alloc);
+ if(contentState != nullptr) {
+ object = contentState->getOwner();
+ }
+ } else if (alloc->isChecked()) {
+ const auto contentState = alloc->getState();
+ if (contentState != nullptr) {
+ object = contentState->getOwner();
+ }
+ // At this point, it is unsure whether the constraint expression will be False or True,
+ // so put it in both.
+ info->addTrueAllocatable(alloc);
+ info->addFalseAllocatable(alloc);
+ } else {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ } else {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ }
+#ifdef RBA_USE_LOG
+ bool pre = false;
+ std::string str;
+ if (ruleObj == nullptr) {
+ // Currently there is no constraint expression that returns an area.
+ // Therefore, ruleObj never becomes NULL.
+ // In the future, a constraint expression that returns an area
+ // may be created, so leave this processing.
+ str = "Allocatable[NULL] has no Content skip";
+ } else {
+ pre = ruleObj->isPrevious();
+ if (info->isExceptionBeforeArbitrate()) {
+ str = "Allocatable[" + ruleObj->getElementName() + "] is before arbitrate skip";
+ } else if (object == nullptr) {
+ str = "Allocatable[" + ruleObj->getElementName() + "] has no Allocated Content";
+ } else {
+ str = "Allocatable[" + ruleObj->getElementName() + "] has Allocated Content["
+ + object->getElementName() + "]";
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(" " + getPreMsg(pre) + str);
+#endif
+ return object;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAAllocatedContent::getSymbol() const
+{
+ return ".allocatedContent()";
+}
+
+void
+RBAAllocatedContent::createHierarchy()
+{
+ getLhsOperand()->createHierarchy();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAAllocatedContent.hpp b/src/core/expression/RBAAllocatedContent.hpp
new file mode 100644
index 0000000..6fb44e2
--- /dev/null
+++ b/src/core/expression/RBAAllocatedContent.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Allocated Content class
+ */
+
+#ifndef RBAALLOCATEDCONTENT_HPP
+#define RBAALLOCATEDCONTENT_HPP
+
+#include "RBAAllocatableOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAAllocatedContent : public RBAAllocatableOperator
+{
+ public:
+ RBAAllocatedContent()=default;
+ RBAAllocatedContent(const RBAAllocatedContent&)=delete;
+ RBAAllocatedContent(const RBAAllocatedContent&&)=delete;
+ RBAAllocatedContent& operator=(const RBAAllocatedContent&)=delete;
+ RBAAllocatedContent& operator=(const RBAAllocatedContent&&)=delete;
+ virtual ~RBAAllocatedContent()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ void createHierarchy() override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAAllocatedContentMaker.cpp b/src/core/expression/RBAAllocatedContentMaker.cpp
new file mode 100644
index 0000000..36d3ad7
--- /dev/null
+++ b/src/core/expression/RBAAllocatedContentMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAllocatedContentMaker.cpp
+/// @brief AllocatedContent object maker class
+
+#include "RBAAllocatedContentMaker.hpp"
+#include "RBAAllocatedContent.hpp"
+
+namespace rba
+{
+
+RBAAllocatedContentMaker::RBAAllocatedContentMaker()
+ : RBAOperatorMaker{"AllocatedContent"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAAllocatedContentMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAAllocatedContent>();
+}
+
+}
diff --git a/src/core/expression/RBAAllocatedContentMaker.hpp b/src/core/expression/RBAAllocatedContentMaker.hpp
new file mode 100644
index 0000000..10f83b9
--- /dev/null
+++ b/src/core/expression/RBAAllocatedContentMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAllocatedContentMaker.hpp
+/// @brief AllocatedContent object maker class header file
+
+#ifndef RBAALLOCATEDCONTENTMAKER_HPP
+#define RBAALLOCATEDCONTENTMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief AllocatedContent object maker class
+class RBAAllocatedContentMaker : public RBAOperatorMaker
+{
+public:
+ RBAAllocatedContentMaker();
+ RBAAllocatedContentMaker(const RBAAllocatedContentMaker&)=delete;
+ RBAAllocatedContentMaker(const RBAAllocatedContentMaker&&)=delete;
+ RBAAllocatedContentMaker& operator=(const RBAAllocatedContentMaker&)=delete;
+ RBAAllocatedContentMaker& operator=(const RBAAllocatedContentMaker&&)=delete;
+ virtual ~RBAAllocatedContentMaker()=default;
+
+protected:
+ /// @brief Empty instanciation
+ /// @details Create an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAAndOperator.cpp b/src/core/expression/RBAAndOperator.cpp
new file mode 100644
index 0000000..0f3a30d
--- /dev/null
+++ b/src/core/expression/RBAAndOperator.cpp
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AND operator class definition
+ */
+
+#include "RBAAndOperator.hpp"
+
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void
+RBAAndOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAAndOperator::getModelElementType() const
+{
+ return RBAModelElementType::AndOperator;
+}
+
+bool
+RBAAndOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator * arb) const
+{
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+
+ std::uint32_t falseCount {0U};
+ std::uint32_t exceptionCount {0U};
+ std::uint32_t index {0U};
+ for(const auto& ope : getOperand()) {
+ // Add count to constraint hierarchy for coverage
+ LOG_addHierarchy("#" + std::to_string(index));
+
+ RBAConstraintInfo* const childInfo {info->getChild(index)};
+ const bool res {ope->execute(childInfo, arb)};
+ if(childInfo->isExceptionBeforeArbitrate()) {
+ exceptionCount++;
+ } else if(!res) {
+ falseCount++;
+ } else {
+ ;
+ }
+
+ // Remove count to constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ index++;
+ }
+
+ // with fail
+ if (falseCount > 0U) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ // Rmove count to constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return false;
+ }
+
+ // exception
+ if (exceptionCount > 0U) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ // Rmove count to constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ info->setExceptionBeforeArbitrate(true);
+ return false;
+ }
+
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ // Rmove count to constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ return true;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAAndOperator::getSymbol() const
+{
+ return "AND";
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAAndOperator.hpp b/src/core/expression/RBAAndOperator.hpp
new file mode 100644
index 0000000..229c69f
--- /dev/null
+++ b/src/core/expression/RBAAndOperator.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AND operator class header fiel
+ */
+
+#ifndef RBAANDOPERATOR_HPP
+#define RBAANDOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAAndOperator : public RBALogicalOperator
+{
+ public:
+ RBAAndOperator()=default;
+ RBAAndOperator(const RBAAndOperator&)=delete;
+ RBAAndOperator(const RBAAndOperator&&)=delete;
+ RBAAndOperator& operator=(const RBAAndOperator&)=delete;
+ RBAAndOperator& operator=(const RBAAndOperator&&)=delete;
+ virtual ~RBAAndOperator()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAAndOperatorMaker.cpp b/src/core/expression/RBAAndOperatorMaker.cpp
new file mode 100644
index 0000000..1606e6b
--- /dev/null
+++ b/src/core/expression/RBAAndOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAndOperatorMaker.cpp
+/// @brief AndOperator object maker class defintion file
+
+#include "RBAAndOperatorMaker.hpp"
+#include "RBAAndOperator.hpp"
+
+namespace rba
+{
+
+RBAAndOperatorMaker::RBAAndOperatorMaker()
+ : RBAOperatorMaker{"AndOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAAndOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAAndOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAAndOperatorMaker.hpp b/src/core/expression/RBAAndOperatorMaker.hpp
new file mode 100644
index 0000000..6198440
--- /dev/null
+++ b/src/core/expression/RBAAndOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAndOperatorMaker.hpp
+/// @brief AndOperator object maker classs header file
+
+#ifndef RBAANDOPERATORMAKER_HPP
+#define RBAANDOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief AndOperator object maker classs
+class RBAAndOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAAndOperatorMaker();
+ RBAAndOperatorMaker(const RBAAndOperatorMaker&)=delete;
+ RBAAndOperatorMaker(const RBAAndOperatorMaker&&)=delete;
+ RBAAndOperatorMaker& operator=(const RBAAndOperatorMaker&)=delete;
+ RBAAndOperatorMaker& operator=(const RBAAndOperatorMaker&&)=delete;
+ virtual ~RBAAndOperatorMaker()=default;
+
+protected:
+ /// @brief Empty instanciation
+ /// @details Create an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAArithmeticOperator.cpp b/src/core/expression/RBAArithmeticOperator.cpp
new file mode 100644
index 0000000..2bf25de
--- /dev/null
+++ b/src/core/expression/RBAArithmeticOperator.cpp
@@ -0,0 +1,26 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ArithmeticOperator class definition
+ */
+
+#include "RBAArithmeticOperator.hpp"
+
+namespace rba
+{
+
+}
diff --git a/src/core/expression/RBAArithmeticOperator.hpp b/src/core/expression/RBAArithmeticOperator.hpp
new file mode 100644
index 0000000..5113a84
--- /dev/null
+++ b/src/core/expression/RBAArithmeticOperator.hpp
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ArithmeticOperator class header file
+ */
+
+#ifndef RBAARITHMETICOPERATOR_HPP
+#define RBAARITHMETICOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAArithmeticOperator : public RBAOperator
+{
+protected:
+ RBAArithmeticOperator()=default;
+ RBAArithmeticOperator(const RBAArithmeticOperator&)=delete;
+ RBAArithmeticOperator(const RBAArithmeticOperator&&)=delete;
+ RBAArithmeticOperator& operator=(const RBAArithmeticOperator&)=delete;
+ RBAArithmeticOperator& operator=(const RBAArithmeticOperator&&)=delete;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAContentOperator.cpp b/src/core/expression/RBAContentOperator.cpp
new file mode 100644
index 0000000..6f7083b
--- /dev/null
+++ b/src/core/expression/RBAContentOperator.cpp
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ContentOperator class definition
+ */
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAContentOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+
+const std::string
+RBAContentOperator::getCoverageExpressionText() const
+{
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAContentOperator.hpp b/src/core/expression/RBAContentOperator.hpp
new file mode 100644
index 0000000..fef5ec3
--- /dev/null
+++ b/src/core/expression/RBAContentOperator.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ContentOperator class
+ */
+
+#ifndef RBACONTENTOPERATOR_HPP
+#define RBACONTENTOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAContentOperator : public RBAOperator
+{
+protected:
+ RBAContentOperator()=default;
+ RBAContentOperator(const RBAContentOperator&)=delete;
+ RBAContentOperator(const RBAContentOperator&&)=delete;
+ RBAContentOperator& operator=(const RBAContentOperator&)=delete;
+ RBAContentOperator& operator=(const RBAContentOperator&&)=delete;
+
+public:
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAContentValue.cpp b/src/core/expression/RBAContentValue.cpp
new file mode 100644
index 0000000..23b1b20
--- /dev/null
+++ b/src/core/expression/RBAContentValue.cpp
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ContentValue class definition
+ */
+
+#include <string>
+#include "RBAContentValue.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAContentState.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void RBAContentValue::accept(RBAExpressionVisitor& visitor)
+{
+ // RBA SceneAllocatableCollector which is only existing vistor at this time
+ // does not accept the value of the content state.
+ // So this code doesn't work.
+ //
+ // But, leave this because another visitor may accept it in the future.
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAContentValue::getModelElementType() const
+{
+ return RBAModelElementType::ContentValue;
+}
+
+std::int32_t
+RBAContentValue::getValueCore(RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ std::int32_t result { -99 };
+ const auto leftInfo = info->getChild(0U);
+ const auto r = getLhsOperand()->getReferenceObject(leftInfo, arb);
+ const RBAContentState* cs { nullptr };
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (r != nullptr) {
+ const auto a = dynamic_cast<const RBAAllocatable*>(r->getRawObject());
+ if (a != nullptr) {
+ if (r->isPrevious()) {
+ cs = arb->getResult()->getDirectPreContentState(a);
+ if (cs != nullptr) {
+ result = cs->getContentStatePriority();
+ }
+ } else {
+ info->addOperandAllocatable(a);
+ if (a->isChecked()) {
+ cs = a->getState();
+ if (cs != nullptr) {
+ result = cs->getContentStatePriority();
+ }
+ } else {
+ // Throw an Exception if arbitration is not over
+ info->setExceptionBeforeArbitrate(true);
+ }
+ }
+ }
+ }
+ }
+#ifdef RBA_USE_LOG
+ std::string pre;
+ std::string aName = "NULL";
+ std::string resultText = "no Content skip";
+ if (r != nullptr) {
+ aName = r->getElementName();
+ pre = getPreMsg(r->isPrevious());
+ }
+ if (info->isExceptionBeforeArbitrate()) {
+ resultText = "before arbitrate skip";
+ } else {
+ if (cs != nullptr) {
+ resultText = cs->getOwner()->getElementName() + "::" + cs->getElementName() + " : " + cs->getPriorityString();
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " "
+ + pre
+ + "Allocatable["
+ + aName
+ + "] has Content Priority ["
+ + resultText
+ + "]");
+ #endif
+ return result;
+}
+#ifdef RBA_USE_LOG
+const std::string
+RBAContentValue::getSymbol() const
+{
+ return ".contentValue()";
+}
+#endif
+}
diff --git a/src/core/expression/RBAContentValue.hpp b/src/core/expression/RBAContentValue.hpp
new file mode 100644
index 0000000..52bd841
--- /dev/null
+++ b/src/core/expression/RBAContentValue.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * ContentValue class header file
+ */
+
+#ifndef RBACONTENTVALUE_HPP
+#define RBACONTENTVALUE_HPP
+
+#include <cstdint>
+#include "RBAAllocatableOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAContentValue : public RBAAllocatableOperator
+{
+public:
+ RBAContentValue()=default;
+ RBAContentValue(const RBAContentValue&)=delete;
+ RBAContentValue(RBAContentValue&&)=delete;
+ RBAContentValue& operator=(const RBAContentValue&)=delete;
+ RBAContentValue& operator=(RBAContentValue&&)=delete;
+ virtual ~RBAContentValue()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAContentValueMaker.cpp b/src/core/expression/RBAContentValueMaker.cpp
new file mode 100644
index 0000000..48aaaeb
--- /dev/null
+++ b/src/core/expression/RBAContentValueMaker.cpp
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAContentValueMaker.cpp
+/// @brief ContentValue object maker classs definition
+
+#include "RBAContentValueMaker.hpp"
+#include "RBAContentValue.hpp"
+
+namespace rba
+{
+
+RBAContentValueMaker::RBAContentValueMaker()
+ : RBAOperatorMaker{"ContentValue"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAContentValueMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAContentValue>();
+}
+
+
+}
diff --git a/src/core/expression/RBAContentValueMaker.hpp b/src/core/expression/RBAContentValueMaker.hpp
new file mode 100644
index 0000000..8f14c95
--- /dev/null
+++ b/src/core/expression/RBAContentValueMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAContentValueMaker.hpp
+/// @brief ContentValue object maker calss header file
+
+#ifndef RBACONTENTVALUEMAKER_HPP
+#define RBACONTENTVALUEMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ContentValue object generation class
+class RBAContentValueMaker : public RBAOperatorMaker
+{
+public:
+ RBAContentValueMaker();
+ RBAContentValueMaker(const RBAContentValueMaker&)=delete;
+ RBAContentValueMaker(const RBAContentValueMaker&&)=delete;
+ RBAContentValueMaker& operator=(const RBAContentValueMaker&)=delete;
+ RBAContentValueMaker& operator=(const RBAContentValueMaker&&)=delete;
+ virtual ~RBAContentValueMaker()=default;
+
+protected:
+ /// @brief Create empty instance
+ /// @details Create an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAExecuteResult.hpp b/src/core/expression/RBAExecuteResult.hpp
new file mode 100644
index 0000000..1eaf2a5
--- /dev/null
+++ b/src/core/expression/RBAExecuteResult.hpp
@@ -0,0 +1,40 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A type that withdraws requests when arbitration loses
+ */
+
+#ifndef RBAEXECUTERESULT_HPP
+#define RBAEXECUTERESULT_HPP
+
+namespace rba
+{
+
+enum class RBAExecuteResult : std::uint8_t
+{
+ TRUE,
+ FALSE,
+ EXE, // In case of action is performed by doAction()
+ // (Excludes SetOfAction and IfAction)
+ NOTEXE, // In case of action is NOT performed by doAction()
+ // (Excludes SetOfAction and IfAction)
+ SKIP // In case of getValue() or getReferenceObject()
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAExistsOperator.cpp b/src/core/expression/RBAExistsOperator.cpp
new file mode 100644
index 0000000..8bb8f05
--- /dev/null
+++ b/src/core/expression/RBAExistsOperator.cpp
@@ -0,0 +1,175 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Exists operator Class definition
+ */
+
+#include "RBAExistsOperator.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAContent.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALambdaExpression.hpp"
+#include "RBALogManager.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAExistsOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAExistsOperator::getModelElementType() const
+{
+ return RBAModelElementType::ExistsOperator;
+}
+
+bool
+RBAExistsOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator * arb) const
+{
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+
+ const RBAExpression* const setObj {getLhsOperand()};
+ RBALambdaExpression* const lambda {getLambda()};
+
+ // Get rule object and loop
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+
+ std::vector<const RBARuleObject*> objs;
+
+ const RBARuleObject* const ruleObj {setObj->getReferenceObject(leftInfo, arb)};
+ const RBARuleObject* objset {nullptr};
+ if (ruleObj != nullptr) {
+ objset = ruleObj->getRawObject();
+ }
+
+ if (leftInfo->isExceptionBeforeArbitrate() || (objset == nullptr)) {
+ // Remove itself form the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ info->setExceptionBeforeArbitrate(true);
+ return false;
+ }
+
+ if (dynamic_cast<const RBAAllocatableSet*>(objset) != nullptr) {
+ objs.clear();
+ for(const RBAAllocatable* alloc
+ : dynamic_cast<const RBAAllocatableSet*>(objset)->getLeafAllocatable() ) {
+ objs.push_back(alloc);
+ }
+ }
+ else {
+ objs.clear();
+ for(const auto& cont : dynamic_cast<const RBAContentSet*>(objset)->getLeafContent() ){
+ objs.push_back(cont);
+ }
+ }
+
+ bool isTrue {false};
+ std::uint32_t i {0U};
+ for(const RBARuleObject* const obj : objs) {
+ // Add count to the constraint hierarchy for coverage
+ LOG_addHierarchy("#" + std::to_string(i));
+
+ RBAConstraintInfo* const childInfo {info->getChild(i)};
+ lambda->setRuleObj(obj);
+
+ const bool res {lambda->execute(childInfo, arb)};
+
+ // Remove count from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ if(childInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ isTrue = (isTrue || res);
+ }
+ i++;
+ }
+
+ if (isTrue == true) {
+ // Succeed
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ info->setExceptionBeforeArbitrate(false);
+ return true;
+ } else if (info->isExceptionBeforeArbitrate()) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return false;
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return false;
+ }
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAExistsOperator::getSymbol() const
+{
+ return "Exists";
+}
+
+const std::string
+RBAExistsOperator::getExpressionText() const
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ return getSymbol() + " "
+ + exprLhs->getExpressionText() + " "
+ + getLambda()->getExpressionText();
+}
+
+const std::string
+RBAExistsOperator::getCoverageExpressionText() const
+{
+ getLambda()->clearRuleObj();
+ RBAExpression* exprLhs = getLhsOperand();
+ return getSymbol() + " " +
+ exprLhs->getCoverageExpressionText() + " "
+ + getLambda()->getCoverageExpressionText();
+}
+
+RBAExpressionType
+RBAExistsOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAExistsOperator.hpp b/src/core/expression/RBAExistsOperator.hpp
new file mode 100644
index 0000000..e75af32
--- /dev/null
+++ b/src/core/expression/RBAExistsOperator.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Exists operator Class header file
+ */
+
+#ifndef RBAEXISTSOPERATOR_HPP
+#define RBAEXISTSOPERATOR_HPP
+
+#include "RBALambdaContext.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAExistsOperator : public RBALambdaContext
+{
+public:
+ RBAExistsOperator()=default;
+ RBAExistsOperator(const RBAExistsOperator&)=delete;
+ RBAExistsOperator(const RBAExistsOperator&&)=delete;
+ RBAExistsOperator& operator=(const RBAExistsOperator&)=delete;
+ RBAExistsOperator& operator=(const RBAExistsOperator&&)=delete;
+ virtual ~RBAExistsOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAExistsOperatorMaker.cpp b/src/core/expression/RBAExistsOperatorMaker.cpp
new file mode 100644
index 0000000..eb8250a
--- /dev/null
+++ b/src/core/expression/RBAExistsOperatorMaker.cpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAExistsOperatorMaker.cpp
+/// @brief Exists Operator object maker Class definition
+
+#include "RBAExistsOperatorMaker.hpp"
+#include "RBAExistsOperator.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBAExistsOperatorMaker::RBAExistsOperatorMaker()
+ : RBALambdaContextMaker{"ExistsOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAExistsOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAExistsOperator>();
+}
+
+RBAModelElement*
+RBAExistsOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(
+ RBALambdaContextMaker::setProperty(element, jsonElem, model, owner));
+
+ return element;
+}
+
+std::unique_ptr<RBALambdaContext>
+RBAExistsOperatorMaker::createLambdaContext()
+{
+ return std::make_unique<RBAExistsOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAExistsOperatorMaker.hpp b/src/core/expression/RBAExistsOperatorMaker.hpp
new file mode 100644
index 0000000..c88f610
--- /dev/null
+++ b/src/core/expression/RBAExistsOperatorMaker.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAExistsOperatorMaker.hpp
+/// @brief ExistsOperator object maker Class header
+
+#ifndef RBAEXISTSOPERATORMAKER_HPP
+#define RBAEXISTSOPERATORMAKER_HPP
+
+#include "RBALambdaContextMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ExistsOperator object maker Class
+class RBAExistsOperatorMaker : public RBALambdaContextMaker
+{
+public:
+ RBAExistsOperatorMaker();
+ RBAExistsOperatorMaker(const RBAExistsOperatorMaker&)=delete;
+ RBAExistsOperatorMaker(const RBAExistsOperatorMaker&&)=delete;
+ RBAExistsOperatorMaker& operator=(const RBAExistsOperatorMaker&)=delete;
+ RBAExistsOperatorMaker& operator=(const RBAExistsOperatorMaker&&)=delete;
+ virtual ~RBAExistsOperatorMaker()=default;
+
+protected:
+ /// @brief Create empty instance
+ /// @details Create an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set attributes of model element for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model Model for storing created object
+ /// @param[in,out] owner parent object(Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+ /// @brief Crate empty object of LambdaContext
+ /// @details Create empty object of unique_ptr
+ /// @return unique_ptr for LambdaContext object
+ std::unique_ptr<RBALambdaContext> createLambdaContext() override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAExpression.cpp b/src/core/expression/RBAExpression.cpp
new file mode 100644
index 0000000..2b9b6fc
--- /dev/null
+++ b/src/core/expression/RBAExpression.cpp
@@ -0,0 +1,156 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Expression class definition
+ */
+
+#include "RBAExpression.hpp"
+
+#include "RBALetStatement.hpp"
+#include "RBAConstraintInfo.hpp"
+#ifdef RBA_USE_LOG
+#include "RBAExpressionType.hpp"
+#endif
+
+namespace rba
+{
+
+void RBAExpression::addLetStatement(RBALetStatement* const letStatement)
+{
+ letStatements_.push_back(letStatement);
+}
+
+void
+RBAExpression::accept(RBAExpressionVisitor& visitor)
+{
+ // Not be called because the function of the derived class is called
+}
+
+bool
+RBAExpression::execute(RBAConstraintInfo* const info, RBAArbitrator * const arb) const
+{
+ info->setExpression(this);
+ for (RBALetStatement* const& letStatement : letStatements_) {
+ letStatement->setVariable(arb);
+ }
+ const bool result {executeCore(info, arb)};
+ if (result) {
+ info->setResult(RBAExecuteResult::TRUE);
+ } else {
+ info->setResult(RBAExecuteResult::FALSE);
+ }
+ return result;
+}
+
+bool
+RBAExpression::executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const
+{
+ // This function is called when an Expression that does not define
+ // getReferenceObject() in evaluate() is specified.
+ info->setExceptionBeforeArbitrate(true);
+ return false;
+}
+
+const RBARuleObject*
+RBAExpression::getReferenceObject(RBAConstraintInfo* const info,
+ RBAArbitrator* const arb) const
+{
+ info->setExpression(this);
+ for (RBALetStatement* const& letStatement : letStatements_) {
+ letStatement->setVariable(arb);
+ }
+ return getReferenceObjectCore(info, arb);
+}
+
+const RBARuleObject*
+RBAExpression::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ // This function is called when an Expression that does not define
+ // getReferenceObject() in evaluateObject() is specified.
+ return nullptr;
+}
+
+std::int32_t
+RBAExpression::getValue(RBAConstraintInfo* const info, RBAArbitrator * const arb) const
+{
+ info->setExpression(this);
+ for (RBALetStatement* const& letStatement : letStatements_) {
+ letStatement->setVariable(arb);
+ }
+ return getValueCore(info, arb);
+}
+
+const std::vector<RBALetStatement*>&
+RBAExpression::getLetStatements() const
+{
+ return letStatements_;
+}
+std::int32_t
+RBAExpression::getValueCore(RBAConstraintInfo* info, RBAArbitrator * arb) const
+{
+ // This function is called when an Expression that does not define
+ // getValue() in evaluateValue() is specified.
+ return -99;
+}
+
+void
+RBAExpression::doAction(RBAConstraintInfo* const info, RBAArbitrator* const arb)
+{
+ info->setExpression(this);
+ doActionCore(info, arb);
+ return;
+}
+
+void
+RBAExpression::doActionCore(RBAConstraintInfo* info, RBAArbitrator* arb)
+{
+ // This function is called when an Expression that does not define
+ // doAction() in evaluateDoAction() is specified.
+ return;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAExpression::getExpressionText() const
+{
+ // Not called because the function of the derived class is called
+ return "Unsupported operation exception";
+}
+
+const std::string
+RBAExpression::getCoverageExpressionText() const
+{
+ // Not called because the function of the derived class is called
+ return "Unsupported operation exception";
+}
+
+void
+RBAExpression::createHierarchy()
+{
+ // Not called because the function of the derived class is called
+}
+
+RBAExpressionType
+RBAExpression::getUnderlyingType() const
+{
+ // Not called because the function of the derived class is called
+ return RBAExpressionType::EXCEPTION;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAExpression.hpp b/src/core/expression/RBAExpression.hpp
new file mode 100644
index 0000000..9cd14e5
--- /dev/null
+++ b/src/core/expression/RBAExpression.hpp
@@ -0,0 +1,91 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Expression class header file
+ */
+
+#ifndef RBAEXPRESSION_HPP
+#define RBAEXPRESSION_HPP
+
+#include <cstdint>
+#include <string>
+#include <vector>
+#include "RBAModelElement.hpp"
+
+namespace rba
+{
+
+class RBAExpressionVisitor;
+class RBALetStatement;
+class RBAArbitrator;
+class RBARuleObject;
+class RBAConstraintInfo;
+#ifdef RBA_USE_LOG
+enum class RBAExpressionType : std::uint8_t;
+#endif
+
+class DLL_EXPORT RBAExpression : public RBAModelElement
+{
+protected:
+ RBAExpression()=default;
+ RBAExpression(const RBAExpression&)=delete;
+ RBAExpression(const RBAExpression&&)=delete;
+ RBAExpression& operator=(const RBAExpression&)=delete;
+ RBAExpression& operator=(const RBAExpression&&)=delete;
+
+public:
+ virtual ~RBAExpression()=default;
+ void addLetStatement(RBALetStatement* const letStatement);
+ virtual void accept(RBAExpressionVisitor& visitor);
+ bool execute(RBAConstraintInfo* const info, RBAArbitrator* const arb) const;
+ const RBARuleObject* getReferenceObject(RBAConstraintInfo* const info,
+ RBAArbitrator* const arb) const;
+ std::int32_t getValue(RBAConstraintInfo* const info, RBAArbitrator* const arb) const;
+ void doAction(RBAConstraintInfo* const info, RBAArbitrator* const arb);
+ const std::vector<RBALetStatement*>& getLetStatements() const;
+
+ // Log
+#ifdef RBA_USE_LOG
+ virtual const std::string getExpressionText() const;
+ virtual const std::string getCoverageExpressionText() const;
+ virtual void createHierarchy();
+ virtual RBAExpressionType getUnderlyingType() const;
+#endif
+
+protected:
+ virtual bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const;
+ virtual const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const;
+ virtual std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const;
+ virtual void doActionCore(RBAConstraintInfo* info, RBAArbitrator* arb);
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::vector<RBALetStatement*> letStatements_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAExpressionMaker.cpp b/src/core/expression/RBAExpressionMaker.cpp
new file mode 100644
index 0000000..250ace0
--- /dev/null
+++ b/src/core/expression/RBAExpressionMaker.cpp
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAExpreessionMaker.cpp
+/// @brief Abstract class definition file for expression object generation
+
+#include "RBAExpressionMaker.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBALetStatementMaker.hpp"
+#include "RBALetStatement.hpp"
+
+namespace rba
+{
+
+RBAExpressionMaker::RBAExpressionMaker(const std::string& label)
+ : RBAModelElementMaker{label}
+{
+}
+
+std::int32_t
+RBAExpressionMaker::setLetStatement(RBAModelImpl* const model,
+ RBAExpression* const expr,
+ const RBAJsonElement* const jsonElem)
+{
+ std::int32_t var_num {0};
+ const RBAJsonElement* const letElem {jsonElem->findChildren("letStatements")};
+ if(letElem != nullptr) {
+ RBALetStatementMaker letMaker;
+ letMaker.setFactory(getFactory());
+ for(const auto& param : letElem->getChildren()) {
+ // execute pushVariable() in letMaker::create()
+ RBALetStatement* const letExpr
+ {dynamic_cast<RBALetStatement*>(letMaker.create(param.get(), model))};
+ expr->addLetStatement(letExpr);
+ var_num += 1;
+ }
+ }
+
+ return var_num;
+}
+
+}
diff --git a/src/core/expression/RBAExpressionMaker.hpp b/src/core/expression/RBAExpressionMaker.hpp
new file mode 100644
index 0000000..282a093
--- /dev/null
+++ b/src/core/expression/RBAExpressionMaker.hpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAExpreessionMaker.hpp
+/// @brief Abstract class definition header file for expression object generation
+
+#ifndef RBAEXPRESSIONMAKER_HPP
+#define RBAEXPRESSIONMAKER_HPP
+
+#include <cstdint>
+#include "RBAModelElementMaker.hpp"
+
+namespace rba
+{
+
+class RBAExpression;
+
+/// @brief Abstract class for expression object gcreation
+class DLL_EXPORT RBAExpressionMaker : public RBAModelElementMaker
+{
+public:
+ explicit RBAExpressionMaker(const std::string& label="");
+ RBAExpressionMaker(const RBAExpressionMaker&)=delete;
+ RBAExpressionMaker(const RBAExpressionMaker&&)=delete;
+ RBAExpressionMaker& operator=(const RBAExpressionMaker&)=delete;
+ RBAExpressionMaker& operator=(const RBAExpressionMaker&&)=delete;
+ virtual ~RBAExpressionMaker()=default;
+
+protected:
+ /// @brief To set ”Let" expression
+ /// @details Generate Let expression from jsonElem and register it in expr.
+ /// Return the number of variables that have been registered
+ /// (pushed) to ModelFactory, and pop them when the reference of
+ /// variables is completed in function that called this function.
+ /// @return the number of pushed variables
+ std::int32_t setLetStatement(RBAModelImpl* model,
+ RBAExpression* expr,
+ const RBAJsonElement* jsonElem);
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAExpressionType.hpp b/src/core/expression/RBAExpressionType.hpp
new file mode 100644
index 0000000..6b6fcd8
--- /dev/null
+++ b/src/core/expression/RBAExpressionType.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Expression type enumeration class header file
+ */
+
+#ifndef RBAEXPRESSIONTYPE_HPP
+#define RBAEXPRESSIONTYPE_HPP
+
+#ifdef RBA_USE_LOG
+
+#include <cstdint>
+
+namespace rba
+{
+
+enum class RBAExpressionType : std::uint8_t
+{
+ VALUE = 0,
+ BOOLEAN,
+ AREA,
+ CONTENT,
+ SET_OF_AREA,
+ SET_OF_CONTENT,
+ LAMBDA,
+ SCENE,
+ ZONE,
+ SET_OF_ZONE,
+ SOUND,
+ SET_OF_SOUND,
+ ACTION,
+ SET_OF_ACTION,
+ PROPERTY,
+ EXTENSION,
+ CONTENT_STATE,
+ EXCEPTION
+};
+
+}
+
+#endif
+#endif
diff --git a/src/core/expression/RBAExpressionVisitor.hpp b/src/core/expression/RBAExpressionVisitor.hpp
new file mode 100644
index 0000000..e678b42
--- /dev/null
+++ b/src/core/expression/RBAExpressionVisitor.hpp
@@ -0,0 +1,168 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Expression visitor class header file
+ */
+
+#ifndef RBAEXPRESSIONVISITOR_HPP
+#define RBAEXPRESSIONVISITOR_HPP
+
+namespace rba {
+class RBAIsDisplayed;
+class RBADisplayingContent;
+class RBAAllocatedContent;
+class RBAIsHidden;
+class RBAContentValue;
+class RBAGetContentsList;
+class RBAIsActive;
+class RBAIsVisible;
+class RBAStateValue;
+class RBAHasBeenDisplayed;
+class RBAHasComeEarlierThan;
+class RBAHasComeLaterThan;
+class RBAGetAllocatables;
+class RBAIsOutputted;
+class RBAOutputtingSound;
+class RBAIsMuted;
+class RBAIsAttenuated;
+class RBAIsSounding;
+class RBAIsOn;
+class RBAGetProperty;
+class RBAAndOperator;
+class RBAOrOperator;
+class RBANotOperator;
+class RBAImpliesOperator;
+class RBAIsEqualToOperator;
+class RBAObjectCompare;
+class RBAIsGreaterThanOperator;
+class RBAIsGreaterThanEqualOperator;
+class RBAIsLowerThanOperator;
+class RBAIsLowerThanEqualOperator;
+class RBAForAllOperator;
+class RBAExistsOperator;
+class RBAAllInstanceOfArea;
+class RBAAllInstanceOfViewContent;
+class RBAAllInstanceOfZone;
+class RBAAllInstanceOfSoundContent;
+class RBAIfStatement;
+class RBALetStatement;
+class RBAPreviousModifier;
+class RBAActiveState;
+class RBAActiveContents;
+class RBAMaxOperator;
+class RBAMinOperator;
+class RBASelectOperator;
+class RBASizeOperator;
+class RBAObjectReference;
+class RBASetOfOperator;
+class RBAIsTypeOfOperator;
+
+class RBAExpressionVisitor {
+ public:
+ RBAExpressionVisitor()=default;
+ RBAExpressionVisitor(const RBAExpressionVisitor&)=delete;
+ RBAExpressionVisitor(const RBAExpressionVisitor&&)=delete;
+ RBAExpressionVisitor& operator=(const RBAExpressionVisitor&)=delete;
+ RBAExpressionVisitor& operator=(const RBAExpressionVisitor&&)=delete;
+ virtual ~RBAExpressionVisitor() = default;
+
+ // Refer to Area status
+ virtual void visit(RBAIsDisplayed& exp) = 0;
+ virtual void visit(RBADisplayingContent& exp) = 0;
+ virtual void visit(RBAAllocatedContent& exp) = 0;
+ virtual void visit(RBAIsHidden& exp) = 0;
+ virtual void visit(RBAContentValue& exp) = 0;
+ virtual void visit(RBAGetContentsList& exp) = 0;
+ virtual void visit(RBAActiveContents& exp) = 0;
+
+ // Refer to display content status
+ virtual void visit(RBAIsActive& exp) = 0;
+ virtual void visit(RBAIsVisible& exp) = 0;
+ virtual void visit(RBAStateValue& exp) = 0;
+ virtual void visit(RBAHasBeenDisplayed& exp) = 0;
+ virtual void visit(RBAHasComeEarlierThan& exp) = 0;
+ virtual void visit(RBAHasComeLaterThan& exp) = 0;
+ virtual void visit(RBAGetAllocatables& exp) = 0;
+ virtual void visit(RBAActiveState& exp) = 0;
+
+ // Refer to Zone status
+ virtual void visit(RBAIsOutputted& exp) = 0;
+ virtual void visit(RBAOutputtingSound& exp) = 0;
+ // allocatedContent is common with Area
+ virtual void visit(RBAIsMuted& exp) = 0;
+ virtual void visit(RBAIsAttenuated& exp) = 0;
+ // contentValue is common with Area
+ // contentsList is common with Area
+
+ // Refer to sound content status
+ // isActive is common with display content
+ virtual void visit(RBAIsSounding& exp) = 0;
+ // stateValue is common with display content
+ // hasComeEarlierThan is common with display content
+ // hasComeLaterThan is common with display content
+ // allocatables is common with display content
+ // activeState is common with display content
+
+ // Refer to Scene
+ virtual void visit(RBAIsOn& exp) = 0;
+ virtual void visit(RBAGetProperty& exp) = 0;
+
+ virtual void visit(RBAIsTypeOfOperator& exp) = 0;
+
+ // Operators
+ virtual void visit(RBAAndOperator& exp) = 0;
+ virtual void visit(RBAOrOperator& exp) = 0;
+ virtual void visit(RBANotOperator& exp) = 0;
+ virtual void visit(RBAImpliesOperator& exp) = 0;
+ virtual void visit(RBAIsEqualToOperator& exp) = 0;
+ virtual void visit(RBAObjectCompare& exp) = 0;
+ virtual void visit(RBAIsGreaterThanOperator& exp) = 0;
+ virtual void visit(RBAIsGreaterThanEqualOperator& exp) = 0;
+ virtual void visit(RBAIsLowerThanOperator& exp) = 0;
+ virtual void visit(RBAIsLowerThanEqualOperator& exp) = 0;
+
+ // Quantification symbol
+ virtual void visit(RBAForAllOperator& exp) = 0;
+ virtual void visit(RBAExistsOperator& exp) = 0;
+
+ // Built-in definition expression
+ virtual void visit(RBAAllInstanceOfArea& exp) = 0;
+ virtual void visit(RBAAllInstanceOfViewContent& exp) = 0;
+ virtual void visit(RBAAllInstanceOfZone& exp) = 0;
+ virtual void visit(RBAAllInstanceOfSoundContent& exp) = 0;
+
+ // Syntax
+ virtual void visit(RBAIfStatement& exp) = 0;
+ virtual void visit(RBALetStatement& exp) = 0;
+
+ // Modifier
+ virtual void visit(RBAPreviousModifier& exp) = 0;
+
+ // Set operator
+ virtual void visit(RBAMaxOperator& exp) = 0;
+ virtual void visit(RBAMinOperator& exp) = 0;
+ virtual void visit(RBASelectOperator& exp) = 0;
+ virtual void visit(RBASizeOperator& exp) = 0;
+
+ // Object references
+ virtual void visit(RBAObjectReference& exp) = 0;
+ virtual void visit(RBASetOfOperator& exp) = 0;
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAForAllOperator.cpp b/src/core/expression/RBAForAllOperator.cpp
new file mode 100644
index 0000000..93a2894
--- /dev/null
+++ b/src/core/expression/RBAForAllOperator.cpp
@@ -0,0 +1,173 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ForAll operator class
+ */
+
+#include "RBAForAllOperator.hpp"
+
+#include "RBAAllocatable.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALambdaExpression.hpp"
+#include "RBALogManager.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAForAllOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAForAllOperator::getModelElementType() const
+{
+ return RBAModelElementType::ForAllOperator;
+}
+
+bool
+RBAForAllOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator * arb) const
+{
+ const RBAExpression* const setObj {getLhsOperand()};
+ RBALambdaExpression* const lambda {getLambda()};
+
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+
+ // get Rule object and loop
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+
+ std::vector<const RBARuleObject*> objs;
+ const RBARuleObject* const ruleObj {setObj->getReferenceObject(leftInfo, arb)};
+ const RBARuleObject* objset {nullptr};
+ if (ruleObj != nullptr) {
+ objset = ruleObj->getRawObject();
+ }
+
+ if(leftInfo->isExceptionBeforeArbitrate() || (objset == nullptr)) {
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ info->setExceptionBeforeArbitrate(true);
+ return false;
+ }
+ if (dynamic_cast<const RBAAllocatableSet*>(objset) != nullptr) {
+ objs.clear();
+ for(const RBAAllocatable* alloc
+ : dynamic_cast<const RBAAllocatableSet*>(objset)->getLeafAllocatable()) {
+ objs.push_back(alloc);
+ }
+ }
+ else {
+ objs.clear();
+ for(const auto& cont : dynamic_cast<const RBAContentSet*>(objset)->getLeafContent() ){
+ objs.push_back(cont);
+ }
+ }
+
+ bool isTrue {true};
+ std::uint32_t i {0U};
+ for(const RBARuleObject* const obj : objs) {
+ // Add count to the constraint hierarchy for coverage
+ LOG_addHierarchy("#" + std::to_string(i));
+
+ RBAConstraintInfo* const childInfo {info->getChild(i)};
+ lambda->setRuleObj(obj);
+
+ const bool res {lambda->execute(childInfo, arb)};
+
+ // Remove count from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ if(childInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ isTrue = (isTrue && res);
+ }
+ i++;
+ }
+
+ if (isTrue == false) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ // Remove count from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ info->setExceptionBeforeArbitrate(false);
+ return false;
+ } else if (info->isExceptionBeforeArbitrate()) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ // Remove count from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return false;
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ // Remove count from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return true;
+ }
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAForAllOperator::getSymbol() const
+{
+ return "For All";
+}
+
+const std::string
+RBAForAllOperator::getExpressionText() const
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ return getSymbol() + " "
+ + exprLhs->getExpressionText() + " "
+ + getLambda()->getExpressionText();
+}
+
+const std::string
+RBAForAllOperator::getCoverageExpressionText() const
+{
+ getLambda()->clearRuleObj();
+ RBAExpression* exprLhs = getLhsOperand();
+ return getSymbol() + " "
+ + exprLhs->getCoverageExpressionText() + " "
+ + getLambda()->getCoverageExpressionText();
+}
+
+RBAExpressionType
+RBAForAllOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAForAllOperator.hpp b/src/core/expression/RBAForAllOperator.hpp
new file mode 100644
index 0000000..7c0c7cc
--- /dev/null
+++ b/src/core/expression/RBAForAllOperator.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ForAll operator class header file
+ */
+
+#ifndef RBAFORALLOPERATOR_HPP
+#define RBAFORALLOPERATOR_HPP
+
+#include "RBALambdaContext.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAForAllOperator : public RBALambdaContext
+{
+public:
+ RBAForAllOperator()=default;
+ RBAForAllOperator(const RBAForAllOperator&)=delete;
+ RBAForAllOperator(const RBAForAllOperator&&)=delete;
+ RBAForAllOperator& operator=(const RBAForAllOperator&)=delete;
+ RBAForAllOperator& operator=(const RBAForAllOperator&&)=delete;
+ virtual ~RBAForAllOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAForAllOperatorMaker.cpp b/src/core/expression/RBAForAllOperatorMaker.cpp
new file mode 100644
index 0000000..eb1068d
--- /dev/null
+++ b/src/core/expression/RBAForAllOperatorMaker.cpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAForAllOperatorMaker.cpp
+/// @brief ForAllOperator object generation class
+
+#include "RBAForAllOperatorMaker.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAForAllOperator.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBAForAllOperatorMaker::RBAForAllOperatorMaker()
+ : RBALambdaContextMaker{"ForAllOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAForAllOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAForAllOperator>();
+}
+
+RBAModelElement*
+RBAForAllOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(
+ RBALambdaContextMaker::setProperty(element, jsonElem, model, owner));
+
+ return element;
+}
+
+std::unique_ptr<RBALambdaContext>
+RBAForAllOperatorMaker::createLambdaContext()
+{
+ return std::make_unique<RBAForAllOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAForAllOperatorMaker.hpp b/src/core/expression/RBAForAllOperatorMaker.hpp
new file mode 100644
index 0000000..9c5de92
--- /dev/null
+++ b/src/core/expression/RBAForAllOperatorMaker.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAForAllOperatorMaker.hpp
+/// @brief ForAllOperator object generation class header
+
+#ifndef RBAFORALLOPERATORMAKER_HPP
+#define RBAFORALLOPERATORMAKER_HPP
+
+#include "RBALambdaContextMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ForAllOperator object generation class
+class RBAForAllOperatorMaker : public RBALambdaContextMaker
+{
+public:
+ RBAForAllOperatorMaker();
+ RBAForAllOperatorMaker(const RBAForAllOperatorMaker&)=delete;
+ RBAForAllOperatorMaker(const RBAForAllOperatorMaker&&)=delete;
+ RBAForAllOperatorMaker& operator=(const RBAForAllOperatorMaker&)=delete;
+ RBAForAllOperatorMaker& operator=(const RBAForAllOperatorMaker&&)=delete;
+ virtual ~RBAForAllOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in a derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model M\model to store the generated object
+ /// @param[in,out] owner parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+ /// @brief generate an empty object of LambdaContext
+ /// @details generate an empty object of unique_ptr in a derived class
+ /// @return unique_ptr for LambdaContext object
+ std::unique_ptr<RBALambdaContext> createLambdaContext() override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAGetAllocatables.cpp b/src/core/expression/RBAGetAllocatables.cpp
new file mode 100644
index 0000000..8494a01
--- /dev/null
+++ b/src/core/expression/RBAGetAllocatables.cpp
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * GetAllocatables class definition file
+ */
+
+#include "RBAGetAllocatables.hpp"
+
+#include "RBAContent.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAGetAllocatables::accept(RBAExpressionVisitor& visitor)
+{
+ // This path is not used, because RBASceneAllocatableCollector,
+ // the only existing visitor as of now, does not accept content.
+ // But, keep this because another visitor may accept, in the future.
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAGetAllocatables::getModelElementType() const
+{
+ return RBAModelElementType::GetAllocatables;
+}
+
+const RBARuleObject*
+RBAGetAllocatables::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+
+ const RBARuleObject* const ruleObj
+ {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+ const RBAContent* content {nullptr};
+ if (ruleObj != nullptr) {
+ content = dynamic_cast<const RBAContent*>(ruleObj->getRawObject());
+ }
+
+ if (content == nullptr) {
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ return nullptr;
+ }
+
+ return content->getAllocatableSet();
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAGetAllocatables::getSymbol() const
+{
+ return ".allocatables()";
+}
+
+const std::string
+RBAGetAllocatables::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+
+// At the moment, the arbitration FW cannot write a constraint expression
+// to call createHierarchy() of GetAllocatables,
+// so it does not go through this path.
+// But, defined this for maintainability (especially expandability.
+void
+RBAGetAllocatables::createHierarchy()
+{
+ // No operation because it does not affect structure.
+}
+
+#endif
+
+}
diff --git a/src/core/expression/RBAGetAllocatables.hpp b/src/core/expression/RBAGetAllocatables.hpp
new file mode 100644
index 0000000..d1c7167
--- /dev/null
+++ b/src/core/expression/RBAGetAllocatables.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * GetAllocatables class header file
+ */
+
+#ifndef RBAGETALLOCATABLES_HPP
+#define RBAGETALLOCATABLES_HPP
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAGetAllocatables : public RBAContentOperator
+{
+public:
+ RBAGetAllocatables()=default;
+ RBAGetAllocatables(const RBAGetAllocatables&)=delete;
+ RBAGetAllocatables(const RBAGetAllocatables&&)=delete;
+ RBAGetAllocatables& operator=(const RBAGetAllocatables&)=delete;
+ RBAGetAllocatables& operator=(const RBAGetAllocatables&&)=delete;
+ virtual ~RBAGetAllocatables()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ void createHierarchy() override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAGetAllocatablesMaker.cpp b/src/core/expression/RBAGetAllocatablesMaker.cpp
new file mode 100644
index 0000000..aac81a2
--- /dev/null
+++ b/src/core/expression/RBAGetAllocatablesMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAGetAllocatablesMaker.cpp
+/// @brief GetAllocatables object generation class definition
+
+#include "RBAGetAllocatablesMaker.hpp"
+#include "RBAGetAllocatables.hpp"
+
+namespace rba
+{
+
+RBAGetAllocatablesMaker::RBAGetAllocatablesMaker()
+ : RBAOperatorMaker{"GetAllocatables"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAGetAllocatablesMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAGetAllocatables>();
+}
+
+}
diff --git a/src/core/expression/RBAGetAllocatablesMaker.hpp b/src/core/expression/RBAGetAllocatablesMaker.hpp
new file mode 100644
index 0000000..722845f
--- /dev/null
+++ b/src/core/expression/RBAGetAllocatablesMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAGetAllocatablesMaker.hpp
+/// @brief GetAllocatables object generation class header file
+
+#ifndef RBAGETALLOCATABLESMAKER_HPP
+#define RBAGETALLOCATABLESMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief GetAllocatables object gneration class
+class RBAGetAllocatablesMaker : public RBAOperatorMaker
+{
+public:
+ RBAGetAllocatablesMaker();
+ RBAGetAllocatablesMaker(const RBAGetAllocatablesMaker&)=delete;
+ RBAGetAllocatablesMaker(const RBAGetAllocatablesMaker&&)=delete;
+ RBAGetAllocatablesMaker& operator=(const RBAGetAllocatablesMaker&)=delete;
+ RBAGetAllocatablesMaker& operator=(const RBAGetAllocatablesMaker&&)=delete;
+ virtual ~RBAGetAllocatablesMaker()=default;
+
+protected:
+ /// @brief Generate an empty instance
+ /// @details Generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAGetContentsList.cpp b/src/core/expression/RBAGetContentsList.cpp
new file mode 100644
index 0000000..5f14b33
--- /dev/null
+++ b/src/core/expression/RBAGetContentsList.cpp
@@ -0,0 +1,86 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * GetContentsList class definition file
+ */
+
+#include "RBAGetContentsList.hpp"
+
+#include "RBAAllocatable.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void RBAGetContentsList::accept(RBAExpressionVisitor& visitor)
+{
+ // This path is not used, because RBASceneAllocatableCollector,
+ // the only existing visitor as of now, does not accept content.
+ // But, keep this because another visitor may accept, in the future.
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAGetContentsList::getModelElementType() const
+{
+ return RBAModelElementType::GetContentsList;
+}
+
+const RBARuleObject*
+RBAGetContentsList::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+
+ const RBARuleObject* const ruleObj
+ {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+ const RBAAllocatable* allocatable {nullptr};
+ if (ruleObj != nullptr) {
+ allocatable = dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject());
+ }
+ // Indicates whether the content referenced by this constraint expression
+ // is the result of the previous arbitration result.
+
+ if (leftInfo->isExceptionBeforeArbitrate() || (allocatable == nullptr)) {
+ // As of now, this path is not used due to the following reasons.
+ // - The expression below GetContentsList is before arbitration
+ // - Constraint expression that returns null as allocatable
+ // can not be described(specified)
+ // But, defined this for maintainability (especially expandability).
+ info->setExceptionBeforeArbitrate(true);
+ return nullptr;
+ }
+
+ return allocatable->getContentSet();
+}
+
+#ifdef RBA_USE_LOG
+// At the moment, the arbitration FW cannot write a constraint expression
+// to call createHierarchy() of GetContentsList,
+// so it does not go through this path.
+// But, defined this for maintainability (especially expandability.
+void
+RBAGetContentsList::createHierarchy()
+{
+ // No operation because it does not affect structure.
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAGetContentsList.hpp b/src/core/expression/RBAGetContentsList.hpp
new file mode 100644
index 0000000..240a50c
--- /dev/null
+++ b/src/core/expression/RBAGetContentsList.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * GetContentsList class header file
+ */
+
+#ifndef RBAGETCONTENTSLIST_HPP
+#define RBAGETCONTENTSLIST_HPP
+
+#include "RBAAllocatableOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAGetContentsList : public RBAAllocatableOperator
+{
+public:
+ RBAGetContentsList()=default;
+ RBAGetContentsList(const RBAGetContentsList&)=delete;
+ RBAGetContentsList(const RBAGetContentsList&&)=delete;
+ RBAGetContentsList& operator=(const RBAGetContentsList&)=delete;
+ RBAGetContentsList& operator=(const RBAGetContentsList&&)=delete;
+ virtual ~RBAGetContentsList()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ void createHierarchy() override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAGetContentsListMaker.cpp b/src/core/expression/RBAGetContentsListMaker.cpp
new file mode 100644
index 0000000..2081e2d
--- /dev/null
+++ b/src/core/expression/RBAGetContentsListMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAGetContentsListMaker.cpp
+/// @brief GetContentsList object generation class definition file
+
+#include "RBAGetContentsListMaker.hpp"
+#include "RBAGetContentsList.hpp"
+
+namespace rba
+{
+
+RBAGetContentsListMaker::RBAGetContentsListMaker()
+ : RBAOperatorMaker{"GetContentsList"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAGetContentsListMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAGetContentsList>();
+}
+
+}
diff --git a/src/core/expression/RBAGetContentsListMaker.hpp b/src/core/expression/RBAGetContentsListMaker.hpp
new file mode 100644
index 0000000..c703f68
--- /dev/null
+++ b/src/core/expression/RBAGetContentsListMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAGetContentsListMaker.hpp
+/// @brief GetContentsList object generation class header file
+
+#ifndef RBAGETCONTENTSLISTMAKER_HPP
+#define RBAGETCONTENTSLISTMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief GetContentsList object generation class
+class RBAGetContentsListMaker : public RBAOperatorMaker
+{
+public:
+ RBAGetContentsListMaker();
+ RBAGetContentsListMaker(const RBAGetContentsListMaker&)=delete;
+ RBAGetContentsListMaker(const RBAGetContentsListMaker&&)=delete;
+ RBAGetContentsListMaker& operator=(const RBAGetContentsListMaker&)=delete;
+ RBAGetContentsListMaker& operator=(const RBAGetContentsListMaker&&)=delete;
+ virtual ~RBAGetContentsListMaker()=default;
+
+protected:
+ /// @brief Generate an empty instance
+ /// @details Generate an empty class of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAGetProperty.cpp b/src/core/expression/RBAGetProperty.cpp
new file mode 100644
index 0000000..3a774d8
--- /dev/null
+++ b/src/core/expression/RBAGetProperty.cpp
@@ -0,0 +1,101 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAGetProperty class defintino file
+ */
+
+#include "RBAGetProperty.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBALogManager.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAAbstractProperty.hpp"
+
+namespace rba
+{
+
+void
+RBAGetProperty::accept(RBAExpressionVisitor& visitor)
+{
+ // This path is not used, because RBASceneAllocatableCollector,
+ // the only existing visitor as of now, does not accept content.
+ // But, keep this because another visitor may accept, in the future.
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAGetProperty::getModelElementType() const
+{
+ return RBAModelElementType::GetProperty;
+}
+
+std::int32_t
+RBAGetProperty::getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ std::int32_t value{0};
+ const RBAAbstractProperty* prop{nullptr};
+ const RBARuleObject* const ruleObj {getLhsOperand()->getReferenceObject(info, arb)};
+ if(ruleObj->isPrevious()) {
+ prop = dynamic_cast<const RBAAbstractProperty*>(ruleObj->getRawObject());
+ value = arb->getResult()->getPreSceneProperty(prop);
+ }
+ else {
+ prop = dynamic_cast<const RBAAbstractProperty*>(ruleObj);
+ value = arb->getResult()->getSceneProperty(prop);
+ }
+ LOG_arbitrateConstraintLogicLogLine(" "
+ + getPreMsg(ruleObj->isPrevious())
+ + "Property["
+ + prop->getScene()->getElementName()
+ + "::"
+ + prop->getElementName()
+ + "] get["
+ + std::to_string(value)
+ + "]");
+ return value;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAGetProperty::getSymbol() const
+{
+ return ".get()";
+}
+
+const std::string
+RBAGetProperty::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+
+const std::string
+RBAGetProperty::getCoverageExpressionText() const
+{
+ return getExpressionText();
+}
+
+RBAExpressionType
+RBAGetProperty::getUnderlyingType() const
+{
+ return RBAExpressionType::VALUE;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAGetProperty.hpp b/src/core/expression/RBAGetProperty.hpp
new file mode 100644
index 0000000..eff3852
--- /dev/null
+++ b/src/core/expression/RBAGetProperty.hpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAGetProperty Class
+ */
+
+#ifndef RBAGETPROPERTY_HPP
+#define RBAGETPROPERTY_HPP
+
+#include "RBAPropertyOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAGetProperty : public RBAPropertyOperator
+{
+public:
+ RBAGetProperty()=default;
+ RBAGetProperty(const RBAGetProperty&)=delete;
+ RBAGetProperty(const RBAGetProperty&&)=delete;
+ RBAGetProperty& operator=(const RBAGetProperty&)=delete;
+ RBAGetProperty& operator=(const RBAGetProperty&&)=delete;
+ virtual ~RBAGetProperty()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAGetPropertyMaker.cpp b/src/core/expression/RBAGetPropertyMaker.cpp
new file mode 100644
index 0000000..f2588ad
--- /dev/null
+++ b/src/core/expression/RBAGetPropertyMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAGetPropertyMaker.cpp
+/// @brief GetProperty object generation class defintion file
+
+#include "RBAGetPropertyMaker.hpp"
+#include "RBAGetProperty.hpp"
+
+namespace rba
+{
+
+RBAGetPropertyMaker::RBAGetPropertyMaker()
+ : RBAOperatorMaker{"GetProperty"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAGetPropertyMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAGetProperty>();
+}
+
+}
diff --git a/src/core/expression/RBAGetPropertyMaker.hpp b/src/core/expression/RBAGetPropertyMaker.hpp
new file mode 100644
index 0000000..db20ce1
--- /dev/null
+++ b/src/core/expression/RBAGetPropertyMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAGetPropertyMaker.hpp
+/// @brief GetProperty object generation class heeader file
+
+#ifndef RBAGETPROPERTYMAKER_HPP
+#define RBAGETPROPERTYMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief GetProperty object generation class
+class RBAGetPropertyMaker : public RBAOperatorMaker
+{
+public:
+ RBAGetPropertyMaker();
+ RBAGetPropertyMaker(const RBAGetPropertyMaker&)=delete;
+ RBAGetPropertyMaker(const RBAGetPropertyMaker&&)=delete;
+ RBAGetPropertyMaker& operator=(const RBAGetPropertyMaker&)=delete;
+ RBAGetPropertyMaker& operator=(const RBAGetPropertyMaker&&)=delete;
+ virtual ~RBAGetPropertyMaker()=default;
+
+protected:
+ /// @brief Generate an empty instance
+ /// @details Generate an empty class of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAHasBeenDisplayed.cpp b/src/core/expression/RBAHasBeenDisplayed.cpp
new file mode 100644
index 0000000..72c1d40
--- /dev/null
+++ b/src/core/expression/RBAHasBeenDisplayed.cpp
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * .hasBeenDisplayed() definition
+ **/
+
+#include "RBAHasBeenDisplayed.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAContent.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+
+namespace rba
+{
+
+void RBAHasBeenDisplayed::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType RBAHasBeenDisplayed::getModelElementType() const
+{
+ return RBAModelElementType::HasBeenDisplayed;
+}
+
+bool RBAHasBeenDisplayed::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const ruleObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (ruleObj != nullptr) {
+ const RBAContent* const c {
+ dynamic_cast<const RBAContent*>(ruleObj->getRawObject())};
+ if (!ruleObj->isPrevious()) {
+ isPassed = arb->getResult()->hasBeenDisplayed(c);
+ } else {
+ isPassed = arb->getResult()->hasBeenPreDisplayed(c);
+ }
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ RBAExecuteResult r;
+ std::string cname;
+ std::string resultStr;
+ if (ruleObj != nullptr) {
+ cname = ruleObj->getRawObject()->getElementName();
+ } else {
+ cname = "NULL";
+ }
+ if (info->isExceptionBeforeArbitrate()) {
+ resultStr = " before arbitrate skip";
+ r = RBAExecuteResult::SKIP;
+ } else if (isPassed) {
+ resultStr = " true";
+ r = RBAExecuteResult::TRUE;
+ } else {
+ resultStr = " false";
+ r = RBAExecuteResult::FALSE;
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " Content[" + cname + "]" + getSymbol() + resultStr);
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), r);
+#endif
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+// Log
+#ifdef RBA_USE_LOG
+const std::string RBAHasBeenDisplayed::getSymbol() const
+{
+ return ".hasBeenDisplayed()";
+}
+RBAExpressionType RBAHasBeenDisplayed::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+} /* namespace rba */
diff --git a/src/core/expression/RBAHasBeenDisplayed.hpp b/src/core/expression/RBAHasBeenDisplayed.hpp
new file mode 100644
index 0000000..3e3ebde
--- /dev/null
+++ b/src/core/expression/RBAHasBeenDisplayed.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// .hasBeenDisplayed() header file
+//
+
+#ifndef RBAHASBEENDISPLAYED_HPP
+#define RBAHASBEENDISPLAYED_HPP
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAHasBeenDisplayed : public RBAContentOperator
+{
+ public:
+ RBAHasBeenDisplayed()=default;
+ RBAHasBeenDisplayed(const RBAHasBeenDisplayed&)=delete;
+ RBAHasBeenDisplayed(const RBAHasBeenDisplayed&&)=delete;
+ RBAHasBeenDisplayed& operator=(const RBAHasBeenDisplayed&)=delete;
+ RBAHasBeenDisplayed& operator=(const RBAHasBeenDisplayed&&)=delete;
+ virtual ~RBAHasBeenDisplayed()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+};
+
+} /* namespace rba */
+
+#endif /* RBAHASBEENDISPLAYED_HPP */
diff --git a/src/core/expression/RBAHasBeenDisplayedMaker.cpp b/src/core/expression/RBAHasBeenDisplayedMaker.cpp
new file mode 100644
index 0000000..36aeecc
--- /dev/null
+++ b/src/core/expression/RBAHasBeenDisplayedMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAHasBeenDisplayedMaker.cpp
+/// @brief HasBeenDisplayed object generation class defintion file
+
+#include "RBAHasBeenDisplayedMaker.hpp"
+#include "RBAHasBeenDisplayed.hpp"
+
+namespace rba
+{
+
+RBAHasBeenDisplayedMaker::RBAHasBeenDisplayedMaker()
+ : RBAOperatorMaker{"HasBeenDisplayed"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAHasBeenDisplayedMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAHasBeenDisplayed>();
+}
+
+}
diff --git a/src/core/expression/RBAHasBeenDisplayedMaker.hpp b/src/core/expression/RBAHasBeenDisplayedMaker.hpp
new file mode 100644
index 0000000..5e9bc10
--- /dev/null
+++ b/src/core/expression/RBAHasBeenDisplayedMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAHasBeenDisplayedMaker.hpp
+/// @brief HasBeenDisplayed object generation class header file
+
+#ifndef RBAHASBEENDISPLAYEDMAKER_HPP
+#define RBAHASBEENDISPLAYEDMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief HasBeenDisplayed object generation class
+class RBAHasBeenDisplayedMaker : public RBAOperatorMaker
+{
+public:
+ RBAHasBeenDisplayedMaker();
+ RBAHasBeenDisplayedMaker(const RBAHasBeenDisplayedMaker&)=delete;
+ RBAHasBeenDisplayedMaker(const RBAHasBeenDisplayedMaker&&)=delete;
+ RBAHasBeenDisplayedMaker& operator=(const RBAHasBeenDisplayedMaker&)=delete;
+ RBAHasBeenDisplayedMaker& operator=(const RBAHasBeenDisplayedMaker&&)=delete;
+ virtual ~RBAHasBeenDisplayedMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instancce of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAHasComeEarlierThan.cpp b/src/core/expression/RBAHasComeEarlierThan.cpp
new file mode 100644
index 0000000..4b5482a
--- /dev/null
+++ b/src/core/expression/RBAHasComeEarlierThan.cpp
@@ -0,0 +1,151 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * HasComeEarlierThan class
+ */
+
+#include "RBAHasComeEarlierThan.hpp"
+#include "RBAContent.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+RBAModelElementType
+RBAHasComeEarlierThan::getModelElementType() const
+{
+ return RBAModelElementType::HasComeEarlier;
+}
+
+void RBAHasComeEarlierThan::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+bool
+RBAHasComeEarlierThan::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+
+ bool isResult {false};
+ // Get content in left side of the expression
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* ruleObj {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+ const RBAContent* contentLhs {nullptr};
+ if(ruleObj != nullptr) {
+ contentLhs = dynamic_cast<const RBAContent*>(ruleObj->getRawObject());
+ }
+
+ // Get content in right hand side of the expression
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ ruleObj = getRhsOperand()->getReferenceObject(rightInfo, arb);
+ const RBAContent* contentRhs {nullptr};
+ if(ruleObj != nullptr) {
+ contentRhs = dynamic_cast<const RBAContent*>(ruleObj->getRawObject());
+ }
+
+ if((contentLhs == nullptr) || (contentRhs == nullptr)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (!((arb->getResult()->isActive(contentLhs))
+ && (arb->getResult()->isActive(contentRhs)))) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ else if(contentLhs == contentRhs) {
+ isResult = false;
+ }
+ else {
+ isResult = !arb->getResult()->isLater(contentLhs, contentRhs);
+ }
+ }
+#ifdef RBA_USE_LOG
+ std::string lhsName;
+ std::string rhsName;
+ std::string resultText;
+ if(contentLhs == nullptr) {
+ lhsName = "NULL";
+ } else {
+ lhsName = contentLhs->getElementName();
+ }
+ if (contentRhs == nullptr) {
+ rhsName = "NULL";
+ } else {
+ rhsName = contentRhs->getElementName();
+ }
+ if (info->isExceptionBeforeArbitrate() == true ) {
+ resultText = "is before arbitrate skip";
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else {
+ resultText = RBALogManager::boolToString(isResult);
+ if(isResult) {
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ }
+ else {
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " Content[" + lhsName + "] has come earlier than Content[" + rhsName + "] " + resultText);
+#endif
+ // Remove itself from constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isResult;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAHasComeEarlierThan::getSymbol() const
+{
+ return ".hasComeEarlierThan";
+}
+
+const std::string
+RBAHasComeEarlierThan::getExpressionText() const
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ RBAExpression* exprRhs = getRhsOperand();
+ return exprLhs->getExpressionText() + getSymbol()
+ + "(" + exprRhs->getExpressionText() + ")";
+}
+
+const std::string
+RBAHasComeEarlierThan::getCoverageExpressionText() const
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ RBAExpression* exprRhs = getRhsOperand();
+ return exprLhs->getCoverageExpressionText() + getSymbol()
+ + "(" + exprRhs->getCoverageExpressionText() + ")";
+}
+
+RBAExpressionType
+RBAHasComeEarlierThan::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAHasComeEarlierThan.hpp b/src/core/expression/RBAHasComeEarlierThan.hpp
new file mode 100644
index 0000000..fd39782
--- /dev/null
+++ b/src/core/expression/RBAHasComeEarlierThan.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * HasComeEarlierThan class header file
+ */
+
+#ifndef RBAHASCOMEEARLIERTHAN_HPP
+#define RBAHASCOMEEARLIERTHAN_HPP
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAHasComeEarlierThan : public RBAContentOperator
+{
+public:
+ RBAHasComeEarlierThan()=default;
+ RBAHasComeEarlierThan(const RBAHasComeEarlierThan&)=delete;
+ RBAHasComeEarlierThan(const RBAHasComeEarlierThan&&)=delete;
+ RBAHasComeEarlierThan& operator=(const RBAHasComeEarlierThan&)=delete;
+ RBAHasComeEarlierThan& operator=(const RBAHasComeEarlierThan&&)=delete;
+ virtual ~RBAHasComeEarlierThan()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAHasComeEarlierThanMaker.cpp b/src/core/expression/RBAHasComeEarlierThanMaker.cpp
new file mode 100644
index 0000000..fb5eb08
--- /dev/null
+++ b/src/core/expression/RBAHasComeEarlierThanMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAHasComeEarlierThanMaker.cpp
+/// @brief HasComeEarlierThan object generation class definition file
+
+#include "RBAHasComeEarlierThanMaker.hpp"
+#include "RBAHasComeEarlierThan.hpp"
+
+namespace rba
+{
+
+RBAHasComeEarlierThanMaker::RBAHasComeEarlierThanMaker()
+ : RBAOperatorMaker{"HasComeEarlierThan"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAHasComeEarlierThanMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAHasComeEarlierThan>();
+}
+
+}
diff --git a/src/core/expression/RBAHasComeEarlierThanMaker.hpp b/src/core/expression/RBAHasComeEarlierThanMaker.hpp
new file mode 100644
index 0000000..256a4ea
--- /dev/null
+++ b/src/core/expression/RBAHasComeEarlierThanMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAHasComeEarlierThanMaker.hpp
+/// @brief HasComeEarlierThan object generation class header
+
+#ifndef RBAHASCOMEEARLIERTHANMAKER_HPP
+#define RBAHASCOMEEARLIERTHANMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief HasComeEarlierThan object generation class
+class RBAHasComeEarlierThanMaker : public RBAOperatorMaker
+{
+public:
+ RBAHasComeEarlierThanMaker();
+ RBAHasComeEarlierThanMaker(const RBAHasComeEarlierThanMaker&)=delete;
+ RBAHasComeEarlierThanMaker(const RBAHasComeEarlierThanMaker&&)=delete;
+ RBAHasComeEarlierThanMaker& operator=(const RBAHasComeEarlierThanMaker&)=delete;
+ RBAHasComeEarlierThanMaker& operator=(const RBAHasComeEarlierThanMaker&&)=delete;
+ virtual ~RBAHasComeEarlierThanMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAHasComeLaterThan.cpp b/src/core/expression/RBAHasComeLaterThan.cpp
new file mode 100644
index 0000000..341d164
--- /dev/null
+++ b/src/core/expression/RBAHasComeLaterThan.cpp
@@ -0,0 +1,153 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * HasComeLaterThan class
+ */
+
+#include "RBAHasComeLaterThan.hpp"
+
+#include "RBAContent.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void RBAHasComeLaterThan::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAHasComeLaterThan::getModelElementType() const
+{
+ return RBAModelElementType::HasComeLater;
+}
+
+bool
+RBAHasComeLaterThan::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+
+ bool isResult {false};
+ // pop the Content of left hand side expresion
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* ruleObj {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+ const RBAContent* contentLhs {nullptr};
+ if(ruleObj != nullptr) {
+ contentLhs = dynamic_cast<const RBAContent*>(ruleObj->getRawObject());
+ }
+
+ // pop the Content of left hand side expresion
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ ruleObj = getRhsOperand()->getReferenceObject(rightInfo, arb);
+ const RBAContent* contentRhs {nullptr};
+ if(ruleObj != nullptr) {
+ contentRhs = dynamic_cast<const RBAContent*>(ruleObj->getRawObject());
+ }
+
+ if((contentLhs == nullptr) || (contentRhs == nullptr)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (!((arb->getResult()->isActive(contentLhs))
+ && (arb->getResult()->isActive(contentRhs)))) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ else if(contentLhs == contentRhs) {
+ isResult = false;
+ }
+ else {
+ isResult = arb->getResult()->isLater(contentLhs, contentRhs);
+ }
+ }
+#ifdef RBA_USE_LOG
+ std::string lhsName;
+ std::string rhsName;
+ std::string resultText;
+ if(contentLhs == nullptr) {
+ lhsName = "NULL";
+ } else {
+ lhsName = contentLhs->getElementName();
+ }
+ if (contentRhs == nullptr) {
+ rhsName = "NULL";
+ } else {
+ rhsName = contentRhs->getElementName();
+ }
+ if (info->isExceptionBeforeArbitrate() == true ) {
+ resultText = "is before arbitrate skip";
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else {
+ resultText = RBALogManager::boolToString(isResult);
+ if(isResult) {
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ }
+ else {
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " Content[" + lhsName + "] has come later than Content[" + rhsName + "] " + resultText);
+#endif
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ return isResult;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAHasComeLaterThan::getSymbol() const
+{
+ return ".hasComeLaterThan";
+}
+
+const std::string
+RBAHasComeLaterThan::getExpressionText() const
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ RBAExpression* exprRhs = getRhsOperand();
+ return exprLhs->getExpressionText() + getSymbol()
+ + "(" + exprRhs->getExpressionText() + ")";
+}
+
+const std::string
+RBAHasComeLaterThan::getCoverageExpressionText() const
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ RBAExpression* exprRhs = getRhsOperand();
+ return exprLhs->getCoverageExpressionText() + getSymbol()
+ + "(" + exprRhs->getCoverageExpressionText() + ")";
+}
+
+RBAExpressionType
+RBAHasComeLaterThan::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAHasComeLaterThan.hpp b/src/core/expression/RBAHasComeLaterThan.hpp
new file mode 100644
index 0000000..659068f
--- /dev/null
+++ b/src/core/expression/RBAHasComeLaterThan.hpp
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * HasComeLaterThan class
+ */
+
+#ifndef RBAHASCOMELATERTHAN_HPP
+#define RBAHASCOMELATERTHAN_HPP
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAHasComeLaterThan : public RBAContentOperator
+{
+public:
+ RBAHasComeLaterThan()=default;
+ RBAHasComeLaterThan(const RBAHasComeLaterThan&)=delete;
+ RBAHasComeLaterThan(const RBAHasComeLaterThan&&)=delete;
+ RBAHasComeLaterThan& operator=(const RBAHasComeLaterThan&)=delete;
+ RBAHasComeLaterThan& operator=(const RBAHasComeLaterThan&&)=delete;
+ virtual ~RBAHasComeLaterThan()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAHasComeLaterThanMaker.cpp b/src/core/expression/RBAHasComeLaterThanMaker.cpp
new file mode 100644
index 0000000..2b49835
--- /dev/null
+++ b/src/core/expression/RBAHasComeLaterThanMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAHasComeLaterThanMaker.cpp
+/// @brief HasComeLaterThan object generation class definitino file
+
+#include "RBAHasComeLaterThanMaker.hpp"
+#include "RBAHasComeLaterThan.hpp"
+
+namespace rba
+{
+
+RBAHasComeLaterThanMaker::RBAHasComeLaterThanMaker()
+ : RBAOperatorMaker{"HasComeLaterThan"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAHasComeLaterThanMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAHasComeLaterThan>();
+}
+
+}
diff --git a/src/core/expression/RBAHasComeLaterThanMaker.hpp b/src/core/expression/RBAHasComeLaterThanMaker.hpp
new file mode 100644
index 0000000..16a42c3
--- /dev/null
+++ b/src/core/expression/RBAHasComeLaterThanMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAHasComeLaterThanMaker.hpp
+/// @brief HasComeLaterThan object generation class header file
+
+#ifndef RBAHASCOMELATERTHANMAKER_HPP
+#define RBAHASCOMELATERTHANMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief HasComeLaterThan object generation class
+class RBAHasComeLaterThanMaker : public RBAOperatorMaker
+{
+public:
+ RBAHasComeLaterThanMaker();
+ RBAHasComeLaterThanMaker(const RBAHasComeLaterThanMaker&)=delete;
+ RBAHasComeLaterThanMaker(const RBAHasComeLaterThanMaker&&)=delete;
+ RBAHasComeLaterThanMaker& operator=(const RBAHasComeLaterThanMaker&)=delete;
+ RBAHasComeLaterThanMaker& operator=(const RBAHasComeLaterThanMaker&&)=delete;
+ virtual ~RBAHasComeLaterThanMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIfStatement.cpp b/src/core/expression/RBAIfStatement.cpp
new file mode 100644
index 0000000..d776bf7
--- /dev/null
+++ b/src/core/expression/RBAIfStatement.cpp
@@ -0,0 +1,268 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * If statement class defintion file
+ */
+
+#include <sstream>
+#include "RBAIfStatement.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAIfStatement::setCondition(RBAExpression* const expr)
+{
+ condition_ = expr;
+}
+
+void
+RBAIfStatement::setThenExpression(RBAExpression* const expr)
+{
+ thenExpression_ = expr;
+}
+
+void
+RBAIfStatement::setElseExpression(RBAExpression* const expr)
+{
+ elseExpression_ = expr;
+}
+
+RBAExpression* const
+RBAIfStatement::getCondition() const
+{
+ return condition_;
+}
+
+RBAExpression* const
+RBAIfStatement::getThenExpression() const
+{
+ return thenExpression_;
+}
+
+RBAExpression* const
+RBAIfStatement::getElseExpression() const
+{
+ return elseExpression_;
+}
+
+void
+RBAIfStatement::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIfStatement::getModelElementType() const
+{
+ return RBAModelElementType::IfStatement;
+}
+
+bool
+RBAIfStatement::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ LOG_addHierarchy("IF");
+ bool isPassed;
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ LOG_addHierarchy("#condition:");
+ const bool cond {getCondition()->execute(leftInfo, arb)};
+ LOG_removeHierarchy();
+ if (cond == true) {
+ LOG_addHierarchy("#then:");
+ isPassed = getThenExpression()->execute(rightInfo, arb);
+ LOG_removeHierarchy();
+ } else {
+ LOG_addHierarchy("#else:");
+ isPassed = getElseExpression()->execute(rightInfo, arb);
+ LOG_removeHierarchy();
+ }
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)) {
+ info->setExceptionBeforeArbitrate(true);
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+#ifdef RBA_USE_LOG
+ } else if (isPassed == true) {
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+#endif
+ }
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+const RBARuleObject*
+RBAIfStatement::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ LOG_addHierarchy("IF");
+ const RBARuleObject* object {nullptr};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ LOG_addHierarchy("#condition:");
+ const bool cond {getCondition()->execute(leftInfo, arb)};
+ LOG_removeHierarchy();
+ if (cond == true) {
+ LOG_addHierarchy("#then:");
+ object = getThenExpression()->getReferenceObject(rightInfo, arb);
+ LOG_removeHierarchy();
+ } else {
+ LOG_addHierarchy("#else:");
+ object = getElseExpression()->getReferenceObject(rightInfo, arb);
+ LOG_removeHierarchy();
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ }
+ LOG_removeHierarchy();
+ return object;
+}
+
+std::int32_t
+RBAIfStatement::getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ LOG_addHierarchy("IF");
+ std::int32_t value;
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ LOG_addHierarchy("#condition:");
+ const bool cond {getCondition()->execute(leftInfo, arb)};
+ LOG_removeHierarchy();
+ if (cond == true) {
+ LOG_addHierarchy("#then:");
+ value = getThenExpression()->getValue(rightInfo, arb);
+ LOG_removeHierarchy();
+ } else {
+ LOG_addHierarchy("#else:");
+ value = getElseExpression()->getValue(rightInfo, arb);
+ LOG_removeHierarchy();
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ }
+ LOG_removeHierarchy();
+ return value;
+}
+
+void
+RBAIfStatement::doActionCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb)
+{
+ LOG_addHierarchy("IF");
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ LOG_addHierarchy("#condition:");
+ const bool cond {getCondition()->execute(leftInfo, arb)};
+ LOG_removeHierarchy();
+ if (cond == true) {
+ LOG_addHierarchy("#then:");
+ getThenExpression()->doAction(rightInfo, arb);
+ LOG_removeHierarchy();
+ } else {
+ LOG_addHierarchy("#else:");
+ getElseExpression()->doAction(rightInfo, arb);
+ LOG_removeHierarchy();
+ }
+#ifdef RBA_USE_LOG
+ LOG_coverageConstraintExpressionLog2(LOG_getCoverageExpressionText());
+#endif
+ LOG_removeHierarchy();
+ return;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIfStatement::getExpressionText() const
+{
+ std::ostringstream oss;
+ oss << "IF(";
+ oss << condition_->getExpressionText();
+ oss << ") THEN ";
+ oss << thenExpression_->getExpressionText();
+ oss << " ELSE ";
+ oss << elseExpression_->getExpressionText();
+
+ return oss.str();
+}
+
+const std::string
+RBAIfStatement::getCoverageExpressionText() const
+{
+ std::ostringstream oss;
+ oss << "IF(";
+ oss << condition_->getCoverageExpressionText();
+ oss << ") THEN ";
+ oss << thenExpression_->getCoverageExpressionText();
+ oss << " ELSE ";
+ oss << elseExpression_->getCoverageExpressionText();
+
+ return oss.str();
+}
+
+void
+RBAIfStatement::createHierarchy()
+{
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy("IF");
+ RBALogManager::coverageHierarchyOfConstraintExpressionLog(getCoverageExpressionText(),
+ this);
+
+ // Add condition to the constraint hierarchy for coverage
+ LOG_addHierarchy("#condition:");
+ condition_->createHierarchy();
+ // Remove condtion from to the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ if(thenExpression_) {
+ // Add "then" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#then:");
+ thenExpression_->createHierarchy();
+ // Remove "then" from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ }
+
+ if(elseExpression_) {
+ // Add "else" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#else:");
+ elseExpression_->createHierarchy();
+ // Remove "else" from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ }
+
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+}
+
+RBAExpressionType
+RBAIfStatement::getUnderlyingType() const
+{
+ return thenExpression_->getUnderlyingType();
+}
+#endif
+}
diff --git a/src/core/expression/RBAIfStatement.hpp b/src/core/expression/RBAIfStatement.hpp
new file mode 100644
index 0000000..7059583
--- /dev/null
+++ b/src/core/expression/RBAIfStatement.hpp
@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * If statement class header file
+ */
+
+#ifndef RBAIFSTATEMENT_HPP
+#define RBAIFSTATEMENT_HPP
+
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIfStatement : public RBAExpression
+{
+public:
+ RBAIfStatement()=default;
+ RBAIfStatement(const RBAIfStatement&)=delete;
+ RBAIfStatement(const RBAIfStatement&&)=delete;
+ RBAIfStatement& operator=(const RBAIfStatement&)=delete;
+ RBAIfStatement& operator=(const RBAIfStatement&&)=delete;
+ virtual ~RBAIfStatement()=default;
+
+public:
+ void setCondition(RBAExpression* const expr);
+ void setThenExpression(RBAExpression* const expr);
+ void setElseExpression(RBAExpression* const expr);
+ RBAExpression* const getCondition() const;
+ RBAExpression* const getThenExpression() const;
+ RBAExpression* const getElseExpression() const;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+ void doActionCore(RBAConstraintInfo* info, RBAArbitrator* arb) override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ void createHierarchy() override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+ private:
+ RBAExpression* condition_ {nullptr};
+ RBAExpression* thenExpression_ {nullptr};
+ RBAExpression* elseExpression_ {nullptr};
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIfStatementMaker.cpp b/src/core/expression/RBAIfStatementMaker.cpp
new file mode 100644
index 0000000..b878ada
--- /dev/null
+++ b/src/core/expression/RBAIfStatementMaker.cpp
@@ -0,0 +1,78 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIfStatementMaker.cpp
+/// @brief IfStatement object generation class definition file
+
+#include "RBAIfStatementMaker.hpp"
+#include "RBAIfStatement.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAIfStatementMaker::RBAIfStatementMaker()
+ : RBAExpressionMaker{"IfStatement"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIfStatementMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIfStatement>();
+}
+
+RBAModelElement*
+RBAIfStatementMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBAIfStatement* const ifstmt {dynamic_cast<RBAIfStatement*>(element)};
+
+ // Set LetStatement
+ const std::int32_t pop_num {setLetStatement(model, ifstmt, jsonElem)};
+
+ // Set condition
+ const RBAJsonElement* const condElem {jsonElem->findChildren("condition")};
+ RBAModelElement* const condExpr
+ {getFactory()->createElement(condElem->getClassName(), condElem)};
+ ifstmt->setCondition(dynamic_cast<RBAExpression*>(condExpr));
+ // Set "then"
+ const RBAJsonElement* const thenElem {jsonElem->findChildren("thenExpression")};
+ RBAModelElement* thenExpr {nullptr};
+ if(thenElem != nullptr) {
+ thenExpr = getFactory()->createElement(thenElem->getClassName(), thenElem);
+ }
+ ifstmt->setThenExpression(dynamic_cast<RBAExpression*>(thenExpr));
+ // Set "else"
+ const RBAJsonElement* const elseElem {jsonElem->findChildren("elseExpression")};
+ RBAModelElement* elseExpr {nullptr};
+ if(elseElem != nullptr) {
+ elseExpr = getFactory()->createElement(elseElem->getClassName(), elseElem);
+ }
+ ifstmt->setElseExpression(dynamic_cast<RBAExpression*>(elseExpr));
+
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return ifstmt;
+}
+
+}
diff --git a/src/core/expression/RBAIfStatementMaker.hpp b/src/core/expression/RBAIfStatementMaker.hpp
new file mode 100644
index 0000000..57a4133
--- /dev/null
+++ b/src/core/expression/RBAIfStatementMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIfStatementMaker.hpp
+/// @brief IfStatement object generation class header file
+
+#ifndef RBAIFSTATEMENTMAKER_HPP
+#define RBAIFSTATEMENTMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IfStatement object generation class
+class RBAIfStatementMaker : public RBAExpressionMaker
+{
+public:
+ RBAIfStatementMaker();
+ RBAIfStatementMaker(const RBAIfStatementMaker&)=delete;
+ RBAIfStatementMaker(const RBAIfStatementMaker&&)=delete;
+ RBAIfStatementMaker& operator=(const RBAIfStatementMaker&)=delete;
+ RBAIfStatementMaker& operator=(const RBAIfStatementMaker&&)=delete;
+ virtual ~RBAIfStatementMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief set property of Model Element for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model Model for storing generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAImpliesOperator.cpp b/src/core/expression/RBAImpliesOperator.cpp
new file mode 100644
index 0000000..ab95dc7
--- /dev/null
+++ b/src/core/expression/RBAImpliesOperator.cpp
@@ -0,0 +1,145 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * implication operator class defintion file
+ */
+
+#include "RBAImpliesOperator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAImpliesOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAImpliesOperator::getModelElementType() const
+{
+ return RBAModelElementType::ImpliesOperator;
+}
+
+bool
+RBAImpliesOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ // Add "left-hand side formula" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#left");
+ const bool lhsRes {getLhsOperand()->execute(leftInfo, arb)};
+ // Remove "left-hand side formula" from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ if (leftInfo->isExceptionBeforeArbitrate() == false) {
+ if (lhsRes == false) {
+ isPassed = true;
+ } else {
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ // Add "right-hand side formula" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#right");
+ const bool rhsRes {getRhsOperand()->execute(rightInfo, arb)};
+ // Remove "right-hand side formula"
+ // from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ if (rightInfo->isExceptionBeforeArbitrate() == true) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (rhsRes == true) {
+ isPassed = true;
+ } else {
+ ;
+ }
+ }
+ } else {
+ info->setExceptionBeforeArbitrate(true);
+ // Evaluate the right-hand side fromula
+ // to get the right side allocatable of arbitration target
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ // Add "right-hand side formula" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#right");
+ static_cast<void>(getRhsOperand()->execute(rightInfo, arb));
+ // Remove "right-hand side formula" to the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate()) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAImpliesOperator::getSymbol() const
+{
+ return "->";
+}
+
+void
+RBAImpliesOperator::createHierarchy()
+{
+ RBAExpression* exprLhs = getLhsOperand();
+ RBAExpression* exprRhs = getRhsOperand();
+
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(getSymbol());
+ RBALogManager::coverageHierarchyOfConstraintExpressionLog(getCoverageExpressionText(), this);
+
+ // Add "left-hand side formula" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#left");
+ exprLhs->createHierarchy();
+ // Remove "left-hand side formula" from
+ // the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ // Add "right-hand side formula" to the constraint hierarchy for coverage
+ LOG_addHierarchy("#right");
+ exprRhs->createHierarchy();
+ // Remove "right-hand side formula" from
+ // the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAImpliesOperator.hpp b/src/core/expression/RBAImpliesOperator.hpp
new file mode 100644
index 0000000..cc1cb33
--- /dev/null
+++ b/src/core/expression/RBAImpliesOperator.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * implication operator class defintion file
+ */
+
+#ifndef RBAIMPLIESOPERATOR_HPP
+#define RBAIMPLIESOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAImpliesOperator: public RBALogicalOperator
+{
+public:
+ RBAImpliesOperator()=default;
+ RBAImpliesOperator(const RBAImpliesOperator&)=delete;
+ RBAImpliesOperator(const RBAImpliesOperator&&)=delete;
+ RBAImpliesOperator& operator=(const RBAImpliesOperator&)=delete;
+ RBAImpliesOperator& operator=(const RBAImpliesOperator&&)=delete;
+ virtual ~RBAImpliesOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ void createHierarchy() override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAImpliesOperatorMaker.cpp b/src/core/expression/RBAImpliesOperatorMaker.cpp
new file mode 100644
index 0000000..00b35fa
--- /dev/null
+++ b/src/core/expression/RBAImpliesOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAImpliesOperatorMaker.cpp
+/// @brief ImpliesOperator object generation class definition file
+
+#include "RBAImpliesOperatorMaker.hpp"
+#include "RBAImpliesOperator.hpp"
+
+namespace rba
+{
+
+RBAImpliesOperatorMaker::RBAImpliesOperatorMaker()
+ : RBAOperatorMaker{"ImpliesOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAImpliesOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAImpliesOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAImpliesOperatorMaker.hpp b/src/core/expression/RBAImpliesOperatorMaker.hpp
new file mode 100644
index 0000000..466d36a
--- /dev/null
+++ b/src/core/expression/RBAImpliesOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAImpliesOperatorMaker.hpp
+/// @brief ImpliesOperator object generation class header file
+
+#ifndef RBAIMPLIEDOPERATORMAKER_HPP
+#define RBAIMPLIEDOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ImpliesOperator object generation class
+class RBAImpliesOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAImpliesOperatorMaker();
+ RBAImpliesOperatorMaker(const RBAImpliesOperatorMaker&)=delete;
+ RBAImpliesOperatorMaker(const RBAImpliesOperatorMaker&&)=delete;
+ RBAImpliesOperatorMaker& operator=(const RBAImpliesOperatorMaker&)=delete;
+ RBAImpliesOperatorMaker& operator=(const RBAImpliesOperatorMaker&&)=delete;
+ virtual ~RBAImpliesOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIntegerValue.cpp b/src/core/expression/RBAIntegerValue.cpp
new file mode 100644
index 0000000..aadffb0
--- /dev/null
+++ b/src/core/expression/RBAIntegerValue.cpp
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Integer value class definition file
+ */
+
+#include "RBAIntegerValue.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+
+namespace rba
+{
+
+void
+RBAIntegerValue::setValue(const std::int32_t value)
+{
+ value_ = value;
+}
+
+std::int32_t
+RBAIntegerValue::getValue() const
+{
+ return value_;
+}
+
+RBAModelElementType
+RBAIntegerValue::getModelElementType() const
+{
+ return RBAModelElementType::IntegerValue;
+}
+
+std::int32_t
+RBAIntegerValue::getValueCore(RBAConstraintInfo* info, RBAArbitrator * arb) const
+{
+ return getValue();
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIntegerValue::getExpressionText() const
+{
+ return std::to_string(value_);
+}
+
+const std::string
+RBAIntegerValue::getCoverageExpressionText() const
+{
+ return getExpressionText();
+}
+
+void
+RBAIntegerValue::createHierarchy()
+{
+ // No opration
+ // because there is no hierarchy below this expression
+}
+
+RBAExpressionType
+RBAIntegerValue::getUnderlyingType() const
+{
+ return RBAExpressionType::VALUE;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIntegerValue.hpp b/src/core/expression/RBAIntegerValue.hpp
new file mode 100644
index 0000000..44cf8cb
--- /dev/null
+++ b/src/core/expression/RBAIntegerValue.hpp
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Integer value class
+ */
+
+#ifndef RBAINTEGERVALUE_HPP
+#define RBAINTEGERVALUE_HPP
+
+#include "RBAValueExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIntegerValue : public RBAValueExpression
+{
+public:
+ RBAIntegerValue()=default;
+ RBAIntegerValue(const RBAIntegerValue&)=delete;
+ RBAIntegerValue(const RBAIntegerValue&&)=delete;
+ RBAIntegerValue& operator=(const RBAIntegerValue&)=delete;
+ RBAIntegerValue& operator=(const RBAIntegerValue&&)=delete;
+ virtual ~RBAIntegerValue()=default;
+
+public:
+ void setValue(const std::int32_t value);
+
+ std::int32_t getValue() const;
+ RBAModelElementType getModelElementType() const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ void createHierarchy() override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+ private:
+ std::int32_t value_ {0};
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIntegerValueMaker.cpp b/src/core/expression/RBAIntegerValueMaker.cpp
new file mode 100644
index 0000000..19a21eb
--- /dev/null
+++ b/src/core/expression/RBAIntegerValueMaker.cpp
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIntegerValueMaker.cpp
+/// @brief IntegerValue object generation class definition file
+
+#include "RBAIntegerValueMaker.hpp"
+#include "RBAIntegerValue.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAIntegerValueMaker::RBAIntegerValueMaker()
+ : RBAExpressionMaker{"IntegerValue"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIntegerValueMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIntegerValue>();
+}
+
+RBAModelElement*
+RBAIntegerValueMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBAIntegerValue* const intVal {dynamic_cast<RBAIntegerValue*>(element)};
+
+ // Set LetStatement
+ const std::int32_t pop_num {setLetStatement(model, intVal, jsonElem)};
+
+ // Set value
+ const RBAJsonElement* const valueElem {jsonElem->findChildren("value")};
+ intVal->setValue(stoi(valueElem->getString()));
+
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return intVal;
+}
+
+}
diff --git a/src/core/expression/RBAIntegerValueMaker.hpp b/src/core/expression/RBAIntegerValueMaker.hpp
new file mode 100644
index 0000000..0f637df
--- /dev/null
+++ b/src/core/expression/RBAIntegerValueMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIntegerValueMaker.hpp
+/// @brief IntegerValue object generation class header file
+
+#ifndef RBAINTEGERVALUEMAKER_HPP
+#define RBAINTEGERVALUEMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IntegerValue object generation class
+class RBAIntegerValueMaker : public RBAExpressionMaker
+{
+public:
+ RBAIntegerValueMaker();
+ RBAIntegerValueMaker(const RBAIntegerValueMaker&)=delete;
+ RBAIntegerValueMaker(const RBAIntegerValueMaker&&)=delete;
+ RBAIntegerValueMaker& operator=(const RBAIntegerValueMaker&)=delete;
+ RBAIntegerValueMaker& operator=(const RBAIntegerValueMaker&&)=delete;
+ virtual ~RBAIntegerValueMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief set property of Model Element for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model Model for storing generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsActive.cpp b/src/core/expression/RBAIsActive.cpp
new file mode 100644
index 0000000..a89745f
--- /dev/null
+++ b/src/core/expression/RBAIsActive.cpp
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * IsActive class definition
+ */
+
+#include "RBAIsActive.hpp"
+#include "RBAContent.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void RBAIsActive::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIsActive::getModelElementType() const
+{
+ return RBAModelElementType::IsActive;
+}
+
+bool
+RBAIsActive::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to the constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const ruleObj
+ {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+ if (leftInfo->isExceptionBeforeArbitrate() == true) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (ruleObj != nullptr) {
+ const RBAContent* const content {dynamic_cast<const RBAContent*>(ruleObj->getRawObject())};
+ if (ruleObj->isPrevious()) {
+ isPassed = arb->getResult()->isPreActive(content);
+ } else {
+ isPassed = arb->getResult()->isActive(content);
+ }
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " Content[NULL] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (ruleObj != nullptr) {
+ const RBAContent* content = dynamic_cast<const RBAContent*>(ruleObj
+ ->getRawObject());
+ if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getPreMsg(ruleObj->isPrevious()) + "Content["
+ + content->getElementName() + "] is Active");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getPreMsg(ruleObj->isPrevious()) + "Content["
+ + content->getElementName() + "] is not Active");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(" Content[NULL] is not Active");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from the constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsActive::getSymbol() const
+{
+ return ".isActive()";
+}
+
+RBAExpressionType
+RBAIsActive::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsActive.hpp b/src/core/expression/RBAIsActive.hpp
new file mode 100644
index 0000000..73ab055
--- /dev/null
+++ b/src/core/expression/RBAIsActive.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * IsActive class header file
+ */
+
+#ifndef RBAISACTIVE_HPP
+#define RBAISACTIVE_HPP
+
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsActive : public RBAContentOperator
+{
+public:
+ RBAIsActive()=default;
+ RBAIsActive(const RBAIsActive&)=delete;
+ RBAIsActive(const RBAIsActive&&)=delete;
+ RBAIsActive& operator=(const RBAIsActive&)=delete;
+ RBAIsActive& operator=(const RBAIsActive&&)=delete;
+ virtual ~RBAIsActive()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsActiveMaker.cpp b/src/core/expression/RBAIsActiveMaker.cpp
new file mode 100644
index 0000000..6b2e7ee
--- /dev/null
+++ b/src/core/expression/RBAIsActiveMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsActiveMaker.cpp
+/// @brief IsActive object generation class defintion file
+
+#include "RBAIsActiveMaker.hpp"
+#include "RBAIsActive.hpp"
+
+namespace rba
+{
+
+RBAIsActiveMaker::RBAIsActiveMaker()
+ : RBAOperatorMaker{"IsActive"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsActiveMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsActive>();
+}
+
+}
diff --git a/src/core/expression/RBAIsActiveMaker.hpp b/src/core/expression/RBAIsActiveMaker.hpp
new file mode 100644
index 0000000..15011fb
--- /dev/null
+++ b/src/core/expression/RBAIsActiveMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsActiveMaker.hpp
+/// @brief IsActive object generation class heaer file
+
+#ifndef RBAISACTIVEMAKER_HPP
+#define RBAISACTIVEMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsActive object generation class
+class RBAIsActiveMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsActiveMaker();
+ RBAIsActiveMaker(const RBAIsActiveMaker&)=delete;
+ RBAIsActiveMaker(const RBAIsActiveMaker&&)=delete;
+ RBAIsActiveMaker& operator=(const RBAIsActiveMaker&)=delete;
+ RBAIsActiveMaker& operator=(const RBAIsActiveMaker&&)=delete;
+ virtual ~RBAIsActiveMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsEqualToOperator.cpp b/src/core/expression/RBAIsEqualToOperator.cpp
new file mode 100644
index 0000000..5dfa929
--- /dev/null
+++ b/src/core/expression/RBAIsEqualToOperator.cpp
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsEqualToOperator class definitino file
+
+#include "RBAIsEqualToOperator.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAIsEqualToOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIsEqualToOperator::getModelElementType() const
+{
+ return RBAModelElementType::IsEqualToOperator;
+}
+
+bool
+RBAIsEqualToOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ const std::int32_t lhsVal {getLhsOperand()->getValue(leftInfo, arb)};
+ const std::int32_t rhsVal {getRhsOperand()->getValue(rightInfo, arb)};
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)
+ || (lhsVal == -99)
+ || (rhsVal == -99)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsVal == rhsVal) {
+ isPassed = true;
+ info->addTrueAllocatableFromOperand();
+ } else {
+ info->addFalseAllocatableFromOperand();
+ }
+ }
+
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (lhsVal == rhsVal) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsEqualToOperator::getSymbol() const
+{
+ return "=";
+}
+
+RBAExpressionType
+RBAIsEqualToOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsEqualToOperator.hpp b/src/core/expression/RBAIsEqualToOperator.hpp
new file mode 100644
index 0000000..d66efed
--- /dev/null
+++ b/src/core/expression/RBAIsEqualToOperator.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsEqualToOperator class header file
+
+#ifndef RBAISEQUALTOOPERATOR_HPP
+#define RBAISEQUALTOOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsEqualToOperator : public RBALogicalOperator
+{
+public:
+ RBAIsEqualToOperator()=default;
+ RBAIsEqualToOperator(const RBAIsEqualToOperator&)=delete;
+ RBAIsEqualToOperator(RBAIsEqualToOperator&&)=delete;
+ RBAIsEqualToOperator& operator=(const RBAIsEqualToOperator&)=delete;
+ RBAIsEqualToOperator& operator=(RBAIsEqualToOperator&&)=delete;
+ virtual ~RBAIsEqualToOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsEqualToOperatorMaker.cpp b/src/core/expression/RBAIsEqualToOperatorMaker.cpp
new file mode 100644
index 0000000..32717ce
--- /dev/null
+++ b/src/core/expression/RBAIsEqualToOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsEqualToOperatorMaker.cpp
+/// @brief IsEqualToOperator object generation file
+
+#include "RBAIsEqualToOperatorMaker.hpp"
+#include "RBAIsEqualToOperator.hpp"
+
+namespace rba
+{
+
+RBAIsEqualToOperatorMaker::RBAIsEqualToOperatorMaker()
+ : RBAOperatorMaker{"IsEqualToOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsEqualToOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsEqualToOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAIsEqualToOperatorMaker.hpp b/src/core/expression/RBAIsEqualToOperatorMaker.hpp
new file mode 100644
index 0000000..9d0fa30
--- /dev/null
+++ b/src/core/expression/RBAIsEqualToOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsEqualToOperatorMaker.hpp
+/// @brief IsEqualToOperator object generation file
+
+#ifndef RBAISEQUALTOOPERATORMAKER_HPP
+#define RBAISEQUALTOOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsEqualToOperator object generation class
+class RBAIsEqualToOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsEqualToOperatorMaker();
+ RBAIsEqualToOperatorMaker(const RBAIsEqualToOperatorMaker&)=delete;
+ RBAIsEqualToOperatorMaker(const RBAIsEqualToOperatorMaker&&)=delete;
+ RBAIsEqualToOperatorMaker& operator=(const RBAIsEqualToOperatorMaker&)=delete;
+ RBAIsEqualToOperatorMaker& operator=(const RBAIsEqualToOperatorMaker&&)=delete;
+ virtual ~RBAIsEqualToOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsGreaterThanEqualOperator.cpp b/src/core/expression/RBAIsGreaterThanEqualOperator.cpp
new file mode 100644
index 0000000..368bb3b
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanEqualOperator.cpp
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsGreaterThanEqualOperator class definition file
+
+#include "RBAIsGreaterThanEqualOperator.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAIsGreaterThanEqualOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIsGreaterThanEqualOperator::getModelElementType() const
+{
+ return RBAModelElementType::IsGreaterThanEqualOperator;
+}
+
+bool
+RBAIsGreaterThanEqualOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ const std::int32_t lhsVal {getLhsOperand()->getValue(leftInfo, arb)};
+ const std::int32_t rhsVal {getRhsOperand()->getValue(rightInfo, arb)};
+ // If a pre-arbitration exception occurs on either the left side
+ // or the right side in the reference, throw it higher
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)
+ || (lhsVal == -99)
+ || (rhsVal == -99)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsVal >= rhsVal) {
+ isPassed = true;
+ info->addTrueAllocatableFromOperand();
+ } else {
+ info->addFalseAllocatableFromOperand();
+ }
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsGreaterThanEqualOperator::getSymbol() const
+{
+ return ">=";
+}
+
+RBAExpressionType
+RBAIsGreaterThanEqualOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsGreaterThanEqualOperator.hpp b/src/core/expression/RBAIsGreaterThanEqualOperator.hpp
new file mode 100644
index 0000000..0d5db61
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanEqualOperator.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsGreaterThanEqualOperator class header file
+
+#ifndef RBAISGREATERTHANEQUALOPERATOR_HPP
+#define RBAISGREATERTHANEQUALOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsGreaterThanEqualOperator : public RBALogicalOperator
+{
+public:
+ RBAIsGreaterThanEqualOperator()=default;
+ RBAIsGreaterThanEqualOperator(const RBAIsGreaterThanEqualOperator&)=delete;
+ RBAIsGreaterThanEqualOperator(RBAIsGreaterThanEqualOperator&&)=delete;
+ RBAIsGreaterThanEqualOperator& operator=(const RBAIsGreaterThanEqualOperator&)=delete;
+ RBAIsGreaterThanEqualOperator& operator=(RBAIsGreaterThanEqualOperator&&)=delete;
+ virtual ~RBAIsGreaterThanEqualOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsGreaterThanEqualOperatorMaker.cpp b/src/core/expression/RBAIsGreaterThanEqualOperatorMaker.cpp
new file mode 100644
index 0000000..e9e23a9
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanEqualOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsGreaterThanEqualOperatorMaker.cpp
+/// @brief IsGreaterThanEqualOperator object generation class
+
+#include "RBAIsGreaterThanEqualOperatorMaker.hpp"
+#include "RBAIsGreaterThanEqualOperator.hpp"
+
+namespace rba
+{
+
+RBAIsGreaterThanEqualOperatorMaker::RBAIsGreaterThanEqualOperatorMaker()
+ : RBAOperatorMaker{"IsGreaterThanEqualOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsGreaterThanEqualOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsGreaterThanEqualOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAIsGreaterThanEqualOperatorMaker.hpp b/src/core/expression/RBAIsGreaterThanEqualOperatorMaker.hpp
new file mode 100644
index 0000000..e7f470f
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanEqualOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsGreaterThanEqualOperatorMaker.hpp
+/// @brief IsGreaterThanEqualOperator object generation class header file
+
+#ifndef RBAISGREATERTHANEQUALOPERATORMAKER_HPP
+#define RBAISGREATERTHANEQUALOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsGreaterThanEqualOperator object generation class
+class RBAIsGreaterThanEqualOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsGreaterThanEqualOperatorMaker();
+ RBAIsGreaterThanEqualOperatorMaker(const RBAIsGreaterThanEqualOperatorMaker&)=delete;
+ RBAIsGreaterThanEqualOperatorMaker(const RBAIsGreaterThanEqualOperatorMaker&&)=delete;
+ RBAIsGreaterThanEqualOperatorMaker& operator=(const RBAIsGreaterThanEqualOperatorMaker&)=delete;
+ RBAIsGreaterThanEqualOperatorMaker& operator=(const RBAIsGreaterThanEqualOperatorMaker&&)=delete;
+ virtual ~RBAIsGreaterThanEqualOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsGreaterThanOperator.cpp b/src/core/expression/RBAIsGreaterThanOperator.cpp
new file mode 100644
index 0000000..d9153f1
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanOperator.cpp
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsGreaterThanOperator class definition file
+
+#include "RBAIsGreaterThanOperator.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+RBAModelElementType
+RBAIsGreaterThanOperator::getModelElementType() const
+{
+ return RBAModelElementType::IsGreaterThanOperator;
+}
+
+void
+RBAIsGreaterThanOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+bool
+RBAIsGreaterThanOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ const std::int32_t lhsVal {getLhsOperand()->getValue(leftInfo, arb)};
+ const std::int32_t rhsVal {getRhsOperand()->getValue(rightInfo, arb)};
+ // If a pre-arbitration exception occurs on either the left side
+ // or the right side in the reference, throw it higher
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)
+ || (lhsVal == -99)
+ || (rhsVal == -99)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsVal > rhsVal) {
+ isPassed = true;
+ info->addTrueAllocatableFromOperand();
+ } else {
+ info->addFalseAllocatableFromOperand();
+ }
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsGreaterThanOperator::getSymbol() const
+{
+ return ">";
+}
+
+RBAExpressionType
+RBAIsGreaterThanOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsGreaterThanOperator.hpp b/src/core/expression/RBAIsGreaterThanOperator.hpp
new file mode 100644
index 0000000..9e0938b
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanOperator.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsGreaterThanOperator class header file
+
+#ifndef RBAISGREATERTHANOPERATOR_HPP
+#define RBAISGREATERTHANOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsGreaterThanOperator : public RBALogicalOperator
+{
+public:
+ RBAIsGreaterThanOperator()=default;
+ RBAIsGreaterThanOperator(const RBAIsGreaterThanOperator&)=delete;
+ RBAIsGreaterThanOperator(RBAIsGreaterThanOperator&&)=delete;
+ RBAIsGreaterThanOperator& operator=(const RBAIsGreaterThanOperator&)=delete;
+ RBAIsGreaterThanOperator& operator=(RBAIsGreaterThanOperator&&)=delete;
+ virtual ~RBAIsGreaterThanOperator()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsGreaterThanOperatorMaker.cpp b/src/core/expression/RBAIsGreaterThanOperatorMaker.cpp
new file mode 100644
index 0000000..37a2888
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsGreaterThanEqualOperatorMaker.cpp
+/// @brief IsGreaterThanEqualOperator object generation class definition file
+
+#include "RBAIsGreaterThanOperatorMaker.hpp"
+#include "RBAIsGreaterThanOperator.hpp"
+
+namespace rba
+{
+
+RBAIsGreaterThanOperatorMaker::RBAIsGreaterThanOperatorMaker()
+ : RBAOperatorMaker{"IsGreaterThanOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsGreaterThanOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsGreaterThanOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAIsGreaterThanOperatorMaker.hpp b/src/core/expression/RBAIsGreaterThanOperatorMaker.hpp
new file mode 100644
index 0000000..40bfc17
--- /dev/null
+++ b/src/core/expression/RBAIsGreaterThanOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsGreaterThanEqualOperatorMaker.hpp
+/// @brief IsGreaterThanEqualOperator object generation class header file
+
+#ifndef RBAISGREATERTHANOPERATORMAKER_HPP
+#define RBAISGREATERTHANOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsGreaterThanEqualOperator object generation class
+class RBAIsGreaterThanOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsGreaterThanOperatorMaker();
+ RBAIsGreaterThanOperatorMaker(const RBAIsGreaterThanOperatorMaker&)=delete;
+ RBAIsGreaterThanOperatorMaker(const RBAIsGreaterThanOperatorMaker&&)=delete;
+ RBAIsGreaterThanOperatorMaker& operator=(const RBAIsGreaterThanOperatorMaker&)=delete;
+ RBAIsGreaterThanOperatorMaker& operator=(const RBAIsGreaterThanOperatorMaker&&)=delete;
+ virtual ~RBAIsGreaterThanOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsLowerThanEqualOperator.cpp b/src/core/expression/RBAIsLowerThanEqualOperator.cpp
new file mode 100644
index 0000000..811b34d
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanEqualOperator.cpp
@@ -0,0 +1,106 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsLowerThanEqualOperator class definition file
+
+#include "RBAIsLowerThanEqualOperator.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+
+namespace rba
+{
+
+void
+RBAIsLowerThanEqualOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIsLowerThanEqualOperator::getModelElementType() const
+{
+ return RBAModelElementType::IsLowerThanEqualOperator;
+}
+
+bool
+RBAIsLowerThanEqualOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ const std::int32_t lhsVal {getLhsOperand()->getValue(leftInfo, arb)};
+ const std::int32_t rhsVal {getRhsOperand()->getValue(rightInfo, arb)};
+ // If a pre-arbitration exception occurs on either the left side
+ // or the right side in the reference, throw it higher
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)
+ || (lhsVal == -99)
+ || (rhsVal == -99)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsVal <= rhsVal) {
+ isPassed = true;
+ info->addTrueAllocatableFromOperand();
+ } else {
+ info->addFalseAllocatableFromOperand();
+ }
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsLowerThanEqualOperator::getSymbol() const
+{
+ return "<=";
+}
+
+RBAExpressionType
+RBAIsLowerThanEqualOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsLowerThanEqualOperator.hpp b/src/core/expression/RBAIsLowerThanEqualOperator.hpp
new file mode 100644
index 0000000..3459110
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanEqualOperator.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsLowerThanEqualOperator class header file
+
+#ifndef RBAISLOWERTHANEQUALOPERATOR_HPP
+#define RBAISLOWERTHANEQUALOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsLowerThanEqualOperator : public RBALogicalOperator
+{
+public:
+ RBAIsLowerThanEqualOperator()=default;
+ RBAIsLowerThanEqualOperator(const RBAIsLowerThanEqualOperator&)=delete;
+ RBAIsLowerThanEqualOperator(RBAIsLowerThanEqualOperator&&)=delete;
+ RBAIsLowerThanEqualOperator& operator=(const RBAIsLowerThanEqualOperator&)=delete;
+ RBAIsLowerThanEqualOperator& operator=(RBAIsLowerThanEqualOperator&&)=delete;
+ virtual ~RBAIsLowerThanEqualOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsLowerThanEqualOperatorMaker.cpp b/src/core/expression/RBAIsLowerThanEqualOperatorMaker.cpp
new file mode 100644
index 0000000..a04a52b
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanEqualOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsLowerThanEqualOperatorMaker.cpp
+/// @brief IsLowerThanEqualOperator object geneation class defintion file
+
+#include "RBAIsLowerThanEqualOperatorMaker.hpp"
+#include "RBAIsLowerThanEqualOperator.hpp"
+
+namespace rba
+{
+
+RBAIsLowerThanEqualOperatorMaker::RBAIsLowerThanEqualOperatorMaker()
+ : RBAOperatorMaker{"IsLowerThanEqualOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsLowerThanEqualOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsLowerThanEqualOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAIsLowerThanEqualOperatorMaker.hpp b/src/core/expression/RBAIsLowerThanEqualOperatorMaker.hpp
new file mode 100644
index 0000000..10cf469
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanEqualOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsLowerThanEqualOperatorMaker.hpp
+/// @brief IsLowerThanEqualOperator object geneation class header file
+
+#ifndef RBAISLOWERTHANEQUALOPERATORMAKER_HPP
+#define RBAISLOWERTHANEQUALOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsLowerThanEqualOperator object generation class
+class RBAIsLowerThanEqualOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsLowerThanEqualOperatorMaker();
+ RBAIsLowerThanEqualOperatorMaker(const RBAIsLowerThanEqualOperatorMaker&)=delete;
+ RBAIsLowerThanEqualOperatorMaker(const RBAIsLowerThanEqualOperatorMaker&&)=delete;
+ RBAIsLowerThanEqualOperatorMaker& operator=(const RBAIsLowerThanEqualOperatorMaker&)=delete;
+ RBAIsLowerThanEqualOperatorMaker& operator=(const RBAIsLowerThanEqualOperatorMaker&&)=delete;
+ virtual ~RBAIsLowerThanEqualOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsLowerThanOperator.cpp b/src/core/expression/RBAIsLowerThanOperator.cpp
new file mode 100644
index 0000000..99a7860
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanOperator.cpp
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsLowerThanOperator class definition file
+
+#include "RBAIsLowerThanOperator.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAIsLowerThanOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIsLowerThanOperator::getModelElementType() const
+{
+ return RBAModelElementType::IsLowerThanOperator;
+}
+
+bool
+RBAIsLowerThanOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ const std::int32_t lhsVal {getLhsOperand()->getValue(leftInfo, arb)};
+ const std::int32_t rhsVal {getRhsOperand()->getValue(rightInfo, arb)};
+ // If a pre-arbitration exception occurs on either the left side
+ // or the right side in the reference, throw it higher
+ if ((leftInfo->isExceptionBeforeArbitrate() == true)
+ || (rightInfo->isExceptionBeforeArbitrate() == true)
+ || (lhsVal == -99)
+ || (rhsVal == -99)) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsVal < rhsVal) {
+ isPassed = true;
+ info->addTrueAllocatableFromOperand();
+ } else {
+ info->addFalseAllocatableFromOperand();
+ }
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsLowerThanOperator::getSymbol() const
+{
+ return "<";
+}
+
+RBAExpressionType
+RBAIsLowerThanOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsLowerThanOperator.hpp b/src/core/expression/RBAIsLowerThanOperator.hpp
new file mode 100644
index 0000000..3a23e45
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanOperator.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// IsLowerThanOperator class header file
+
+#ifndef RBAISLOWERTHANOPERATOR_HPP
+#define RBAISLOWERTHANOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsLowerThanOperator : public RBALogicalOperator
+{
+public:
+ RBAIsLowerThanOperator()=default;
+ RBAIsLowerThanOperator(const RBAIsLowerThanOperator&)=delete;
+ RBAIsLowerThanOperator(RBAIsLowerThanOperator&&)=delete;
+ RBAIsLowerThanOperator& operator=(const RBAIsLowerThanOperator&)=delete;
+ RBAIsLowerThanOperator& operator=(RBAIsLowerThanOperator&&)=delete;
+ virtual ~RBAIsLowerThanOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsLowerThanOperatorMaker.cpp b/src/core/expression/RBAIsLowerThanOperatorMaker.cpp
new file mode 100644
index 0000000..f6ddf53
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanOperatorMaker.cpp
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAIsLowerThanOperatorMaker.cpp
+/// @brief IsLowerThanOperator object gerneation class
+
+#include "RBAIsLowerThanOperatorMaker.hpp"
+#include "RBAIsLowerThanOperator.hpp"
+
+namespace rba
+{
+
+RBAIsLowerThanOperatorMaker::RBAIsLowerThanOperatorMaker()
+ : RBAOperatorMaker{"IsLowerThanOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsLowerThanOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsLowerThanOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAIsLowerThanOperatorMaker.hpp b/src/core/expression/RBAIsLowerThanOperatorMaker.hpp
new file mode 100644
index 0000000..d2c6870
--- /dev/null
+++ b/src/core/expression/RBAIsLowerThanOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsLowerThanOperatorMaker.hpp
+/// @brief IsLowerThanOperator object gerneation class header file
+
+#ifndef RBAISLOWERTHANOPERATORMAKER_HPP
+#define RBAISLOWERTHANOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief sLowerThanOperator object gerneation class
+class RBAIsLowerThanOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsLowerThanOperatorMaker();
+ RBAIsLowerThanOperatorMaker(const RBAIsLowerThanOperatorMaker&)=delete;
+ RBAIsLowerThanOperatorMaker(const RBAIsLowerThanOperatorMaker&&)=delete;
+ RBAIsLowerThanOperatorMaker& operator=(const RBAIsLowerThanOperatorMaker&)=delete;
+ RBAIsLowerThanOperatorMaker& operator=(const RBAIsLowerThanOperatorMaker&&)=delete;
+ virtual ~RBAIsLowerThanOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsOn.cpp b/src/core/expression/RBAIsOn.cpp
new file mode 100644
index 0000000..f8dd769
--- /dev/null
+++ b/src/core/expression/RBAIsOn.cpp
@@ -0,0 +1,132 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * IsOn class (to judge if a Scene is active) definition file
+ */
+
+#include "RBAIsOn.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBALogManager.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void
+RBAIsOn::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAIsOn::getModelElementType() const
+{
+ return RBAModelElementType::IsOn;
+}
+
+bool
+RBAIsOn::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const ruleObj
+ {getLhsOperand()->getReferenceObject(leftInfo, arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (ruleObj != nullptr){
+ const RBASceneImpl* const scene {dynamic_cast<const RBASceneImpl*>(ruleObj->getRawObject())};
+ if (ruleObj->isPrevious() == false) {
+ isPassed = arb->getResult()->isActive(scene);
+ } else {
+ isPassed = arb->getResult()->isPreActive(scene);
+ }
+ } else {
+ // Currently, there is no expression that returns null as "Scene",
+ // so it does not go through this path. But an expression that returns null
+ // may be added in the future, so it is described as it is.
+ ;
+ }
+#ifdef RBA_USE_LOG
+ if (ruleObj != nullptr) {
+ const RBASceneImpl* scene = dynamic_cast<const RBASceneImpl*>(ruleObj
+ ->getRawObject());
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " Scene[" + scene->getName() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getPreMsg(ruleObj->isPrevious()) + "Scene["
+ + scene->getName() + "] is On");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getPreMsg(ruleObj->isPrevious()) + "Scene["
+ + scene->getName() + "] is not On");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+ } else {
+ // Currently, there is no expression that returns null as "Scene",
+ // so it does not go through this path. But an expression that returns null
+ // may be added in the future, so it is described as it is.
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getPreMsg(ruleObj->isPrevious()) + "Scene[NULL] is not On");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIsOn::getSymbol() const
+{
+ return ".isOn()";
+}
+
+const std::string
+RBAIsOn::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+
+const std::string RBAIsOn::getCoverageExpressionText() const
+{
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol();
+}
+
+RBAExpressionType
+RBAIsOn::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAIsOn.hpp b/src/core/expression/RBAIsOn.hpp
new file mode 100644
index 0000000..9f3f778
--- /dev/null
+++ b/src/core/expression/RBAIsOn.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * IsOn class (to judge if a Scene is active) header
+ */
+
+#ifndef RBAISON_HPP
+#define RBAISON_HPP
+
+#include "RBASceneOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsOn : public RBASceneOperator
+{
+public:
+ RBAIsOn()=default;
+ RBAIsOn(const RBAIsOn&)=delete;
+ RBAIsOn(const RBAIsOn&&)=delete;
+ RBAIsOn& operator=(const RBAIsOn&)=delete;
+ RBAIsOn& operator=(const RBAIsOn&&)=delete;
+ virtual ~RBAIsOn()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsOnMaker.cpp b/src/core/expression/RBAIsOnMaker.cpp
new file mode 100644
index 0000000..79a4e16
--- /dev/null
+++ b/src/core/expression/RBAIsOnMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsOnMaker.cpp
+/// @brief IsOn (to judge if a Scene is active) class generation definition
+
+#include "RBAIsOnMaker.hpp"
+#include "RBAIsOn.hpp"
+
+namespace rba
+{
+
+RBAIsOnMaker::RBAIsOnMaker()
+ : RBAOperatorMaker{"IsOn"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsOnMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsOn>();
+}
+
+}
diff --git a/src/core/expression/RBAIsOnMaker.hpp b/src/core/expression/RBAIsOnMaker.hpp
new file mode 100644
index 0000000..824d091
--- /dev/null
+++ b/src/core/expression/RBAIsOnMaker.hpp
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsOnMaker.hpp
+/// @brief IsOn object generation class header file
+/// IsOn is class to judge if a Scene is active
+
+#ifndef RBAISONMAKER_HPP
+#define RBAISONMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsOn object generation class
+class RBAIsOnMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsOnMaker();
+ RBAIsOnMaker(const RBAIsOnMaker&)=delete;
+ RBAIsOnMaker(const RBAIsOnMaker&&)=delete;
+ RBAIsOnMaker& operator=(const RBAIsOnMaker&)=delete;
+ RBAIsOnMaker& operator=(const RBAIsOnMaker&&)=delete;
+ virtual ~RBAIsOnMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAIsTypeOfOperator.cpp b/src/core/expression/RBAIsTypeOfOperator.cpp
new file mode 100644
index 0000000..2104f43
--- /dev/null
+++ b/src/core/expression/RBAIsTypeOfOperator.cpp
@@ -0,0 +1,102 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// IsTypeOf class defintion file
+//
+
+#include "RBAIsTypeOfOperator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBALogManager.hpp"
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+void RBAIsTypeOfOperator::setTag(const std::string& tag)
+{
+ tagId_ = tag;
+}
+
+void RBAIsTypeOfOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+RBAModelElementType RBAIsTypeOfOperator::getModelElementType() const
+{
+ return RBAModelElementType::IsTypeOfOperator;
+}
+bool RBAIsTypeOfOperator::executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo * const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const ruleObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate() == true) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (ruleObj != nullptr) {
+ isPassed = ruleObj->containsTag(tagId_);
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate()) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getExpressionText() + " before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if ((ruleObj == nullptr) || (!isPassed)) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getExpressionText() + " false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + getExpressionText() + " true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ }
+#endif
+ LOG_removeHierarchy();
+ return isPassed;
+}
+#ifdef RBA_USE_LOG
+const std::string RBAIsTypeOfOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+
+const std::string RBAIsTypeOfOperator::getCoverageExpressionText() const
+{
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol();
+}
+
+const std::string RBAIsTypeOfOperator::getSymbol() const
+{
+ return ".isTypeOf(" + tagId_ + ")";
+}
+
+RBAExpressionType RBAIsTypeOfOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+}
+/* namespace rba */
diff --git a/src/core/expression/RBAIsTypeOfOperator.hpp b/src/core/expression/RBAIsTypeOfOperator.hpp
new file mode 100644
index 0000000..ce4d213
--- /dev/null
+++ b/src/core/expression/RBAIsTypeOfOperator.hpp
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// IsTypeOfクラスヘッダファイル
+//
+
+#ifndef RBAISTYPEOFOPERATOR_HPP
+#define RBAISTYPEOFOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAIsTypeOfOperator : public RBAOperator
+{
+ public:
+ RBAIsTypeOfOperator()=default;
+ RBAIsTypeOfOperator(const RBAIsTypeOfOperator&)=delete;
+ RBAIsTypeOfOperator(const RBAIsTypeOfOperator&&)=delete;
+ RBAIsTypeOfOperator& operator=(const RBAIsTypeOfOperator&)=delete;
+ RBAIsTypeOfOperator& operator=(const RBAIsTypeOfOperator&&)=delete;
+ virtual ~RBAIsTypeOfOperator()=default;
+
+ public:
+ void setTag(const std::string& tag);
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ const std::string getSymbol() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+ private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::string tagId_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+} /* namespace rba */
+
+#endif /* RBAISTYPEOFOPERATOR_HPP */
diff --git a/src/core/expression/RBAIsTypeOfOperatorMaker.cpp b/src/core/expression/RBAIsTypeOfOperatorMaker.cpp
new file mode 100644
index 0000000..cabd83c
--- /dev/null
+++ b/src/core/expression/RBAIsTypeOfOperatorMaker.cpp
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsTypeOfOperatorMaker.cpp
+/// @brief IsTypeOf object generation class
+
+#include "RBAIsTypeOfOperatorMaker.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAIsTypeOfOperator.hpp"
+
+namespace rba
+{
+
+RBAIsTypeOfOperatorMaker::RBAIsTypeOfOperatorMaker()
+ : RBAOperatorMaker{"IsTypeOf"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAIsTypeOfOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAIsTypeOfOperator>();
+}
+
+RBAModelElement*
+RBAIsTypeOfOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBAIsTypeOfOperator* const isTypeOfOpe
+ {dynamic_cast<RBAIsTypeOfOperator*>(element)};
+
+ // Set LetStatement
+ const std::int32_t pop_num {setLetStatement(model, isTypeOfOpe, jsonElem)};
+
+ // Set operand
+ const RBAJsonElement* const operand {jsonElem->findChildren("operand")};
+ const RBAJsonElement* const param {operand->getChild()};
+ RBAModelElement* const expr {getFactory()->createElement(param->getClassName(), param)};
+ isTypeOfOpe->addOperand(dynamic_cast<RBAExpression*>(expr));
+ // Set Tag
+ const RBAJsonElement* const tagElem {jsonElem->findChildren("tagName")};
+ isTypeOfOpe->setTag(tagElem->getString());
+
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return isTypeOfOpe;
+}
+
+}
diff --git a/src/core/expression/RBAIsTypeOfOperatorMaker.hpp b/src/core/expression/RBAIsTypeOfOperatorMaker.hpp
new file mode 100644
index 0000000..5877267
--- /dev/null
+++ b/src/core/expression/RBAIsTypeOfOperatorMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAIsTypeOfOperatorMaker.hpp
+/// @brief IsTypeOf object geneation class header file
+
+#ifndef RBAISTYPEOFOPERATORMAKER_HPP
+#define RBAISTYPEOFOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief IsTypeOf object geneation class
+class RBAIsTypeOfOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAIsTypeOfOperatorMaker();
+ RBAIsTypeOfOperatorMaker(const RBAIsTypeOfOperatorMaker&)=delete;
+ RBAIsTypeOfOperatorMaker(const RBAIsTypeOfOperatorMaker&&)=delete;
+ RBAIsTypeOfOperatorMaker& operator=(const RBAIsTypeOfOperatorMaker&)=delete;
+ RBAIsTypeOfOperatorMaker& operator=(const RBAIsTypeOfOperatorMaker&&)=delete;
+ virtual ~RBAIsTypeOfOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALambdaContext.cpp b/src/core/expression/RBALambdaContext.cpp
new file mode 100644
index 0000000..7d68513
--- /dev/null
+++ b/src/core/expression/RBALambdaContext.cpp
@@ -0,0 +1,92 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * LambdaContext class definition file
+ */
+
+#include "RBALambdaContext.hpp"
+#include "RBALogManager.hpp"
+#include "RBAVariable.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentSet.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBALambdaExpression* const
+RBALambdaContext::getLambda() const
+{
+ return lambda_;
+}
+
+void
+RBALambdaContext::setLambda(RBALambdaExpression* const newLambda)
+{
+ lambda_ = newLambda;
+}
+
+#ifdef RBA_USE_LOG
+void
+RBALambdaContext::createHierarchy()
+{
+ lambda_->getX()->clearRuleObj();
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(getSymbol());
+ RBALogManager::coverageHierarchyOfConstraintExpressionLog(getCoverageExpressionText(), this);
+
+ // Get rule object and loop
+ RBAExpression* setObj = getLhsOperand();
+ RBAConstraintInfo dummyInfo;
+ // Since it is not referenced by "AllInstanceOf..." or "SetOfOperator"
+ // used for the set of "For-All" or "Exists", nullptr is no problem
+ RBAArbitrator* dummyArb = nullptr;
+ const RBARuleObject* objset = setObj->getReferenceObject(&dummyInfo, dummyArb);
+ std::vector<const RBARuleObject*> objs;
+ if(objset) {
+ if(dynamic_cast<const RBAAllocatableSet*>(objset) != nullptr) {
+ const RBAAllocatableSet* aSet
+ = dynamic_cast<const RBAAllocatableSet*>(objset);
+ for(const auto& alloc : aSet->getLeafAllocatable()) {
+ objs.push_back(alloc);
+ }
+ }
+ else if(dynamic_cast<const RBAContentSet*>(objset) != nullptr) {
+ const RBAContentSet* cSet = dynamic_cast<const RBAContentSet*>(objset);
+ for(const auto& cont : cSet->getLeafContent() ){
+ objs.push_back(cont);
+ }
+ }
+ }
+
+ // Enable expansion of own variables in the coverage log
+ std::int32_t idx=0;
+ for(const RBARuleObject* obj : objs) {
+ LOG_addHierarchy("#" + std::to_string(idx++));
+ lambda_->getX()->setRuleObj(obj);
+ lambda_->createHierarchy();
+ LOG_removeHierarchy();
+ }
+
+ // Remove own to Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBALambdaContext.hpp b/src/core/expression/RBALambdaContext.hpp
new file mode 100644
index 0000000..219be71
--- /dev/null
+++ b/src/core/expression/RBALambdaContext.hpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * LambdaContext class header file
+ */
+
+#ifndef RBALAMBDACONTEXT_HPP
+#define RBALAMBDACONTEXT_HPP
+
+#include "RBASetOperator.hpp"
+
+namespace rba
+{
+
+class RBALambdaExpression;
+
+class DLL_EXPORT RBALambdaContext : public RBASetOperator
+{
+protected:
+ RBALambdaContext()=default;
+ RBALambdaContext(const RBALambdaContext&)=delete;
+ RBALambdaContext(const RBALambdaContext&&)=delete;
+ RBALambdaContext& operator=(const RBALambdaContext&)=delete;
+ RBALambdaContext& operator=(const RBALambdaContext&&)=delete;
+public:
+ virtual ~RBALambdaContext()=default;
+
+public:
+ RBALambdaExpression* const getLambda() const;
+ void setLambda(RBALambdaExpression* const newLambda);
+
+#ifdef RBA_USE_LOG
+ void createHierarchy() override;
+#endif
+
+private:
+ RBALambdaExpression* lambda_ {nullptr};
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALambdaContextMaker.cpp b/src/core/expression/RBALambdaContextMaker.cpp
new file mode 100644
index 0000000..f0e7e4d
--- /dev/null
+++ b/src/core/expression/RBALambdaContextMaker.cpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBALambdaContextMaker.cpp
+/// @brief LambdaContext object generation abstract class definition
+
+#include "RBALambdaContextMaker.hpp"
+#include "RBALambdaContext.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBALambdaContextMaker::RBALambdaContextMaker(const std::string& label)
+ : RBAOperatorMaker{label}
+{
+}
+
+RBAModelElement*
+RBALambdaContextMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBALambdaContext* const lambdaContext
+ {dynamic_cast<RBALambdaContext*>(element)};
+
+ // Set LetStatement
+ const std::int32_t pop_num {setLetStatement(model, lambdaContext, jsonElem)};
+ // Set lambda
+ const RBAJsonElement* const lambdaElement {jsonElem->findChildren("lambda")};
+ RBAModelElement* const lambdaExpr
+ {getFactory()->createElement(lambdaElement->getClassName(), lambdaElement)};
+ lambdaContext->setLambda(dynamic_cast<RBALambdaExpression*>(lambdaExpr));
+ // Set operand
+ const RBAJsonElement* const param {jsonElem->findChildren("operand")->getChild()};
+ RBAModelElement* const expr
+ {getFactory()->createElement(param->getClassName(), param)};
+ lambdaContext->addOperand(dynamic_cast<RBAExpression*>(expr));
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return lambdaContext;
+}
+
+}
diff --git a/src/core/expression/RBALambdaContextMaker.hpp b/src/core/expression/RBALambdaContextMaker.hpp
new file mode 100644
index 0000000..6df7001
--- /dev/null
+++ b/src/core/expression/RBALambdaContextMaker.hpp
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBALambdaContextMaker.cpp
+/// @brief LambdaContext object generation abstract class header file
+
+#ifndef RBASETOPERATORMAKER_HPP
+#define RBASETOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+class RBALambdaContext;
+
+/// @brief LambdaContext object generation abstract class
+class RBALambdaContextMaker : public RBAOperatorMaker
+{
+public:
+ explicit RBALambdaContextMaker(const std::string& label="");
+ RBALambdaContextMaker(const RBALambdaContextMaker&)=delete;
+ RBALambdaContextMaker(const RBALambdaContextMaker&&)=delete;
+ RBALambdaContextMaker& operator=(const RBALambdaContextMaker&)=delete;
+ RBALambdaContextMaker& operator=(const RBALambdaContextMaker&&)=delete;
+ virtual ~RBALambdaContextMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+ /// @brief generate an empty object of LambdaContext
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for LambdaContext object
+ virtual std::unique_ptr<RBALambdaContext> createLambdaContext()=0;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALambdaExpression.cpp b/src/core/expression/RBALambdaExpression.cpp
new file mode 100644
index 0000000..7638faa
--- /dev/null
+++ b/src/core/expression/RBALambdaExpression.cpp
@@ -0,0 +1,139 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBALambdaExpression class defnition
+ */
+
+#include "RBALambdaExpression.hpp"
+#include "RBAVariable.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void
+RBALambdaExpression::setX(RBAVariable* const x)
+{
+ variable_ = x;
+}
+
+void
+RBALambdaExpression::setBodyText(RBAExpression* const expr)
+{
+ bodyText_ = expr;
+}
+
+RBAVariable* const
+RBALambdaExpression::getX() const
+{
+ return variable_;
+}
+
+RBAExpression* const
+RBALambdaExpression::getBodyText() const
+{
+ return bodyText_;
+}
+
+RBAModelElementType
+RBALambdaExpression::getModelElementType() const
+{
+ return RBAModelElementType::LambdaExpression;
+}
+
+bool
+RBALambdaExpression::executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const
+{
+ getX()->setRuleObj(ruleObj_);
+
+ RBAConstraintInfo* const childInfo {info->getChild(0U)};
+ bool res {getBodyText()->execute(childInfo,arb)};
+ if(childInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ res = false;
+ }
+
+ return res;
+}
+
+const RBARuleObject*
+RBALambdaExpression::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ getX()->setRuleObj(ruleObj_);
+
+ RBAConstraintInfo* const childInfo {info->getChild(0U)};
+ const RBARuleObject* const res {getBodyText()->getReferenceObject(childInfo, arb)};
+ if (childInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+
+ return res;
+}
+std::int32_t
+RBALambdaExpression::getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ getX()->setRuleObj(ruleObj_);
+
+ RBAConstraintInfo* const childInfo {info->getChild(0U)};
+ const std::int32_t res {getBodyText()->getValue(childInfo, arb)};
+ if (childInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+
+ return res;
+}
+#ifdef RBA_USE_LOG
+void
+RBALambdaExpression::createHierarchy()
+{
+ bodyText_->createHierarchy();
+}
+
+const std::string
+RBALambdaExpression::getExpressionText() const
+{
+ return "{ " + getX()->getElementName() + " |"
+ + bodyText_->getExpressionText() + "}";
+}
+
+const std::string
+RBALambdaExpression::getCoverageExpressionText() const
+{
+ return "{ " + getX()->getElementName() + " |" +
+ bodyText_->getCoverageExpressionText() + "}";
+}
+#endif
+
+void
+RBALambdaExpression::setRuleObj(const RBARuleObject* const ruleObj)
+{
+ ruleObj_ = ruleObj;
+ getX()->setRuleObj(ruleObj);
+}
+
+void
+RBALambdaExpression::clearRuleObj()
+{
+ ruleObj_ = nullptr;
+ getX()->clearRuleObj();
+}
+
+}
diff --git a/src/core/expression/RBALambdaExpression.hpp b/src/core/expression/RBALambdaExpression.hpp
new file mode 100644
index 0000000..76958e7
--- /dev/null
+++ b/src/core/expression/RBALambdaExpression.hpp
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBALambdaExpression class header
+ */
+
+#ifndef RBALAMBDAEXPRESSION_HPP
+#define RBALAMBDAEXPRESSION_HPP
+
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class RBAArbitrator;
+class RBAConstraintInfo;
+class RBAVariable;
+class RBARuleObject;
+
+class DLL_EXPORT RBALambdaExpression : public RBAExpression
+{
+public:
+ RBALambdaExpression()=default;
+ RBALambdaExpression(const RBALambdaExpression&)=delete;
+ RBALambdaExpression(const RBALambdaExpression&&)=delete;
+ RBALambdaExpression& operator=(const RBALambdaExpression&)=delete;
+ RBALambdaExpression& operator=(const RBALambdaExpression&&)=delete;
+ virtual ~RBALambdaExpression()=default;
+
+public:
+ void setX(RBAVariable* const x);
+ void setBodyText(RBAExpression* const expr);
+ RBAVariable* const getX() const;
+ RBAExpression* const getBodyText() const;
+
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+ void setRuleObj(const RBARuleObject* const ruleObj);
+ void clearRuleObj();
+
+ // Log
+#ifdef RBA_USE_LOG
+ void createHierarchy();
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+
+private:
+ // "variable" is not const because it calls setExpression()
+ // in the arbitration process.
+ RBAVariable* variable_;
+ RBAExpression* bodyText_ {nullptr};
+ const RBARuleObject* ruleObj_ {nullptr};
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALambdaExpressionMaker.cpp b/src/core/expression/RBALambdaExpressionMaker.cpp
new file mode 100644
index 0000000..674067f
--- /dev/null
+++ b/src/core/expression/RBALambdaExpressionMaker.cpp
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBALambdaExpressionMaker.cpp
+/// @brief LambdaExpression object generation class definition
+
+#include "RBALambdaExpressionMaker.hpp"
+#include "RBALambdaExpression.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBALambdaExpressionMaker::RBALambdaExpressionMaker()
+ : RBAExpressionMaker{"LambdaExpression"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBALambdaExpressionMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBALambdaExpression>();
+}
+
+RBAModelElement*
+RBALambdaExpressionMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBALambdaExpression* const lambdaExpr
+ {dynamic_cast<RBALambdaExpression*>(element)};
+
+ // Set LetStatement
+ const std::int32_t pop_num {setLetStatement(model, lambdaExpr, jsonElem)};
+
+ // Set variable
+ const RBAJsonElement* const varElement {jsonElem->findChildren("x")};
+ RBAVariable* const var
+ {dynamic_cast<RBAVariable*>(getFactory()->createElement("Variable",
+ varElement))};
+ lambdaExpr->setX(var);
+ // Set bodyText
+ getFactory()->pushVariable(var);
+ const RBAJsonElement* const body {jsonElem->findChildren("bodyText")};
+ RBAExpression* const expr
+ {dynamic_cast<RBAExpression*>(getFactory()->createElement(body->getClassName(),
+ body))};
+ lambdaExpr->setBodyText(expr);
+
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return lambdaExpr;
+}
+
+}
diff --git a/src/core/expression/RBALambdaExpressionMaker.hpp b/src/core/expression/RBALambdaExpressionMaker.hpp
new file mode 100644
index 0000000..04e5f05
--- /dev/null
+++ b/src/core/expression/RBALambdaExpressionMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBALambdaExpressionMaker.hpp
+/// @brief LambdaExpression object generation class header
+
+#ifndef RBALAMBDAEXPRESSIONMAKER_HPP
+#define RBALAMBDAEXPRESSIONMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief LambdaExpression object generation class
+class RBALambdaExpressionMaker : public RBAExpressionMaker
+{
+public:
+ RBALambdaExpressionMaker();
+ RBALambdaExpressionMaker(const RBALambdaExpressionMaker&)=delete;
+ RBALambdaExpressionMaker(const RBALambdaExpressionMaker&&)=delete;
+ RBALambdaExpressionMaker& operator=(const RBALambdaExpressionMaker&)=delete;
+ RBALambdaExpressionMaker& operator=(const RBALambdaExpressionMaker&&)=delete;
+ virtual ~RBALambdaExpressionMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALetStatement.cpp b/src/core/expression/RBALetStatement.cpp
new file mode 100644
index 0000000..f64cc18
--- /dev/null
+++ b/src/core/expression/RBALetStatement.cpp
@@ -0,0 +1,68 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * LetStatement class definition
+ */
+
+#include "RBALetStatement.hpp"
+#include "RBALogManager.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAVariable.hpp"
+#include "RBAExpressionVisitor.hpp"
+
+namespace rba
+{
+
+RBAModelElementType RBALetStatement::getModelElementType() const
+{
+ return RBAModelElementType::LetStatement;
+}
+
+void RBALetStatement::setVariable(RBAVariable* const var)
+{
+ variable_ = var;
+}
+
+void
+RBALetStatement::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+void RBALetStatement::setVariable(RBAArbitrator* const arb)
+{
+ RBAConstraintInfo* const info {variable_->createConstraintInfo()};
+ variable_->setRuleObj(getLhsOperand()->getReferenceObject(info, arb));
+#ifdef RBA_USE_LOG
+ std::string valueName;
+ if (info->isExceptionBeforeArbitrate() == true) {
+ valueName = "before arbitrate skip";
+ } else if (variable_->getRuleObj() == nullptr) {
+ valueName = "NULL";
+ } else {
+ valueName = variable_->getRuleObj()->getElementName();
+ if (valueName == "") {
+ valueName = variable_->getRuleObj()->getDynamicName();
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " let " + variable_->getElementName() + " = "
+ + getLhsOperand()->getExpressionText() + " = " + valueName);
+#endif
+}
+} /* namespace rba */
diff --git a/src/core/expression/RBALetStatement.hpp b/src/core/expression/RBALetStatement.hpp
new file mode 100644
index 0000000..636b07d
--- /dev/null
+++ b/src/core/expression/RBALetStatement.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+/**
+ * LetStatement class header file
+ */
+
+#ifndef RBALETOPERATOR_HPP_
+#define RBALETOPERATOR_HPP_
+
+#include "RBAOperator.hpp"
+
+namespace rba {
+
+class RBAVariable;
+
+class DLL_EXPORT RBALetStatement : public RBAOperator
+{
+public:
+ RBALetStatement()=default;
+ RBALetStatement(const RBALetStatement&)=delete;
+ RBALetStatement(const RBALetStatement&&)=delete;
+ RBALetStatement& operator=(const RBALetStatement&)=delete;
+ RBALetStatement& operator=(const RBALetStatement&&)=delete;
+ virtual ~RBALetStatement()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ void setVariable(RBAVariable* const var);
+ void setVariable(RBAArbitrator* const arb);
+
+private:
+ RBAVariable* variable_;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALetStatementMaker.cpp b/src/core/expression/RBALetStatementMaker.cpp
new file mode 100644
index 0000000..93fcdee
--- /dev/null
+++ b/src/core/expression/RBALetStatementMaker.cpp
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBALetStatementMaker.cpp
+/// @brief LetStatement object generation class defintino.
+
+#include "RBALetStatementMaker.hpp"
+#include "RBALetStatement.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBALetStatementMaker::RBALetStatementMaker()
+ : RBAExpressionMaker{"LetStatement"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBALetStatementMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBALetStatement>();
+}
+
+RBAModelElement*
+RBALetStatementMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBALetStatement* const letStmt {dynamic_cast<RBALetStatement*>(element)};
+
+ // Set variable
+ const RBAJsonElement* const varElement {jsonElem->findChildren("variable")};
+ RBAVariable* const var
+ {dynamic_cast<RBAVariable*>(getFactory()->createElement("Variable",
+ varElement))};
+ letStmt->setVariable(var); // Set Body
+
+ // popVariable() is executed by the caller of this function
+ getFactory()->pushVariable(var);
+ const RBAJsonElement* const body {jsonElem->findChildren("body")};
+ RBAExpression* const expr
+ {dynamic_cast<RBAExpression*>(getFactory()->createElement(body->getClassName(),
+ body))};
+ letStmt->addOperand(expr);
+
+ return letStmt;
+}
+
+}
diff --git a/src/core/expression/RBALetStatementMaker.hpp b/src/core/expression/RBALetStatementMaker.hpp
new file mode 100644
index 0000000..348ca71
--- /dev/null
+++ b/src/core/expression/RBALetStatementMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBALetStatementMaker.hpp
+/// @brief LetStatement object generation class header
+
+#ifndef RBAISACTIVEMAKER_HPP
+#define RBAISACTIVEMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief LetStatement object generation class
+class RBALetStatementMaker : public RBAExpressionMaker
+{
+public:
+ RBALetStatementMaker();
+ RBALetStatementMaker(const RBALetStatementMaker&)=delete;
+ RBALetStatementMaker(const RBALetStatementMaker&&)=delete;
+ RBALetStatementMaker& operator=(const RBALetStatementMaker&)=delete;
+ RBALetStatementMaker& operator=(const RBALetStatementMaker&&)=delete;
+ virtual ~RBALetStatementMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBALogicalOperator.cpp b/src/core/expression/RBALogicalOperator.cpp
new file mode 100644
index 0000000..e931b7a
--- /dev/null
+++ b/src/core/expression/RBALogicalOperator.cpp
@@ -0,0 +1,73 @@
+
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * 論理オペレータクラス定義ファイル
+ */
+
+#include <sstream>
+#include "RBALogicalOperator.hpp"
+#include "RBAExpressionType.hpp"
+
+namespace rba
+{
+
+#ifdef RBA_USE_LOG
+const std::string
+RBALogicalOperator::getExpressionText() const
+{
+ std::ostringstream oss;
+ oss << "(";
+ const auto& exprList = getOperand();
+ const auto& lastExpr = exprList.back();
+ for (const auto& expr : exprList) {
+ oss << expr->getExpressionText();
+ if (expr != lastExpr) {
+ oss << " " << getSymbol() << " ";
+ }
+ }
+ oss << ")";
+
+ return oss.str();
+}
+
+const std::string
+RBALogicalOperator::getCoverageExpressionText() const
+{
+ std::ostringstream oss;
+ oss << "(";
+ auto exprList = getOperand();
+ auto lastExpr = exprList.back();
+ for (const auto& expr : exprList) {
+ oss << expr->getCoverageExpressionText();
+ if (expr != lastExpr) {
+ oss << " " << getSymbol() << " ";
+ }
+ }
+ oss << ")";
+
+ return oss.str();
+}
+
+RBAExpressionType
+RBALogicalOperator::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBALogicalOperator.hpp b/src/core/expression/RBALogicalOperator.hpp
new file mode 100644
index 0000000..b713f5a
--- /dev/null
+++ b/src/core/expression/RBALogicalOperator.hpp
@@ -0,0 +1,50 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * LogicalOperator class header
+ */
+
+#ifndef RBALOGICOPERATOR_HPP
+#define RBALOGICOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBALogicalOperator : public RBAOperator
+{
+ protected:
+ RBALogicalOperator()=default;
+ RBALogicalOperator(const RBALogicalOperator&)=delete;
+ RBALogicalOperator(const RBALogicalOperator&&)=delete;
+ RBALogicalOperator& operator=(const RBALogicalOperator&)=delete;
+ RBALogicalOperator& operator=(const RBALogicalOperator&&)=delete;
+
+ public:
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAMaxOperator.cpp b/src/core/expression/RBAMaxOperator.cpp
new file mode 100644
index 0000000..46d5ed1
--- /dev/null
+++ b/src/core/expression/RBAMaxOperator.cpp
@@ -0,0 +1,135 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * MaxOperator class definition
+ */
+
+#include "RBAMaxOperator.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAContent.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBALogManager.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALambdaExpression.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void
+RBAMaxOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAMaxOperator::getModelElementType() const
+{
+ return RBAModelElementType::MaxOperator;
+}
+
+const RBARuleObject* RBAMaxOperator::getReferenceObjectCore(
+ RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ LOG_addHierarchy(LOG_getSymbol());
+ const RBARuleObject* returnObj {nullptr};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const lhsObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsObj != nullptr) {
+ const RBAAllocatableSet* alloSet = dynamic_cast<const RBAAllocatableSet*>(lhsObj);
+ if (alloSet != nullptr) {
+ std::uint32_t i { 0U };
+ std::int32_t maxVal { -99 };
+ RBALambdaExpression* const lambda { getLambda() };
+ for (auto& obj : alloSet->getLeafAllocatable()) {
+ LOG_addHierarchy("#" + std::to_string(i));
+ ++i;
+ RBAConstraintInfo* const childInfo { info->getChild(i) };
+ lambda->setRuleObj(obj);
+ const std::int32_t val { lambda->getValue(childInfo, arb) };
+ LOG_removeHierarchy();
+ if ((maxVal < val) && (!childInfo->isExceptionBeforeArbitrate())) {
+ maxVal = val;
+ returnObj = obj;
+ }
+ }
+ } else {
+ const RBAContentSet* contentSet = dynamic_cast<const RBAContentSet*>(lhsObj);
+ if (contentSet != nullptr) {
+ std::uint32_t i { 0U };
+ std::int32_t maxVal { -99 };
+ RBALambdaExpression* const lambda { getLambda() };
+ for (auto& obj : contentSet->getLeafContent()) {
+ LOG_addHierarchy("#" + std::to_string(i));
+ ++i;
+ RBAConstraintInfo* const childInfo { info->getChild(i) };
+ lambda->setRuleObj(obj);
+ const std::int32_t val { lambda->getValue(childInfo, arb) };
+ LOG_removeHierarchy();
+ if ((maxVal < val) && (!childInfo->isExceptionBeforeArbitrate())) {
+ maxVal = val;
+ returnObj = obj;
+ }
+ }
+ }
+ }
+ }
+ }
+#ifdef RBA_USE_LOG
+ std::string objName = "NULL";
+ if (info->isExceptionBeforeArbitrate()) {
+ objName = "before arbitrate skip";
+ } else {
+ if (returnObj != nullptr){
+ objName = returnObj->getElementName();
+ if (objName == "") {
+ objName = returnObj->getDynamicName();
+ }
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + LOG_getExpressionText() + " is " + objName);
+#endif
+ LOG_removeHierarchy();
+ return returnObj;
+}
+#ifdef RBA_USE_LOG
+const std::string RBAMaxOperator::getSymbol() const
+{
+ return ".max";
+}
+
+const std::string RBAMaxOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol()
+ + getLambda()->getExpressionText();
+}
+
+const std::string RBAMaxOperator::getCoverageExpressionText() const
+{
+ getLambda()->clearRuleObj();
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol()
+ + getLambda()->getCoverageExpressionText();
+}
+#endif
+
+} // namespace rba
diff --git a/src/core/expression/RBAMaxOperator.hpp b/src/core/expression/RBAMaxOperator.hpp
new file mode 100644
index 0000000..046cec9
--- /dev/null
+++ b/src/core/expression/RBAMaxOperator.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * MaxOperator class header
+ */
+
+#ifndef RBAMAXOPERATOR_HPP
+#define RBAMAXOPERATOR_HPP
+
+#include "RBALambdaContext.hpp"
+
+namespace rba
+{
+
+class RBAMaxOperator : public RBALambdaContext
+{
+ public:
+ RBAMaxOperator()=default;
+ RBAMaxOperator(const RBAMaxOperator&)=delete;
+ RBAMaxOperator(const RBAMaxOperator&&)=delete;
+ RBAMaxOperator& operator=(const RBAMaxOperator&)=delete;
+ RBAMaxOperator& operator=(const RBAMaxOperator&&)=delete;
+ virtual ~RBAMaxOperator()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+};
+
+} /* namespace rba */
+
+#endif /* RBAMAXOPERATOR_HPP */
diff --git a/src/core/expression/RBAMaxOperatorMaker.cpp b/src/core/expression/RBAMaxOperatorMaker.cpp
new file mode 100644
index 0000000..298bbbf
--- /dev/null
+++ b/src/core/expression/RBAMaxOperatorMaker.cpp
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAMaxOperatorMaker.cpp
+/// @brief MaxOperator object generation class definition
+
+#include "RBAMaxOperatorMaker.hpp"
+#include "RBAMaxOperator.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBAMaxOperatorMaker::RBAMaxOperatorMaker()
+ : RBALambdaContextMaker{"MaxOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAMaxOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAMaxOperator>();
+}
+
+RBAModelElement*
+RBAMaxOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(
+ RBALambdaContextMaker::setProperty(element, jsonElem, model, owner));
+
+ return element;
+}
+
+std::unique_ptr<RBALambdaContext>
+RBAMaxOperatorMaker::createLambdaContext()
+{
+ return std::make_unique<RBAMaxOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAMaxOperatorMaker.hpp b/src/core/expression/RBAMaxOperatorMaker.hpp
new file mode 100644
index 0000000..1216674
--- /dev/null
+++ b/src/core/expression/RBAMaxOperatorMaker.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAMaxOperatorMaker.hpp
+/// @brief MaxOperator object generation class header
+
+#ifndef RBAMAXOPERATORMAKER_HPP
+#define RBAMAXOPERATORMAKER_HPP
+
+#include "RBALambdaContextMaker.hpp"
+
+namespace rba
+{
+
+/// @brief MaxOperator object generation class
+class RBAMaxOperatorMaker : public RBALambdaContextMaker
+{
+public:
+ RBAMaxOperatorMaker();
+ RBAMaxOperatorMaker(const RBAMaxOperatorMaker&)=delete;
+ RBAMaxOperatorMaker(const RBAMaxOperatorMaker&&)=delete;
+ RBAMaxOperatorMaker& operator=(const RBAMaxOperatorMaker&)=delete;
+ RBAMaxOperatorMaker& operator=(const RBAMaxOperatorMaker&&)=delete;
+ virtual ~RBAMaxOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+ /// @brief generate an empty object of LambdaContext
+ /// @details generate an empty object of unique_ptr
+ /// @return unique_ptr for object of LambdaContext
+ std::unique_ptr<RBALambdaContext> createLambdaContext() override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAMemberFeatureReferenceMaker.cpp b/src/core/expression/RBAMemberFeatureReferenceMaker.cpp
new file mode 100644
index 0000000..699bca0
--- /dev/null
+++ b/src/core/expression/RBAMemberFeatureReferenceMaker.cpp
@@ -0,0 +1,94 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAMemberFeatureReferenceMaker.cpp
+/// @brief ObjectReference of property object generator class definition
+
+#include "RBAMemberFeatureReferenceMaker.hpp"
+#include "RBAObjectReference.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAAbstractProperty.hpp"
+
+namespace rba
+{
+
+RBAMemberFeatureReferenceMaker::RBAMemberFeatureReferenceMaker()
+ : RBAObjectReferenceMaker{"MemberFeatureReference"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAMemberFeatureReferenceMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAObjectReference>();
+}
+
+RBAModelElement*
+RBAMemberFeatureReferenceMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBAObjectReference* const objRef {dynamic_cast<RBAObjectReference*>(element)};
+
+ // Set reference object
+ objRef->setRefObject(getRuleObject(jsonElem,model));
+
+ return objRef;
+}
+
+const RBARuleObject*
+RBAMemberFeatureReferenceMaker::getRuleObject(const RBAJsonElement*
+ const jsonElem,
+ RBAModelImpl* const model)
+{
+ const RBARuleObject* refObj {nullptr};
+ const auto typeStr = jsonElem->findChildren("type")->getString();
+ const auto refObjStr = jsonElem->findChildren("refObject")->getString();
+
+ if (jsonElem->findChildren("class")->getString() == "ObjectReference") {
+ refObj = dynamic_cast<RBARuleObject*>(getMaker(typeStr)->getInstance(model,
+ refObjStr));
+ } else { // jsonElem->findChildren("class")->getString() == "MemberFeatureReference"
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // calling getRuleObject() recursively
+ // [Explain that it is okay to deviate from the rules]
+ // When "Content name.State machine name.State name" is used
+ // in the constraint expression, it becomes the STATEMACHINE_STATE of
+ // Member of "STATEMACHINE" of "CONTENT", so recursive call is used.
+ // Since the number of elements in the rule model is finite and
+ // there is no cyclic relationship, stack overflow does not occur and
+ // there is no problem.
+ const auto owner = const_cast<RBARuleObject*>(getRuleObject(jsonElem->findChildren("operand")->getChild(), model));
+ refObj = owner->getMember(refObjStr);
+ if (refObj == nullptr) {
+ if (getMaker(typeStr) != nullptr) {
+ refObj = dynamic_cast<RBARuleObject*>(getMaker(typeStr)->getInstance(model,
+ refObjStr, owner));
+ }
+ if ((refObj == nullptr)
+ && (jsonElem->findChildren("type")->getString() == "PROPERTY")) {
+ refObj = dynamic_cast<RBASceneImpl*>(owner)->addProperty(refObjStr, -99);
+ }
+ }
+ }
+ return refObj;
+}
+}
diff --git a/src/core/expression/RBAMemberFeatureReferenceMaker.hpp b/src/core/expression/RBAMemberFeatureReferenceMaker.hpp
new file mode 100644
index 0000000..61880a7
--- /dev/null
+++ b/src/core/expression/RBAMemberFeatureReferenceMaker.hpp
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAMemberFeatureReferenceMaker.cpp
+/// @brief ObjectReference of property object generator class header
+
+#ifndef RBAMEMBERFEATUREREFERENCEMAKER_HPP
+#define RBAMEMBERFEATUREREFERENCEMAKER_HPP
+
+#include "RBAObjectReferenceMaker.hpp"
+
+namespace rba
+{
+
+class RBARuleObject;
+
+/// @brief ObjectReference of property object generator class
+class RBAMemberFeatureReferenceMaker : public RBAObjectReferenceMaker
+{
+public:
+ RBAMemberFeatureReferenceMaker();
+ RBAMemberFeatureReferenceMaker(const RBAMemberFeatureReferenceMaker&)=delete;
+ RBAMemberFeatureReferenceMaker(const RBAMemberFeatureReferenceMaker&&)=delete;
+ RBAMemberFeatureReferenceMaker& operator=(const RBAMemberFeatureReferenceMaker&)=delete;
+ RBAMemberFeatureReferenceMaker& operator=(const RBAMemberFeatureReferenceMaker&&)=delete;
+ virtual ~RBAMemberFeatureReferenceMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+private:
+ const RBARuleObject* getRuleObject(const RBAJsonElement* const jsonElem,
+ RBAModelImpl* const model);
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAMinOperator.cpp b/src/core/expression/RBAMinOperator.cpp
new file mode 100644
index 0000000..923088b
--- /dev/null
+++ b/src/core/expression/RBAMinOperator.cpp
@@ -0,0 +1,135 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// MinOperator class definition
+
+#include "RBAMinOperator.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAContent.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALambdaExpression.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void
+RBAMinOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAMinOperator::getModelElementType() const
+{
+ return RBAModelElementType::MinOperator;
+}
+
+const RBARuleObject* RBAMinOperator::getReferenceObjectCore(
+ RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ LOG_addHierarchy(LOG_getSymbol());
+ const RBARuleObject* returnObj {nullptr};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const lhsObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (lhsObj != nullptr) {
+ const RBAAllocatableSet* alloSet = dynamic_cast<const RBAAllocatableSet*>(lhsObj);
+ if (alloSet != nullptr) {
+ std::uint32_t i { 0U };
+ std::int32_t minVal { INT32_MAX };
+ RBALambdaExpression* const lambda { getLambda() };
+ for (auto& obj : alloSet->getLeafAllocatable()) {
+ LOG_addHierarchy("#" + std::to_string(i));
+ ++i;
+ RBAConstraintInfo* const childInfo { info->getChild(i) };
+ lambda->setRuleObj(obj);
+ const std::int32_t val { lambda->getValue(childInfo, arb) };
+ LOG_removeHierarchy();
+ if ((val != -99) && (minVal > val)
+ && (!childInfo->isExceptionBeforeArbitrate())) {
+ minVal = val;
+ returnObj = obj;
+ }
+ }
+ } else {
+ const RBAContentSet* contentSet = dynamic_cast<const RBAContentSet*>(lhsObj);
+ if (contentSet != nullptr) {
+ std::uint32_t i { 0U };
+ std::int32_t minVal { INT32_MAX };
+ RBALambdaExpression* const lambda { getLambda() };
+ for (auto& obj : contentSet->getLeafContent()) {
+ LOG_addHierarchy("#" + std::to_string(i));
+ ++i;
+ RBAConstraintInfo* const childInfo { info->getChild(i) };
+ lambda->setRuleObj(obj);
+ const std::int32_t val { lambda->getValue(childInfo, arb) };
+ LOG_removeHierarchy();
+ if ((val != -99) && (minVal > val)
+ && (!childInfo->isExceptionBeforeArbitrate())) {
+ minVal = val;
+ returnObj = obj;
+ }
+ }
+ }
+ }
+ }
+ }
+#ifdef RBA_USE_LOG
+ std::string objName = "NULL";
+ if (info->isExceptionBeforeArbitrate()) {
+ objName = "before arbitrate skip";
+ } else {
+ if (returnObj != nullptr){
+ objName = returnObj->getElementName();
+ if (objName == "") {
+ objName = returnObj->getDynamicName();
+ }
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + LOG_getExpressionText() + " is " + objName);
+#endif
+ LOG_removeHierarchy();
+ return returnObj;
+}
+#ifdef RBA_USE_LOG
+const std::string RBAMinOperator::getSymbol() const
+{
+ return ".mix";
+}
+
+const std::string RBAMinOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol()
+ + getLambda()->getExpressionText();
+}
+
+const std::string RBAMinOperator::getCoverageExpressionText() const
+{
+ getLambda()->clearRuleObj();
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol()
+ + getLambda()->getCoverageExpressionText();
+}
+#endif
+
+} // namespace rba
diff --git a/src/core/expression/RBAMinOperator.hpp b/src/core/expression/RBAMinOperator.hpp
new file mode 100644
index 0000000..b128877
--- /dev/null
+++ b/src/core/expression/RBAMinOperator.hpp
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// MinOperator class header
+
+#ifndef RBAMINOPERATOR_HPP
+#define RBAMINOPERATOR_HPP
+
+#include "RBALambdaContext.hpp"
+
+namespace rba
+{
+
+class RBAMinOperator : public RBALambdaContext
+{
+ public:
+ RBAMinOperator()=default;
+ RBAMinOperator(const RBAMinOperator&)=delete;
+ RBAMinOperator(RBAMinOperator&&)=delete;
+ RBAMinOperator& operator=(const RBAMinOperator&)=delete;
+ RBAMinOperator& operator=(RBAMinOperator&&)=delete;
+ virtual ~RBAMinOperator()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+};
+
+} // namespace rba
+
+#endif // RBAMINOPERATOR_HPP
diff --git a/src/core/expression/RBAMinOperatorMaker.cpp b/src/core/expression/RBAMinOperatorMaker.cpp
new file mode 100644
index 0000000..060e552
--- /dev/null
+++ b/src/core/expression/RBAMinOperatorMaker.cpp
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAMinOperatorMaker.cpp
+/// @brief MinOperator object generator class definition
+
+#include "RBAMinOperatorMaker.hpp"
+#include "RBAMinOperator.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBAMinOperatorMaker::RBAMinOperatorMaker()
+ : RBALambdaContextMaker{"MinOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAMinOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAMinOperator>();
+}
+
+RBAModelElement*
+RBAMinOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(
+ RBALambdaContextMaker::setProperty(element, jsonElem, model, owner));
+
+ return element;
+}
+
+std::unique_ptr<RBALambdaContext>
+RBAMinOperatorMaker::createLambdaContext()
+{
+ return std::make_unique<RBAMinOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAMinOperatorMaker.hpp b/src/core/expression/RBAMinOperatorMaker.hpp
new file mode 100644
index 0000000..6eb90e1
--- /dev/null
+++ b/src/core/expression/RBAMinOperatorMaker.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAMinOperatorMaker.hpp
+/// @brief MinOperator object generator class header
+
+#ifndef RBAMINOPERATORMAKER_HPP
+#define RBAMINOPERATORMAKER_HPP
+
+#include "RBALambdaContextMaker.hpp"
+
+namespace rba
+{
+
+/// @brief MinOperator object generator class
+class RBAMinOperatorMaker : public RBALambdaContextMaker
+{
+public:
+ RBAMinOperatorMaker();
+ RBAMinOperatorMaker(const RBAMinOperatorMaker&)=delete;
+ RBAMinOperatorMaker(const RBAMinOperatorMaker&&)=delete;
+ RBAMinOperatorMaker& operator=(const RBAMinOperatorMaker&)=delete;
+ RBAMinOperatorMaker& operator=(const RBAMinOperatorMaker&&)=delete;
+ virtual ~RBAMinOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+ /// @brief generate an empty object of LambdaContext
+ /// @details generate an empty object of unique_ptr
+ /// @return unique_ptr for object of LambdaContext
+ std::unique_ptr<RBALambdaContext> createLambdaContext() override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBANotOperator.cpp b/src/core/expression/RBANotOperator.cpp
new file mode 100644
index 0000000..afcf3c8
--- /dev/null
+++ b/src/core/expression/RBANotOperator.cpp
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBANotOperator class definition
+ */
+
+#include "RBANotOperator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBANotOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBANotOperator::getModelElementType() const
+{
+ return RBAModelElementType::NotOperator;
+}
+
+bool
+RBANotOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const childInfo {info->getChild(0U)};
+ const bool isChildPassed {getLhsOperand()->execute(childInfo, arb)};
+ if (childInfo->isExceptionBeforeArbitrate() == true) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ isPassed = !isChildPassed;
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBANotOperator::getSymbol() const
+{
+ return "!";
+}
+
+const std::string
+RBANotOperator::getExpressionText() const
+{
+ return getSymbol() + getLhsOperand()->getExpressionText();
+}
+
+const std::string
+RBANotOperator::getCoverageExpressionText() const
+{
+ return getSymbol() + getLhsOperand()->getCoverageExpressionText();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBANotOperator.hpp b/src/core/expression/RBANotOperator.hpp
new file mode 100644
index 0000000..4af1461
--- /dev/null
+++ b/src/core/expression/RBANotOperator.hpp
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBANotOperator class header
+ */
+
+#ifndef RBANOTOPERATOR_HPP
+#define RBANOTOPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBANotOperator : public RBALogicalOperator
+{
+public:
+ RBANotOperator()=default;
+ RBANotOperator(const RBANotOperator&)=delete;
+ RBANotOperator(const RBANotOperator&&)=delete;
+ RBANotOperator& operator=(const RBANotOperator&)=delete;
+ RBANotOperator& operator=(const RBANotOperator&&)=delete;
+ virtual ~RBANotOperator()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBANotOperatorMaker.cpp b/src/core/expression/RBANotOperatorMaker.cpp
new file mode 100644
index 0000000..e4e823c
--- /dev/null
+++ b/src/core/expression/RBANotOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBANotOperatorMaker.cpp
+/// @brief NotOperator object generator class definition
+
+#include "RBANotOperatorMaker.hpp"
+#include "RBANotOperator.hpp"
+
+namespace rba
+{
+
+RBANotOperatorMaker::RBANotOperatorMaker()
+ : RBAOperatorMaker{"NotOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBANotOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBANotOperator>();
+}
+
+}
diff --git a/src/core/expression/RBANotOperatorMaker.hpp b/src/core/expression/RBANotOperatorMaker.hpp
new file mode 100644
index 0000000..91f39b9
--- /dev/null
+++ b/src/core/expression/RBANotOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBANotOperatorMaker.hpp
+/// @brief NotOperator object generator class header
+
+#ifndef RBANOTOPERATORMAKER_HPP
+#define RBANOTOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief NotOperator object generator class header
+class RBANotOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBANotOperatorMaker();
+ RBANotOperatorMaker(const RBANotOperatorMaker&)=delete;
+ RBANotOperatorMaker(const RBANotOperatorMaker&&)=delete;
+ RBANotOperatorMaker& operator=(const RBANotOperatorMaker&)=delete;
+ RBANotOperatorMaker& operator=(const RBANotOperatorMaker&&)=delete;
+ virtual ~RBANotOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAObjectCompare.cpp b/src/core/expression/RBAObjectCompare.cpp
new file mode 100644
index 0000000..65bee04
--- /dev/null
+++ b/src/core/expression/RBAObjectCompare.cpp
@@ -0,0 +1,165 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ObjectCompare calss defintion
+ */
+
+#include "RBAObjectCompare.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAExpressionType.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+
+namespace rba
+{
+
+void
+RBAObjectCompare::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAObjectCompare::getModelElementType() const
+{
+ return RBAModelElementType::ObjectCompare;
+}
+
+bool
+RBAObjectCompare::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBAExpression* const lhs {getLhsOperand()};
+ // Add left hand side expression to Constraint hierarchy for coverage
+ LOG_addHierarchy("#left");
+ const RBARuleObject* const lhobj {lhs->getReferenceObject(leftInfo, arb)};
+ // Remove left hand side expression from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ // Throw if one of the pre-arbitration exceptions appears in the reference
+ if (leftInfo->isExceptionBeforeArbitrate() == true) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ RBAConstraintInfo* const rightInfo {info->getChild(1U)};
+ const RBAExpression* const rhs {getRhsOperand()};
+ // Add right hand side expression to Constraint hierarchy for coverage
+ LOG_addHierarchy("#right");
+ const RBARuleObject* const rhobj {rhs->getReferenceObject(rightInfo, arb)};
+ // Remove right hand side expression to Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ // Throw if one of the pre-arbitration exceptions appears in the reference
+ if (rightInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ // False if both objects cannot be got
+ if ((lhobj != nullptr) && (rhobj != nullptr)) {
+ if (lhobj->getRawObject() == rhobj->getRawObject()) {
+ isPassed = true;
+          // Even if re-arbitration is performed for "ObjectCompare" that uses
+ // "ObjectRefrence" as an operand, the evaluation result does not
+ // change from false to True, so it is not necessary to add
+ // "FalseAllocatable" or "TrueAllocatabe" for re-arbitration.
+ // When "Expression" such as "AllocatedContent" is used as an operand,
+ // "FalseAllocatable" and "TrueAllocatabe" are added in the operand,
+ // so it is not necessary to add in ObjectCompare.
+ }
+ }
+ }
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAObjectCompare::getSymbol() const
+{
+ return "==";
+}
+
+const std::string
+RBAObjectCompare::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText()
+ + " " + getSymbol() + " " + getRhsOperand()->getExpressionText();
+}
+
+const std::string
+RBAObjectCompare::getCoverageExpressionText() const
+{
+ return getLhsOperand()->getCoverageExpressionText()
+ + " " + getSymbol() + " " + getRhsOperand()->getCoverageExpressionText();
+}
+
+void
+RBAObjectCompare::createHierarchy()
+{
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(getSymbol());
+ RBALogManager::coverageHierarchyOfConstraintExpressionLog(getCoverageExpressionText(), this);
+
+ RBAExpression* expr0 = getLhsOperand();
+ RBAExpression* expr1 = getRhsOperand();
+
+ // Add left hand side expression to Constraint hierarchy for coverage
+ LOG_addHierarchy("#left");
+ expr0->createHierarchy();
+ // Remove left hand side expression from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ // Add right hand side expression to Constraint hierarchy for coverage
+ LOG_addHierarchy("#right");
+ expr1->createHierarchy();
+ // Remove right hand side expression from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+}
+
+RBAExpressionType
+RBAObjectCompare::getUnderlyingType() const
+{
+ return RBAExpressionType::BOOLEAN;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAObjectCompare.hpp b/src/core/expression/RBAObjectCompare.hpp
new file mode 100644
index 0000000..c7c345d
--- /dev/null
+++ b/src/core/expression/RBAObjectCompare.hpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ObjectCompare calss header
+ */
+
+#ifndef RBAOBJECTCOMPARE_HPP
+#define RBAOBJECTCOMPARE_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAObjectCompare : public RBAOperator
+{
+public:
+ RBAObjectCompare()=default;
+ RBAObjectCompare(const RBAObjectCompare&)=delete;
+ RBAObjectCompare(const RBAObjectCompare&&)=delete;
+ RBAObjectCompare& operator=(const RBAObjectCompare&)=delete;
+ RBAObjectCompare& operator=(const RBAObjectCompare&&)=delete;
+ virtual ~RBAObjectCompare()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ void createHierarchy() override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAObjectCompareMaker.cpp b/src/core/expression/RBAObjectCompareMaker.cpp
new file mode 100644
index 0000000..ab696cf
--- /dev/null
+++ b/src/core/expression/RBAObjectCompareMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAObjectCompareMaker.cpp
+/// @brief ObjectCompare object generator class
+
+#include "RBAObjectCompareMaker.hpp"
+#include "RBAObjectCompare.hpp"
+
+namespace rba
+{
+
+RBAObjectCompareMaker::RBAObjectCompareMaker()
+ : RBAOperatorMaker{"ObjectCompare"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAObjectCompareMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAObjectCompare>();
+}
+
+}
diff --git a/src/core/expression/RBAObjectCompareMaker.hpp b/src/core/expression/RBAObjectCompareMaker.hpp
new file mode 100644
index 0000000..3d44a4e
--- /dev/null
+++ b/src/core/expression/RBAObjectCompareMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAObjectCompareMaker.hpp
+/// @brief ObjectCompare object generator class header
+
+#ifndef RBAOBJECTCOMPAREMAKER_HPP
+#define RBAOBJECTCOMPAREMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ObjectCompare object generator class
+class RBAObjectCompareMaker : public RBAOperatorMaker
+{
+public:
+ RBAObjectCompareMaker();
+ RBAObjectCompareMaker(const RBAObjectCompareMaker&)=delete;
+ RBAObjectCompareMaker(const RBAObjectCompareMaker&&)=delete;
+ RBAObjectCompareMaker& operator=(const RBAObjectCompareMaker&)=delete;
+ RBAObjectCompareMaker& operator=(const RBAObjectCompareMaker&&)=delete;
+ virtual ~RBAObjectCompareMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAObjectReference.cpp b/src/core/expression/RBAObjectReference.cpp
new file mode 100644
index 0000000..aefe83c
--- /dev/null
+++ b/src/core/expression/RBAObjectReference.cpp
@@ -0,0 +1,133 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// ObjectReference class definition
+
+#include "RBAObjectReference.hpp"
+
+#include "RBAExpressionVisitor.hpp"
+#include "RBAVariable.hpp"
+#include "RBAModelElementType.hpp"
+#ifdef RBA_USE_LOG
+#include "RBAAbstractProperty.hpp"
+#include "RBASceneImpl.hpp"
+#endif
+
+namespace rba
+{
+
+void
+RBAObjectReference::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAObjectReference::getModelElementType() const
+{
+ return RBAModelElementType::ObjectReference;
+}
+
+const RBARuleObject*
+RBAObjectReference::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ const RBARuleObject* obj {refObject_};
+ if (obj->isModelElementType(RBAModelElementType::Variable)) {
+ // in case of varible, its reference
+ const RBAVariable* const val {dynamic_cast<const RBAVariable*>(obj)};
+ obj = val->getRuleObj();
+ std::shared_ptr<RBAConstraintInfo> valInfo {val->getConstraintInfo()};
+ if (valInfo != nullptr) {
+ info->setChild(valInfo);
+ if (valInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ }
+ }
+ }
+ return obj;
+}
+
+void
+RBAObjectReference::setRefObject(const RBARuleObject* const newRefObject)
+{
+ refObject_ = newRefObject;
+}
+
+#ifdef RBA_USE_LOG
+
+void
+RBAObjectReference::setExpressionType(RBAExpressionType const newExprType)
+{
+ expressionType_ = newExprType;
+}
+
+void
+RBAObjectReference::createHierarchy()
+{
+ // No operation, because this does not affect the structure
+}
+
+const std::string
+RBAObjectReference::getExpressionText() const
+{
+ if (refObject_->isModelElementType(RBAModelElementType::Property)) {
+ return dynamic_cast<const RBAAbstractProperty*>(refObject_)->getScene()->getElementName();
+ }
+ else if ((refObject_->isModelElementType(RBAModelElementType::ViewContentState)) ||
+ (refObject_->isModelElementType(RBAModelElementType::SoundContentState))) {
+ return (refObject_->getOwner()->getElementName() + "." + refObject_->getElementName());
+ }
+ if(refObject_->getElementName() != ""){
+ return refObject_->getElementName();
+ } else {
+ return refObject_->getDynamicName();
+ }
+}
+
+const std::string
+RBAObjectReference::getCoverageExpressionText() const
+{
+ if (refObject_->isModelElementType(RBAModelElementType::Variable)) {
+ const RBAVariable* var =
+ dynamic_cast<const RBAVariable*>(refObject_);
+ if (var->getRuleObj()) {
+ if (var->getRuleObj()->getElementName() != "") {
+ return var->getRuleObj()->getElementName();
+ } else {
+ return var->getRuleObj()->getDynamicName();
+ }
+ }
+ }
+ if ((refObject_->isModelElementType(RBAModelElementType::ViewContentState)) ||
+ (refObject_->isModelElementType(RBAModelElementType::SoundContentState))) {
+ return (refObject_->getOwner()->getElementName() + "." + refObject_->getElementName());
+ }
+ if(refObject_->getElementName() != ""){
+ return refObject_->getElementName();
+ } else {
+ return refObject_->getDynamicName();
+ }
+}
+
+RBAExpressionType
+RBAObjectReference::getUnderlyingType() const
+{
+ return expressionType_;
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAObjectReference.hpp b/src/core/expression/RBAObjectReference.hpp
new file mode 100644
index 0000000..2eb38df
--- /dev/null
+++ b/src/core/expression/RBAObjectReference.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// ObjectReference class header
+
+#ifndef RBAOBJECTREFERENCE_HPP
+#define RBAOBJECTREFERENCE_HPP
+
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAObjectReference : public RBAExpression
+{
+public:
+ RBAObjectReference()=default;
+ RBAObjectReference(const RBAObjectReference&)=delete;
+ RBAObjectReference(const RBAObjectReference&&)=delete;
+ RBAObjectReference& operator=(const RBAObjectReference&)=delete;
+ RBAObjectReference& operator=(const RBAObjectReference&&)=delete;
+ virtual ~RBAObjectReference()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+ void setRefObject(const RBARuleObject* const newRefObject);
+
+ // Log
+#ifdef RBA_USE_LOG
+ void setExpressionType(RBAExpressionType const newExprType);
+ void createHierarchy() override;
+ const std::string getExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+
+private:
+ const RBARuleObject* refObject_;
+#ifdef RBA_USE_LOG
+ RBAExpressionType expressionType_;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAObjectReferenceMaker.cpp b/src/core/expression/RBAObjectReferenceMaker.cpp
new file mode 100644
index 0000000..8c216ba
--- /dev/null
+++ b/src/core/expression/RBAObjectReferenceMaker.cpp
@@ -0,0 +1,77 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAObjectReferenceMaker.cpp
+/// @brief ObjectReference object generator class definition
+
+#include "RBAObjectReferenceMaker.hpp"
+#include "RBAObjectReference.hpp"
+
+#include "RBAJsonElement.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAModelImpl.hpp"
+
+namespace rba
+{
+
+RBAObjectReferenceMaker::RBAObjectReferenceMaker(const std::string& label)
+ : RBAExpressionMaker{label}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAObjectReferenceMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAObjectReference>();
+}
+
+RBAModelElement*
+RBAObjectReferenceMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBAObjectReference* const objRef {dynamic_cast<RBAObjectReference*>(element)};
+
+ // Set reference object
+ //// Getting reference object string
+ const auto& refObjectStr = jsonElem->findChildren("refObject")->getString();
+
+ //// Find object
+ auto ruleObj = model->findModelElement(refObjectStr);
+
+ if(ruleObj == nullptr) {
+ ruleObj = getFactory()->getVariable(refObjectStr);
+ if(ruleObj == nullptr) {
+ const auto& typeStr = jsonElem->findChildren("type")->getString();
+ auto maker = getMaker(typeStr);
+ if (maker != nullptr) {
+ ruleObj = maker->getInstance(model, refObjectStr, owner);
+ }
+ }
+ }
+ objRef->setRefObject(dynamic_cast<const RBARuleObject*>(ruleObj));
+
+#ifdef RBA_USE_LOG
+ // Set expression type
+ const RBAExpressionType exprType {jsonElem->getExpressionType()};
+ objRef->setExpressionType(exprType);
+#endif
+
+ return objRef;
+}
+
+}
diff --git a/src/core/expression/RBAObjectReferenceMaker.hpp b/src/core/expression/RBAObjectReferenceMaker.hpp
new file mode 100644
index 0000000..ee58b92
--- /dev/null
+++ b/src/core/expression/RBAObjectReferenceMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAObjectReferenceMaker.hpp
+/// @brief ObjectReference object generator class header
+
+#ifndef RBAOBJECTREFERENCEMAKER_HPP
+#define RBAOBJECTREFERENCEMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ObjectReference object generator class header
+class DLL_EXPORT RBAObjectReferenceMaker : public RBAExpressionMaker
+{
+public:
+ explicit RBAObjectReferenceMaker(const std::string& label="ObjectReference");
+ RBAObjectReferenceMaker(const RBAObjectReferenceMaker&)=delete;
+ RBAObjectReferenceMaker(const RBAObjectReferenceMaker&&)=delete;
+ RBAObjectReferenceMaker& operator=(const RBAObjectReferenceMaker&)=delete;
+ RBAObjectReferenceMaker& operator=(const RBAObjectReferenceMaker&&)=delete;
+ virtual ~RBAObjectReferenceMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAOperator.cpp b/src/core/expression/RBAOperator.cpp
new file mode 100644
index 0000000..7d73f66
--- /dev/null
+++ b/src/core/expression/RBAOperator.cpp
@@ -0,0 +1,99 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Operator class definition
+ */
+
+#include "RBAOperator.hpp"
+#include "RBALogManager.hpp"
+
+namespace rba
+{
+
+const std::vector<RBAExpression*>&
+RBAOperator::getOperand() const
+{
+ return operand_;
+}
+
+void
+RBAOperator::addOperand(RBAExpression* const newExpr)
+{
+ if(newExpr != nullptr) {
+ operand_.push_back(newExpr);
+ }
+}
+
+RBAExpression*
+RBAOperator::getLhsOperand() const
+{
+ return operand_.front();
+}
+
+RBAExpression*
+RBAOperator::getRhsOperand() const
+{
+ return operand_.back();
+}
+
+const std::string
+RBAOperator::getPreMsg(const bool isPrevious) const
+{
+ if(isPrevious) {
+ return "(pre)";
+ }
+ else {
+ return "";
+ }
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAOperator::getSymbol() const
+{
+ return "";
+}
+
+void
+RBAOperator::createHierarchy()
+{
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(getSymbol());
+ RBALogManager::coverageHierarchyOfConstraintExpressionLog(getCoverageExpressionText(), this);
+
+ std::uint32_t oprSize{ static_cast<std::uint32_t>(getOperand().size()) };
+ if(oprSize == 1U) {
+ RBAExpression* expr = getLhsOperand();
+ expr->createHierarchy();
+ }
+ else {
+ std::uint32_t num{ 0U };
+ for(RBAExpression* expr : getOperand()) {
+ // Add count to Constraint hierarchy for coverage
+ LOG_addHierarchy("#" + std::to_string(num++));
+ expr->createHierarchy();
+ // Remove count from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ }
+ }
+
+ // Remove count from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAOperator.hpp b/src/core/expression/RBAOperator.hpp
new file mode 100644
index 0000000..5d645f2
--- /dev/null
+++ b/src/core/expression/RBAOperator.hpp
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Operator class header
+ */
+
+#ifndef RBAOPERATOR_HPP
+#define RBAOPERATOR_HPP
+
+#include <vector>
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAOperator : public RBAExpression
+{
+protected:
+ RBAOperator()=default;
+ RBAOperator(const RBAOperator&)=delete;
+ RBAOperator(const RBAOperator&&)=delete;
+ RBAOperator& operator=(const RBAOperator&)=delete;
+ RBAOperator& operator=(const RBAOperator&&)=delete;
+
+public:
+ const std::vector<RBAExpression*>& getOperand() const;
+ void addOperand(RBAExpression* const newExpr);
+ RBAExpression* getLhsOperand() const;
+ RBAExpression* getRhsOperand() const;
+
+ // Log
+#ifdef RBA_USE_LOG
+ virtual const std::string getSymbol() const;
+ void createHierarchy() override;
+#endif
+
+protected:
+ std::string const getPreMsg(const bool isPrevious) const;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::vector<RBAExpression*> operand_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAOperatorMaker.cpp b/src/core/expression/RBAOperatorMaker.cpp
new file mode 100644
index 0000000..7da2885
--- /dev/null
+++ b/src/core/expression/RBAOperatorMaker.cpp
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAOperatorMaker.cpp
+/// @brief Operator object generator abstract class
+
+#include "RBAOperatorMaker.hpp"
+#include "RBAOperator.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAOperatorMaker::RBAOperatorMaker(const std::string& label)
+ : RBAExpressionMaker{label}
+{
+}
+
+RBAModelElement*
+RBAOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ // Create expression
+ RBAOperator* const exprOpr {dynamic_cast<RBAOperator*>(element)};
+
+ // Set LetStatement
+ const auto pop_num = setLetStatement(model, exprOpr, jsonElem);
+
+ // Set operand
+ for(auto& param : jsonElem->findChildren("operand")->getChildren()) {
+ const auto expr = getFactory()->createElement(param->getClassName(), param.get());
+ exprOpr->addOperand(dynamic_cast<RBAExpression*>(expr));
+ }
+
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return exprOpr;
+}
+
+}
diff --git a/src/core/expression/RBAOperatorMaker.hpp b/src/core/expression/RBAOperatorMaker.hpp
new file mode 100644
index 0000000..681ff65
--- /dev/null
+++ b/src/core/expression/RBAOperatorMaker.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAOperatorMaker.hpp
+/// @brief Operator object generator abstract class header
+
+#ifndef RBAOPERATORMAKER_HPP
+#define RBAOPERATORMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Operator object generator abstract class
+class DLL_EXPORT RBAOperatorMaker : public RBAExpressionMaker
+{
+public:
+ explicit RBAOperatorMaker(const std::string& label="");
+ RBAOperatorMaker(const RBAOperatorMaker&)=delete;
+ RBAOperatorMaker(const RBAOperatorMaker&&)=delete;
+ RBAOperatorMaker& operator=(const RBAOperatorMaker&)=delete;
+ RBAOperatorMaker& operator=(const RBAOperatorMaker&&)=delete;
+ virtual ~RBAOperatorMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAOrOperator.cpp b/src/core/expression/RBAOrOperator.cpp
new file mode 100644
index 0000000..d55e4a0
--- /dev/null
+++ b/src/core/expression/RBAOrOperator.cpp
@@ -0,0 +1,100 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * OrOperator class definition
+ */
+
+#include "RBAOrOperator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void
+RBAOrOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAOrOperator::getModelElementType() const
+{
+ return RBAModelElementType::OrOperator;
+}
+
+bool
+RBAOrOperator::executeCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ bool isPassed {false};
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy(LOG_getSymbol());
+ std::uint32_t index {0U};
+ for (const RBAExpression* const ope : getOperand()) {
+ RBAConstraintInfo* const childInfo {info->getChild(index)};
+ // Add count to Constraint hierarchy for coverage
+ LOG_addHierarchy("#" + std::to_string(index));
+ const bool res {ope->execute(childInfo, arb)};
+ // Remove count from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ if (childInfo->isExceptionBeforeArbitrate() == true) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (res == true) {
+ isPassed = true;
+ } else {
+ ;
+ }
+ ++index;
+ }
+ if (isPassed == true) {
+ info->setExceptionBeforeArbitrate(false);
+ }
+#ifdef RBA_USE_LOG
+ if (info->isExceptionBeforeArbitrate() == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] before arbitrate skip");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::SKIP);
+ } else if (isPassed == true) {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] true");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::TRUE);
+ } else {
+ LOG_arbitrateConstraintLogicLogLine(
+ " [" + LOG_getExpressionText() + "] false");
+ LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(),
+ RBAExecuteResult::FALSE);
+ }
+#endif
+ // Remove count from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ return isPassed;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAOrOperator::getSymbol() const
+{
+ return "OR";
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAOrOperator.hpp b/src/core/expression/RBAOrOperator.hpp
new file mode 100644
index 0000000..a52aca4
--- /dev/null
+++ b/src/core/expression/RBAOrOperator.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * OrOperator class header
+ */
+
+#ifndef RBAOROPERATOR_HPP
+#define RBAOROPERATOR_HPP
+
+#include "RBALogicalOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAOrOperator : public RBALogicalOperator
+{
+ public:
+ RBAOrOperator()=default;
+ RBAOrOperator(const RBAOrOperator&)=delete;
+ RBAOrOperator(const RBAOrOperator&&)=delete;
+ RBAOrOperator& operator=(const RBAOrOperator&)=delete;
+ RBAOrOperator& operator=(const RBAOrOperator&&)=delete;
+ virtual ~RBAOrOperator()=default;
+
+ public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ bool executeCore(RBAConstraintInfo* info, RBAArbitrator * arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAOrOperatorMaker.cpp b/src/core/expression/RBAOrOperatorMaker.cpp
new file mode 100644
index 0000000..934c7e1
--- /dev/null
+++ b/src/core/expression/RBAOrOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAOrOperatorMaker.cpp
+/// @brief OrOperator object generator
+
+#include "RBAOrOperatorMaker.hpp"
+#include "RBAOrOperator.hpp"
+
+namespace rba
+{
+
+RBAOrOperatorMaker::RBAOrOperatorMaker()
+ : RBAOperatorMaker{"OrOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAOrOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAOrOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAOrOperatorMaker.hpp b/src/core/expression/RBAOrOperatorMaker.hpp
new file mode 100644
index 0000000..def4d8f
--- /dev/null
+++ b/src/core/expression/RBAOrOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAOrOperatorMaker.hpp
+/// @brief OrOperator object generator class header
+
+#ifndef RBAOROPERATORMAKER_HPP
+#define RBAOROPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief OrOperator object generator class
+class RBAOrOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAOrOperatorMaker();
+ RBAOrOperatorMaker(const RBAOrOperatorMaker&)=delete;
+ RBAOrOperatorMaker(const RBAOrOperatorMaker&&)=delete;
+ RBAOrOperatorMaker& operator=(const RBAOrOperatorMaker&)=delete;
+ RBAOrOperatorMaker& operator=(const RBAOrOperatorMaker&&)=delete;
+ virtual ~RBAOrOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAPlusOperator.cpp b/src/core/expression/RBAPlusOperator.cpp
new file mode 100644
index 0000000..8a6dbbb
--- /dev/null
+++ b/src/core/expression/RBAPlusOperator.cpp
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PlusOperator class definition
+ */
+
+#include "RBAPlusOperator.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+RBAModelElementType
+RBAPlusOperator::getModelElementType() const
+{
+ return RBAModelElementType::PlusOperator;
+}
+
+}
diff --git a/src/core/expression/RBAPlusOperator.hpp b/src/core/expression/RBAPlusOperator.hpp
new file mode 100644
index 0000000..ab04ebb
--- /dev/null
+++ b/src/core/expression/RBAPlusOperator.hpp
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PlusOperator class header
+ */
+
+#ifndef RBAPLUSOPERATOR_HPP
+#define RBAPLUSOPERATOR_HPP
+
+#include "RBAArithmeticOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAPlusOperator : public RBAArithmeticOperator
+{
+public:
+ RBAPlusOperator()=default;
+ RBAPlusOperator(const RBAPlusOperator&)=delete;
+ RBAPlusOperator(const RBAPlusOperator&&)=delete;
+ RBAPlusOperator& operator=(const RBAPlusOperator&)=delete;
+ RBAPlusOperator& operator=(const RBAPlusOperator&&)=delete;
+ virtual ~RBAPlusOperator()=default;
+
+public:
+ RBAModelElementType getModelElementType() const override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAPlusOperatorMaker.cpp b/src/core/expression/RBAPlusOperatorMaker.cpp
new file mode 100644
index 0000000..677d456
--- /dev/null
+++ b/src/core/expression/RBAPlusOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAPlusOperatorsMaker.cpp
+/// @brief PlusOperator object generator class definition
+
+#include "RBAPlusOperatorMaker.hpp"
+#include "RBAPlusOperator.hpp"
+
+namespace rba
+{
+
+RBAPlusOperatorMaker::RBAPlusOperatorMaker()
+ : RBAOperatorMaker{"PlusOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAPlusOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAPlusOperator>();
+}
+
+}
diff --git a/src/core/expression/RBAPlusOperatorMaker.hpp b/src/core/expression/RBAPlusOperatorMaker.hpp
new file mode 100644
index 0000000..aea1df7
--- /dev/null
+++ b/src/core/expression/RBAPlusOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAPlusOperatorsMaker.hpp
+/// @brief PlusOperator object generator class header
+
+#ifndef RBAPLUSOPERATORMAKER_HPP
+#define RBAPLUSOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief PlusOperator object generator class
+class RBAPlusOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBAPlusOperatorMaker();
+ RBAPlusOperatorMaker(const RBAPlusOperatorMaker&)=delete;
+ RBAPlusOperatorMaker(const RBAPlusOperatorMaker&&)=delete;
+ RBAPlusOperatorMaker& operator=(const RBAPlusOperatorMaker&)=delete;
+ RBAPlusOperatorMaker& operator=(const RBAPlusOperatorMaker&&)=delete;
+ virtual ~RBAPlusOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAPreviousModifier.cpp b/src/core/expression/RBAPreviousModifier.cpp
new file mode 100644
index 0000000..53a7112
--- /dev/null
+++ b/src/core/expression/RBAPreviousModifier.cpp
@@ -0,0 +1,97 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PreviousModifier class definition
+ */
+
+#include "RBAPreviousModifier.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAPreviousObjectWrapper.hpp"
+
+namespace rba
+{
+
+RBAPreviousModifier::RBAPreviousModifier()
+ : RBAExpression(),
+ previousObj_{std::make_unique<RBAPreviousObjectWrapper>()}
+{
+}
+
+void
+RBAPreviousModifier::accept(RBAExpressionVisitor& visitor)
+{
+ // RBASceneAllocatableCollector,
+ // which is the only vistor that exists at the moment,
+ // does not pass this path because it does not accept the rule object.
+ // In the future, another visitor may accept, so implement this.
+ visitor.visit(*this);
+}
+
+void
+RBAPreviousModifier::setObjReference(RBAExpression* const newObjRef)
+{
+ objReference_ = newObjRef;
+}
+
+RBAExpression* const
+RBAPreviousModifier::getObjReference() const
+{
+ return objReference_;
+}
+
+const RBARuleObject*
+RBAPreviousModifier::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ previousObj_->setRefObject(objReference_->getReferenceObject(info, arb));
+ return previousObj_.get();
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAPreviousModifier::getSymbol() const
+{
+ return "(pre)";
+}
+
+void
+RBAPreviousModifier::createHierarchy()
+{
+ objReference_->createHierarchy();
+}
+
+const std::string
+RBAPreviousModifier::getExpressionText() const
+{
+ return getSymbol() + objReference_->getExpressionText();
+}
+
+const std::string
+RBAPreviousModifier::getCoverageExpressionText() const
+{
+ return getSymbol() + objReference_->getCoverageExpressionText();
+}
+
+RBAExpressionType
+RBAPreviousModifier::getUnderlyingType() const
+{
+ return objReference_->getUnderlyingType();
+}
+
+#endif
+
+}
diff --git a/src/core/expression/RBAPreviousModifier.hpp b/src/core/expression/RBAPreviousModifier.hpp
new file mode 100644
index 0000000..ff34deb
--- /dev/null
+++ b/src/core/expression/RBAPreviousModifier.hpp
@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PreviousModifier class header
+ */
+
+
+#ifndef RBAPREVIOUSMODIFIER_HPP
+#define RBAPREVIOUSMODIFIER_HPP
+
+#include <memory>
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class RBAPreviousObjectWrapper;
+
+class DLL_EXPORT RBAPreviousModifier : public RBAExpression
+{
+public:
+ RBAPreviousModifier();
+ RBAPreviousModifier(const RBAPreviousModifier&)=delete;
+ RBAPreviousModifier(const RBAPreviousModifier&&)=delete;
+ RBAPreviousModifier& operator=(const RBAPreviousModifier&)=delete;
+ RBAPreviousModifier& operator=(const RBAPreviousModifier&&)=delete;
+ virtual ~RBAPreviousModifier()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ void setObjReference(RBAExpression* const newObjRef);
+ RBAExpression* const getObjReference() const;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ virtual const std::string getSymbol() const;
+ void createHierarchy() override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+private:
+ // This pointer is not "const" in order to call
+ // objReference_->getReferenceObject()
+ RBAExpression* objReference_;
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::unique_ptr<RBAPreviousObjectWrapper> previousObj_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAPreviousModifierMaker.cpp b/src/core/expression/RBAPreviousModifierMaker.cpp
new file mode 100644
index 0000000..764ef34
--- /dev/null
+++ b/src/core/expression/RBAPreviousModifierMaker.cpp
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAPreviousModifierMaker.cpp
+/// @brief PreviousModifier object generator class definition
+
+#include "RBAPreviousModifierMaker.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAPreviousModifier.hpp"
+#include "RBAPreviousObjectWrapper.hpp"
+
+namespace rba
+{
+
+RBAPreviousModifierMaker::RBAPreviousModifierMaker()
+ : RBAExpressionMaker{"PreviousModifier"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAPreviousModifierMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAPreviousModifier>();
+}
+
+RBAModelElement*
+RBAPreviousModifierMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ RBAPreviousModifier* const prevMod {dynamic_cast<RBAPreviousModifier*>(element)};
+
+ // Set LetStatement
+ const std::int32_t pop_num {setLetStatement(model, prevMod, jsonElem)};
+
+ // Set object reference
+ const RBAJsonElement* const objRefElem {jsonElem->findChildren("objReference")};
+ RBAModelElement* const expr {getFactory()->createElement(objRefElem->getClassName(),
+ objRefElem)};
+ prevMod->setObjReference(dynamic_cast<RBAExpression*>(expr));
+
+ // Pop variable
+ for(std::int32_t i{0}; i<pop_num; i++) {
+ getFactory()->popVariable();
+ }
+
+ return prevMod;
+}
+
+}
diff --git a/src/core/expression/RBAPreviousModifierMaker.hpp b/src/core/expression/RBAPreviousModifierMaker.hpp
new file mode 100644
index 0000000..0f58892
--- /dev/null
+++ b/src/core/expression/RBAPreviousModifierMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAPreviousModifierMaker.cpp
+/// @brief PreviousModifier object generator class header
+
+#ifndef RBAPREVIOUSMODIFIERMAKER_HPP
+#define RBAPREVIOUSMODIFIERMAKER_HPP
+
+#include "RBAExpressionMaker.hpp"
+
+namespace rba
+{
+
+/// @brief PreviousModifier object generator class
+class RBAPreviousModifierMaker : public RBAExpressionMaker
+{
+public:
+ RBAPreviousModifierMaker();
+ RBAPreviousModifierMaker(const RBAPreviousModifierMaker&)=delete;
+ RBAPreviousModifierMaker(const RBAPreviousModifierMaker&&)=delete;
+ RBAPreviousModifierMaker& operator=(const RBAPreviousModifierMaker&)=delete;
+ RBAPreviousModifierMaker& operator=(const RBAPreviousModifierMaker&&)=delete;
+ virtual ~RBAPreviousModifierMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAPreviousObjectWrapper.cpp b/src/core/expression/RBAPreviousObjectWrapper.cpp
new file mode 100644
index 0000000..348b05f
--- /dev/null
+++ b/src/core/expression/RBAPreviousObjectWrapper.cpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PreviousObjectWrapper (Previous Wrapper of RuleObject)
+ * generator class definition
+ */
+
+#include "RBAPreviousObjectWrapper.hpp"
+
+namespace rba
+{
+
+bool
+RBAPreviousObjectWrapper::isPrevious() const
+{
+ return true;
+}
+
+const RBARuleObject*
+RBAPreviousObjectWrapper::getRawObject() const
+{
+ return refObject_->getRawObject();
+}
+
+void
+RBAPreviousObjectWrapper::setRefObject(const RBARuleObject* const obj)
+{
+ refObject_ = obj;
+}
+
+}
diff --git a/src/core/expression/RBAPreviousObjectWrapper.hpp b/src/core/expression/RBAPreviousObjectWrapper.hpp
new file mode 100644
index 0000000..571c450
--- /dev/null
+++ b/src/core/expression/RBAPreviousObjectWrapper.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PreviousObjectWrapper (Previous Wrapper of RuleObject)
+ * generator class header
+ */
+
+#ifndef RBAPREVIOUSOBJECTWRAPPER_HPP
+#define RBAPREVIOUSOBJECTWRAPPER_HPP
+
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAPreviousObjectWrapper : public RBARuleObject
+{
+public:
+ RBAPreviousObjectWrapper()=default;
+ RBAPreviousObjectWrapper(const RBAPreviousObjectWrapper&)=delete;
+ RBAPreviousObjectWrapper(const RBAPreviousObjectWrapper&&)=delete;
+ RBAPreviousObjectWrapper& operator=(const RBAPreviousObjectWrapper&)=delete;
+ RBAPreviousObjectWrapper& operator=(const RBAPreviousObjectWrapper&&)=delete;
+ virtual ~RBAPreviousObjectWrapper()=default;
+
+public:
+ bool isPrevious() const override;
+ const RBARuleObject* getRawObject() const override;
+ void setRefObject(const RBARuleObject* const obj);
+
+private:
+ const RBARuleObject* refObject_ {nullptr};
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAPropertyOperator.hpp b/src/core/expression/RBAPropertyOperator.hpp
new file mode 100644
index 0000000..250e6a2
--- /dev/null
+++ b/src/core/expression/RBAPropertyOperator.hpp
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * PropertyOperator class definition
+ */
+
+#ifndef RBAPROPERTYOPERATOR_HPP
+#define RBAPROPERTYOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAPropertyOperator : public RBAOperator
+{
+protected:
+ RBAPropertyOperator()=default;
+ RBAPropertyOperator(const RBAPropertyOperator&)=delete;
+ RBAPropertyOperator(const RBAPropertyOperator&&)=delete;
+ RBAPropertyOperator& operator=(const RBAPropertyOperator&)=delete;
+ RBAPropertyOperator& operator=(const RBAPropertyOperator&&)=delete;
+
+public:
+ virtual ~RBAPropertyOperator()=default;
+
+};
+
+}
+
+#endif
+ \ No newline at end of file
diff --git a/src/core/expression/RBASceneCondition.hpp b/src/core/expression/RBASceneCondition.hpp
new file mode 100644
index 0000000..44f543c
--- /dev/null
+++ b/src/core/expression/RBASceneCondition.hpp
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SceneCondition class header
+ */
+
+#ifndef RBASCENECONDITION_HPP
+#define RBASCENECONDITION_HPP
+
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBASceneCondition : public RBAExpression
+{
+protected:
+ RBASceneCondition()=default;
+ RBASceneCondition(const RBASceneCondition&)=delete;
+ RBASceneCondition(const RBASceneCondition&&)=delete;
+ RBASceneCondition& operator=(const RBASceneCondition&)=delete;
+ RBASceneCondition& operator=(const RBASceneCondition&&)=delete;
+public:
+ virtual ~RBASceneCondition()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASceneOperator.hpp b/src/core/expression/RBASceneOperator.hpp
new file mode 100644
index 0000000..630c655
--- /dev/null
+++ b/src/core/expression/RBASceneOperator.hpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SceneOperator class header
+ */
+
+#ifndef RBASCENEOPERATOR_HPP
+#define RBASCENEOPERATOR_HPP
+
+#include "RBADllExport.hpp"
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBASceneOperator : public RBAOperator
+{
+protected:
+ RBASceneOperator()=default;
+ RBASceneOperator(const RBASceneOperator&)=delete;
+ RBASceneOperator(const RBASceneOperator&&)=delete;
+ RBASceneOperator& operator=(const RBASceneOperator&)=delete;
+ RBASceneOperator& operator=(const RBASceneOperator&&)=delete;
+public:
+ ~RBASceneOperator()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASelectOperator.cpp b/src/core/expression/RBASelectOperator.cpp
new file mode 100644
index 0000000..be74fa5
--- /dev/null
+++ b/src/core/expression/RBASelectOperator.cpp
@@ -0,0 +1,140 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SelectOperator class definition
+ */
+
+#include <memory>
+#include "RBASelectOperator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALambdaExpression.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+RBASelectOperator::RBASelectOperator()
+: RBALambdaContext(),
+ allocatableSet_{std::make_unique<RBAAllocatableSet>()},
+ contentSet_{std::make_unique<RBAContentSet>()}
+{
+}
+
+void
+RBASelectOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBASelectOperator::getModelElementType() const
+{
+ return RBAModelElementType::SelectOperator;
+}
+
+const RBARuleObject* RBASelectOperator::getReferenceObjectCore(
+ RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ LOG_addHierarchy(LOG_getSymbol());
+ const RBARuleObject* returnObj {nullptr};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const lhsObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (lhsObj != nullptr) {
+ if (dynamic_cast<const RBAAllocatableSet*>(lhsObj) != nullptr) {
+ std::list<const RBAAllocatable*> objs {
+ dynamic_cast<const RBAAllocatableSet*>(lhsObj)->getLeafAllocatable()};
+ allocatableSet_->clear();
+ std::uint32_t i {0U};
+ RBALambdaExpression* const lambda {getLambda()};
+ for (auto& obj : objs) {
+ LOG_addHierarchy("#" + std::to_string(i));
+ ++i;
+ RBAConstraintInfo* const childInfo {info->getChild(i)};
+ lambda->setRuleObj(obj);
+ const bool isPassed {lambda->execute(childInfo, arb)};
+ LOG_removeHierarchy();
+ if (isPassed && (!childInfo->isExceptionBeforeArbitrate())) {
+ allocatableSet_->addTarget(obj);
+ }
+ }
+ returnObj = allocatableSet_.get();
+ } else {
+ std::list<const RBAContent*> objs {
+ dynamic_cast<const RBAContentSet*>(lhsObj)->getLeafContent()};
+ contentSet_->clear();
+ std::uint32_t i {0U};
+ RBALambdaExpression* const lambda {getLambda()};
+ for (auto& obj : objs) {
+ LOG_addHierarchy("#" + std::to_string(i));
+ ++i;
+ RBAConstraintInfo* const childInfo {info->getChild(i)};
+ lambda->setRuleObj(obj);
+ const bool isPassed {lambda->execute(childInfo, arb)};
+ LOG_removeHierarchy();
+ if (isPassed && (!childInfo->isExceptionBeforeArbitrate())) {
+ contentSet_->addTarget(obj);
+ }
+ }
+ returnObj = contentSet_.get();
+ }
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ std::string objName = "NULL";
+ if (returnObj != nullptr) {
+ objName = returnObj->getElementName();
+ if (objName == "") {
+ objName = returnObj->getDynamicName();
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + LOG_getExpressionText() + " is " + objName);
+#endif
+ LOG_removeHierarchy();
+ return returnObj;
+}
+#ifdef RBA_USE_LOG
+const std::string RBASelectOperator::getSymbol() const
+{
+ return ".select";
+}
+
+const std::string RBASelectOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol()
+ + getLambda()->getExpressionText();
+}
+
+const std::string RBASelectOperator::getCoverageExpressionText() const
+{
+ getLambda()->clearRuleObj();
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol()
+ + getLambda()->getCoverageExpressionText();
+}
+#endif
+
+} // namespace rba
diff --git a/src/core/expression/RBASelectOperator.hpp b/src/core/expression/RBASelectOperator.hpp
new file mode 100644
index 0000000..9c85fb0
--- /dev/null
+++ b/src/core/expression/RBASelectOperator.hpp
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SelectOperator class header
+ */
+
+#ifndef RBASELECTOPERATOR_HPP
+#define RBASELECTOPERATOR_HPP
+
+#include "RBALambdaContext.hpp"
+
+namespace rba
+{
+
+class RBAAllocatableSet;
+class RBAContentSet;
+
+class RBASelectOperator : public RBALambdaContext
+{
+ public:
+ RBASelectOperator();
+ RBASelectOperator(const RBASelectOperator&)=delete;
+ RBASelectOperator(const RBASelectOperator&&)=delete;
+ RBASelectOperator& operator=(const RBASelectOperator&)=delete;
+ RBASelectOperator& operator=(const RBASelectOperator&&)=delete;
+ virtual ~RBASelectOperator()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+ private:
+ std::unique_ptr<RBAAllocatableSet> allocatableSet_;
+ std::unique_ptr<RBAContentSet> contentSet_;
+};
+
+} /* namespace rba */
+
+#endif /* RBASELECTOPERATOR_HPP */
diff --git a/src/core/expression/RBASelectOperatorMaker.cpp b/src/core/expression/RBASelectOperatorMaker.cpp
new file mode 100644
index 0000000..d7c1a35
--- /dev/null
+++ b/src/core/expression/RBASelectOperatorMaker.cpp
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBASelectOperatorMaker.cpp
+/// @brief SelectOperator object generator class definition
+
+#include "RBASelectOperatorMaker.hpp"
+#include "RBASelectOperator.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBALambdaExpression.hpp"
+
+namespace rba
+{
+
+RBASelectOperatorMaker::RBASelectOperatorMaker()
+ : RBALambdaContextMaker{"SelectOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBASelectOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBASelectOperator>();
+}
+
+RBAModelElement*
+RBASelectOperatorMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(
+ RBALambdaContextMaker::setProperty(element, jsonElem, model, owner));
+
+ return element;
+}
+
+std::unique_ptr<RBALambdaContext>
+RBASelectOperatorMaker::createLambdaContext()
+{
+ return std::make_unique<RBASelectOperator>();
+}
+
+}
diff --git a/src/core/expression/RBASelectOperatorMaker.hpp b/src/core/expression/RBASelectOperatorMaker.hpp
new file mode 100644
index 0000000..0415331
--- /dev/null
+++ b/src/core/expression/RBASelectOperatorMaker.hpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBASelectOperatorMaker.cpp
+/// @brief SelectOperator object generator class header
+
+#ifndef RBASELECTOPERATORMAKER_HPP
+#define RBASELECTOPERATORMAKER_HPP
+
+#include "RBALambdaContextMaker.hpp"
+
+namespace rba
+{
+
+/// @brief SelectOperator object generator class
+class RBASelectOperatorMaker : public RBALambdaContextMaker
+{
+public:
+ RBASelectOperatorMaker();
+ RBASelectOperatorMaker(const RBASelectOperatorMaker&)=delete;
+ RBASelectOperatorMaker(const RBASelectOperatorMaker&&)=delete;
+ RBASelectOperatorMaker& operator=(const RBASelectOperatorMaker&)=delete;
+ RBASelectOperatorMaker& operator=(const RBASelectOperatorMaker&&)=delete;
+ virtual ~RBASelectOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated object
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner) override;
+
+ /// @brief generate an empty object of LambdaContext
+ /// @details generate an empty object of unique_ptr
+ /// @return unique_ptr for object of LambdaContext
+ std::unique_ptr<RBALambdaContext> createLambdaContext() override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASetExpression.hpp b/src/core/expression/RBASetExpression.hpp
new file mode 100644
index 0000000..5ad1de4
--- /dev/null
+++ b/src/core/expression/RBASetExpression.hpp
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SetExpression class header
+ */
+
+#ifndef RBASETEXPRESSION_HPP
+#define RBASETEXPRESSION_HPP
+
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBASetExpression : public RBAExpression
+{
+protected:
+ RBASetExpression()=default;
+ RBASetExpression(const RBASetExpression&)=delete;
+ RBASetExpression(const RBASetExpression&&)=delete;
+ RBASetExpression& operator=(const RBASetExpression&)=delete;
+ RBASetExpression& operator=(const RBASetExpression&&)=delete;
+public:
+ virtual ~RBASetExpression()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASetOfOperator.cpp b/src/core/expression/RBASetOfOperator.cpp
new file mode 100644
index 0000000..03e82eb
--- /dev/null
+++ b/src/core/expression/RBASetOfOperator.cpp
@@ -0,0 +1,194 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBASetOfOperator class definition
+ */
+
+#include <sstream>
+#include "RBASetOfOperator.hpp"
+#include "RBARuleObject.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAContent.hpp"
+#include "RBALogManager.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+RBASetOfOperator::RBASetOfOperator()
+ : RBAOperator(),
+ allocatableSet_{std::make_unique<RBAAllocatableSet>()},
+ contentSet_{std::make_unique<RBAContentSet>()}
+{
+}
+
+void
+RBASetOfOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBASetOfOperator::getModelElementType() const
+{
+ return RBAModelElementType::SetOfOperator;
+}
+
+const RBARuleObject*
+RBASetOfOperator::getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ allocatableSet_->clear();
+ contentSet_->clear();
+
+ bool isAllocatableSet {false};
+ bool isContentSet {false};
+
+ std::uint32_t i {0U};
+ for(const RBAExpression* const expr : getOperand()) {
+ RBAConstraintInfo* const childInfo {info->getChild(i)};
+ const RBARuleObject* const obj {expr->getReferenceObject(childInfo,arb)};
+ if(childInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ return nullptr;
+ }
+ if(obj != nullptr) {
+ if (obj->isModelElementType(RBAModelElementType::Area) ||
+ obj->isModelElementType(RBAModelElementType::Zone)) {
+ allocatableSet_->addTarget(dynamic_cast<const RBAAllocatable*>(obj));
+ isAllocatableSet = true;
+ }
+ else if (obj->isModelElementType(RBAModelElementType::ViewContent) ||
+ obj->isModelElementType(RBAModelElementType::SoundContent)) {
+ contentSet_->addTarget(dynamic_cast<const RBAContent*>(obj));
+ isContentSet = true;
+ }
+ else if (dynamic_cast<const RBAAllocatableSet*>(obj) != nullptr) {
+ for (const RBAAllocatable* const a : dynamic_cast<const RBAAllocatableSet*>(obj)->getLeafAllocatable()) {
+ allocatableSet_->addTarget(a);
+ }
+ isAllocatableSet = true;
+ } else {
+ for (const RBAContent* const c : dynamic_cast<const RBAContentSet*>(obj)->getLeafContent()) {
+ contentSet_->addTarget(c);
+ }
+ isContentSet = true;
+ }
+ }
+ i++;
+ }
+ if (isAllocatableSet) {
+ return allocatableSet_.get();
+ } else if (isContentSet){
+ return contentSet_.get();
+ } else {
+ return nullptr;
+ }
+}
+
+void
+RBASetOfOperator::doActionCore(RBAConstraintInfo* info, RBAArbitrator* arb)
+{
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy("SetOf");
+
+ std::uint32_t i {0U};
+ for(RBAExpression* const expr : getOperand()) {
+ // Add number of element to Constraint hierarchy for coverage
+ LOG_addHierarchy("#" + std::to_string(i) + ":");
+
+ // Since it should only execute Action, info is as it is
+ expr->doAction(info, arb);
+ i++;
+
+ // Remove number of element from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ }
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+
+ return;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBASetOfOperator::getExpressionText() const
+{
+ std::ostringstream oss;
+ oss << "{";
+ const auto& exprList = getOperand();
+ const auto& lastExpr = exprList.back();
+ for (const auto& expr : exprList) {
+ oss << expr->getExpressionText();
+ if (expr != lastExpr) {
+ oss << ", ";
+ }
+ }
+ oss << "}";
+
+ return oss.str();
+}
+
+const std::string
+RBASetOfOperator::getCoverageExpressionText() const
+{
+ std::ostringstream oss;
+ oss << "{";
+ const auto& exprList = getOperand();
+ const auto& lastExpr = exprList.back();
+ for (const auto& expr : exprList) {
+ oss << expr->getCoverageExpressionText();
+ if (expr != lastExpr) {
+ oss << ", ";
+ }
+ }
+ oss << "}";
+
+ return oss.str();
+}
+
+void
+RBASetOfOperator::createHierarchy()
+{
+ // Add itself to Constraint hierarchy for coverage
+ LOG_addHierarchy("SetOf");
+ RBALogManager::coverageHierarchyOfConstraintExpressionLog(getCoverageExpressionText(), this);
+ uint32_t idx=0;
+ for(RBAExpression* expr : getOperand()) {
+ // Add number of element to Constraint hierarchy for coverage
+ LOG_addHierarchy("#"+std::to_string(idx)+":");
+ expr->createHierarchy();
+ // Remove number of element from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+ idx++;
+ }
+ // Remove itself from Constraint hierarchy for coverage
+ LOG_removeHierarchy();
+}
+
+RBAExpressionType
+RBASetOfOperator::getUnderlyingType() const
+{
+ return getLhsOperand()->getUnderlyingType();
+}
+#endif
+
+}
diff --git a/src/core/expression/RBASetOfOperator.hpp b/src/core/expression/RBASetOfOperator.hpp
new file mode 100644
index 0000000..d73e1f7
--- /dev/null
+++ b/src/core/expression/RBASetOfOperator.hpp
@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBASetOfOperator class header
+ */
+
+#ifndef RBASETOFOPERATOR_HPP
+#define RBASETOFOPERATOR_HPP
+
+#include <memory>
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class RBAAllocatableSet;
+class RBAContentSet;
+
+class DLL_EXPORT RBASetOfOperator : public RBAOperator
+{
+public:
+ RBASetOfOperator();
+ RBASetOfOperator(const RBASetOfOperator&)=delete;
+ RBASetOfOperator(const RBASetOfOperator&&)=delete;
+ RBASetOfOperator& operator=(const RBASetOfOperator&)=delete;
+ RBASetOfOperator& operator=(const RBASetOfOperator&&)=delete;
+ virtual ~RBASetOfOperator()=default;
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+ void createHierarchy() override;
+ RBAExpressionType getUnderlyingType() const override;
+#endif
+
+protected:
+ const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+ void doActionCore(RBAConstraintInfo* info, RBAArbitrator* arb) override;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::unique_ptr<RBAAllocatableSet> allocatableSet_;
+ std::unique_ptr<RBAContentSet> contentSet_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASetOfOperatorMaker.cpp b/src/core/expression/RBASetOfOperatorMaker.cpp
new file mode 100644
index 0000000..f17f17d
--- /dev/null
+++ b/src/core/expression/RBASetOfOperatorMaker.cpp
@@ -0,0 +1,39 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBASetOfOperatorMaker.cpp
+/// @brief SetOfOperator object generator class
+
+#include "RBASetOfOperatorMaker.hpp"
+#include "RBASetOfOperator.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAContentSet.hpp"
+
+namespace rba
+{
+
+RBASetOfOperatorMaker::RBASetOfOperatorMaker()
+ : RBAOperatorMaker{"SetOfOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBASetOfOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBASetOfOperator>();
+}
+
+}
diff --git a/src/core/expression/RBASetOfOperatorMaker.hpp b/src/core/expression/RBASetOfOperatorMaker.hpp
new file mode 100644
index 0000000..87905fa
--- /dev/null
+++ b/src/core/expression/RBASetOfOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBASetOfOperatorMaker.cpp
+/// @brief SetOfOperator object generator class header
+
+#ifndef RBASETOFOPERATORMAKER_HPP
+#define RBASETOFOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief SetOfOperator object generator class
+class RBASetOfOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBASetOfOperatorMaker();
+ RBASetOfOperatorMaker(const RBASetOfOperatorMaker&)=delete;
+ RBASetOfOperatorMaker(const RBASetOfOperatorMaker&&)=delete;
+ RBASetOfOperatorMaker& operator=(const RBASetOfOperatorMaker&)=delete;
+ RBASetOfOperatorMaker& operator=(const RBASetOfOperatorMaker&&)=delete;
+ virtual ~RBASetOfOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASetOperator.hpp b/src/core/expression/RBASetOperator.hpp
new file mode 100644
index 0000000..ded7a16
--- /dev/null
+++ b/src/core/expression/RBASetOperator.hpp
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * SetOperator class header
+ */
+
+#ifndef RBASETOPERATOR_HPP
+#define RBASETOPERATOR_HPP
+
+#include "RBAOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBASetOperator : public RBAOperator
+{
+protected:
+ RBASetOperator()=default;
+ RBASetOperator(const RBASetOperator&)=delete;
+ RBASetOperator(const RBASetOperator&&)=delete;
+ RBASetOperator& operator=(const RBASetOperator&)=delete;
+ RBASetOperator& operator=(const RBASetOperator&&)=delete;
+public:
+ virtual ~RBASetOperator()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBASizeOperator.cpp b/src/core/expression/RBASizeOperator.cpp
new file mode 100644
index 0000000..c928bcf
--- /dev/null
+++ b/src/core/expression/RBASizeOperator.cpp
@@ -0,0 +1,84 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// SizeOperator class definition
+//
+
+#include "RBASizeOperator.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBALogManager.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+void RBASizeOperator::accept(RBAExpressionVisitor& visitor)
+{
+ visitor.visit(*this);
+}
+RBAModelElementType RBASizeOperator::getModelElementType() const
+{
+ return RBAModelElementType::SizeOperator;
+}
+std::int32_t RBASizeOperator::getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const
+{
+ LOG_addHierarchy(LOG_getSymbol());
+ std::int32_t returnValue {-99};
+ RBAConstraintInfo* const leftInfo {info->getChild(0U)};
+ const RBARuleObject* const lhsObj {getLhsOperand()->getReferenceObject(leftInfo,
+ arb)};
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else if (lhsObj != nullptr) {
+ if (dynamic_cast<const RBAAllocatableSet*>(lhsObj) != nullptr) {
+ returnValue = static_cast<std::int32_t>(dynamic_cast<const RBAAllocatableSet*>(lhsObj)
+ ->getLeafAllocatable().size());
+ } else {
+ returnValue = static_cast<std::int32_t>(dynamic_cast<const RBAContentSet*>(lhsObj)->getLeafContent()
+ .size());
+ }
+ } else {
+ ;
+ }
+#ifdef RBA_USE_LOG
+ LOG_arbitrateConstraintLogicLogLine(
+ " " + LOG_getExpressionText() + " is " + std::to_string(returnValue));
+#endif
+ LOG_removeHierarchy();
+ return returnValue;
+}
+
+#ifdef RBA_USE_LOG
+const std::string RBASizeOperator::getSymbol() const
+{
+ return ".size()";
+}
+const std::string RBASizeOperator::getExpressionText() const
+{
+ return getLhsOperand()->getExpressionText() + getSymbol();
+}
+const std::string RBASizeOperator::getCoverageExpressionText() const
+{
+ return getLhsOperand()->getCoverageExpressionText() + getSymbol();
+}
+#endif
+
+} /* namespace rba */
diff --git a/src/core/expression/RBASizeOperator.hpp b/src/core/expression/RBASizeOperator.hpp
new file mode 100644
index 0000000..26f22fa
--- /dev/null
+++ b/src/core/expression/RBASizeOperator.hpp
@@ -0,0 +1,51 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// SizeOperator class header
+//
+
+#ifndef RBASIZEOPERATOR_HPP
+#define RBASIZEOPERATOR_HPP
+
+#include "RBASetOperator.hpp"
+
+namespace rba
+{
+
+class RBASizeOperator : public RBASetOperator
+{
+ public:
+ RBASizeOperator()=default;
+ RBASizeOperator(const RBASizeOperator&)=delete;
+ RBASizeOperator(const RBASizeOperator&&)=delete;
+ RBASizeOperator& operator=(const RBASizeOperator&)=delete;
+ RBASizeOperator& operator=(const RBASizeOperator&&)=delete;
+ virtual ~RBASizeOperator()=default;
+
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info, RBAArbitrator* arb) const override;
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+ const std::string getExpressionText() const override;
+ const std::string getCoverageExpressionText() const override;
+#endif
+};
+
+} /* namespace rba */
+
+#endif /* SRC_CORE_EXPRESSION_RBASIZEOPERATOR_HPP_ */
diff --git a/src/core/expression/RBASizeOperatorMaker.cpp b/src/core/expression/RBASizeOperatorMaker.cpp
new file mode 100644
index 0000000..2a905c7
--- /dev/null
+++ b/src/core/expression/RBASizeOperatorMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBASizeOperatorMaker.cpp
+/// @brief SizeOperator object generator class definition
+
+#include "RBASizeOperatorMaker.hpp"
+#include "RBASizeOperator.hpp"
+
+namespace rba
+{
+
+RBASizeOperatorMaker::RBASizeOperatorMaker()
+ : RBAOperatorMaker{"SizeOperator"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBASizeOperatorMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBASizeOperator>();
+}
+
+}
diff --git a/src/core/expression/RBASizeOperatorMaker.hpp b/src/core/expression/RBASizeOperatorMaker.hpp
new file mode 100644
index 0000000..b5dd0f6
--- /dev/null
+++ b/src/core/expression/RBASizeOperatorMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBASizeOperatorMaker.hpp
+/// @brief SizeOperator object generator abstract class header
+
+#ifndef RBASIZEOPERATORMAKER_HPP
+#define RBASIZEOPERATORMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief SizeOperator object generator class
+class RBASizeOperatorMaker : public RBAOperatorMaker
+{
+public:
+ RBASizeOperatorMaker();
+ RBASizeOperatorMaker(const RBASizeOperatorMaker&)=delete;
+ RBASizeOperatorMaker(const RBASizeOperatorMaker&&)=delete;
+ RBASizeOperatorMaker& operator=(const RBASizeOperatorMaker&)=delete;
+ RBASizeOperatorMaker& operator=(const RBASizeOperatorMaker&&)=delete;
+ virtual ~RBASizeOperatorMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAStateValue.cpp b/src/core/expression/RBAStateValue.cpp
new file mode 100644
index 0000000..f2fe5cb
--- /dev/null
+++ b/src/core/expression/RBAStateValue.cpp
@@ -0,0 +1,107 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// StateValue class denition
+
+#include <string>
+#include "RBAStateValue.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentState.hpp"
+#include "RBAExpressionVisitor.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void RBAStateValue::accept(RBAExpressionVisitor& visitor)
+{
+ // RBASceneAllocatableCollector which is the only existing vistor
+ // does not pass this path because it does not accept
+ // the expression that returns Value. But, in the future,
+ // another visitor may accept, so implement this.
+ visitor.visit(*this);
+}
+
+RBAModelElementType
+RBAStateValue::getModelElementType() const
+{
+ return RBAModelElementType::StateValue;
+}
+
+std::int32_t
+RBAStateValue::getValueCore(RBAConstraintInfo* info, RBAArbitrator* arb) const
+{
+ std::int32_t result { -99 };
+ const auto leftInfo = info->getChild(0U);
+ const auto r = getLhsOperand()->getReferenceObject(leftInfo, arb);
+ const RBAContent* c { nullptr };
+ const RBAContentState* cs { nullptr };
+ if (leftInfo->isExceptionBeforeArbitrate()) {
+ info->setExceptionBeforeArbitrate(true);
+ } else {
+ if (r != nullptr) {
+ c = dynamic_cast<const RBAContent*>(r->getRawObject());
+ if (c != nullptr) {
+ if (r->isPrevious()) {
+ cs = arb->getResult()->getPreActiveState(c);
+ } else {
+ cs = arb->getResult()->getActiveState(c);
+ }
+ if (cs != nullptr) {
+ result = cs->getContentStatePriority();
+ }
+ }
+ }
+ }
+#ifdef RBA_USE_LOG
+ std::string pre;
+ std::string cName { "NULL" };
+ std::string resultText{ "no Content skip" };
+ if (r != nullptr) {
+ cName = r->getElementName();
+ pre = getPreMsg(r->isPrevious());
+ }
+ if (info->isExceptionBeforeArbitrate()) {
+ resultText = "before arbitrate skip";
+ } else {
+ if (cs != nullptr) {
+ resultText = cs->getElementName() + " : " + std::to_string(result);
+ }
+ }
+ LOG_arbitrateConstraintLogicLogLine(
+ " "
+ + pre
+ + "Content["
+ + cName
+ + "] state value ["
+ + resultText
+ + "]");
+#endif
+ return result;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAStateValue::getSymbol() const
+{
+ return ".stateValue()";
+}
+#endif
+
+}
diff --git a/src/core/expression/RBAStateValue.hpp b/src/core/expression/RBAStateValue.hpp
new file mode 100644
index 0000000..52cf8fc
--- /dev/null
+++ b/src/core/expression/RBAStateValue.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /// StateValue class header
+
+#ifndef RBASTATEVALUE_HPP
+#define RBASTATEVALUE_HPP
+
+#include <cstdint>
+#include "RBAContentOperator.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAStateValue : public RBAContentOperator
+{
+public:
+ RBAStateValue()=default;
+ RBAStateValue(const RBAStateValue&)=delete;
+ RBAStateValue(RBAStateValue&&)=delete;
+ RBAStateValue& operator=(const RBAStateValue&)=delete;
+ RBAStateValue& operator=(RBAStateValue&&)=delete;
+ virtual ~RBAStateValue()=default;
+
+public:
+ void accept(RBAExpressionVisitor& visitor) override;
+ RBAModelElementType getModelElementType() const override;
+ std::int32_t getValueCore(RBAConstraintInfo* info,
+ RBAArbitrator* arb) const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getSymbol() const override;
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAStateValueMaker.cpp b/src/core/expression/RBAStateValueMaker.cpp
new file mode 100644
index 0000000..22a0c81
--- /dev/null
+++ b/src/core/expression/RBAStateValueMaker.cpp
@@ -0,0 +1,37 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAStateValueMaker.cpp
+/// @brief StateValue object generator class
+
+#include "RBAStateValueMaker.hpp"
+#include "RBAStateValue.hpp"
+
+namespace rba
+{
+
+RBAStateValueMaker::RBAStateValueMaker()
+ : RBAOperatorMaker{"StateValue"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAStateValueMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAStateValue>();
+}
+
+}
diff --git a/src/core/expression/RBAStateValueMaker.hpp b/src/core/expression/RBAStateValueMaker.hpp
new file mode 100644
index 0000000..8b01e09
--- /dev/null
+++ b/src/core/expression/RBAStateValueMaker.hpp
@@ -0,0 +1,49 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAStateValueMaker.cpp
+/// @brief StateValue object generator class header
+
+#ifndef RBASTATEVALUEMAKER_HPP
+#define RBASTATEVALUEMAKER_HPP
+
+#include "RBAOperatorMaker.hpp"
+
+namespace rba
+{
+
+/// @brief StateValue object generator class
+class RBAStateValueMaker : public RBAOperatorMaker
+{
+public:
+ RBAStateValueMaker();
+ RBAStateValueMaker(const RBAStateValueMaker&)=delete;
+ RBAStateValueMaker(const RBAStateValueMaker&&)=delete;
+ RBAStateValueMaker& operator=(const RBAStateValueMaker&)=delete;
+ RBAStateValueMaker& operator=(const RBAStateValueMaker&&)=delete;
+ virtual ~RBAStateValueMaker()=default;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAValueExpression.hpp b/src/core/expression/RBAValueExpression.hpp
new file mode 100644
index 0000000..111ad02
--- /dev/null
+++ b/src/core/expression/RBAValueExpression.hpp
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ValueExpression class header
+ */
+
+#ifndef RBAVALUEEXPRESSION_HPP
+#define RBAVALUEEXPRESSION_HPP
+
+#include "RBAExpression.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAValueExpression : public RBAExpression
+{
+protected:
+ RBAValueExpression()=default;
+ RBAValueExpression(const RBAValueExpression&)=delete;
+ RBAValueExpression(const RBAValueExpression&&)=delete;
+ RBAValueExpression& operator=(const RBAValueExpression&)=delete;
+ RBAValueExpression& operator=(const RBAValueExpression&&)=delete;
+public:
+ virtual ~RBAValueExpression()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAVariable.cpp b/src/core/expression/RBAVariable.cpp
new file mode 100644
index 0000000..9220c0a
--- /dev/null
+++ b/src/core/expression/RBAVariable.cpp
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Variable class defintion
+ */
+
+#include "RBAVariable.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+RBAVariable::RBAVariable(const std::string& name)
+ : RBARuleObject{name}
+{
+}
+
+RBAModelElementType
+RBAVariable::getModelElementType() const
+{
+ return RBAModelElementType::Variable;
+}
+
+const RBARuleObject*
+RBAVariable::getRuleObj() const
+{
+ return ruleObj_;
+}
+
+void
+RBAVariable::setRuleObj(const RBARuleObject* const ruleObj)
+{
+ ruleObj_ = ruleObj;
+}
+
+void
+RBAVariable::clearRuleObj()
+{
+ ruleObj_ = nullptr;
+}
+
+RBAConstraintInfo*
+RBAVariable::createConstraintInfo()
+{
+ // When the "Let" expression is written in a lambda expression such as
+ // "For-All", the expansion result of the "Let" expression also changes
+ // each time the variable of "For-All" changes. Even if the Let expression
+ // is written in "For-All", there is only one valiable object.
+ // Therefore, "constraintInfo" cannot be cleared and reused, and it is
+ // necessary to do "make_shared" each time the "Let" expression is evaluated.
+ // The ownership of the "ConstraintInfo" of the "Let" expression is
+ // transferred to the "ConstraintInfo" of the "RBAObjectReference"
+ // when the RBAObjectReference that refers to the definition of the Let
+ // expression is evaluated.
+ constraintInfo_ = std::make_shared<RBAConstraintInfo>();
+ return constraintInfo_.get();
+}
+
+std::shared_ptr<RBAConstraintInfo>
+RBAVariable::getConstraintInfo() const
+{
+ return constraintInfo_;
+}
+
+}
diff --git a/src/core/expression/RBAVariable.hpp b/src/core/expression/RBAVariable.hpp
new file mode 100644
index 0000000..88f071e
--- /dev/null
+++ b/src/core/expression/RBAVariable.hpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Variable class header
+ */
+
+#ifndef RBAVARIABLE_HPP
+#define RBAVARIABLE_HPP
+
+#include <memory>
+#include "RBARuleObject.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAVariable : public RBARuleObject
+{
+public:
+ explicit RBAVariable(const std::string& name="");
+ RBAVariable(const RBAVariable&)=delete;
+ RBAVariable(const RBAVariable&&)=delete;
+ RBAVariable& operator=(const RBAVariable&)=delete;
+ RBAVariable& operator=(const RBAVariable&&)=delete;
+ virtual ~RBAVariable()=default;
+
+public:
+ RBAModelElementType getModelElementType() const override;
+
+ const RBARuleObject* getRuleObj() const;
+ void setRuleObj(const RBARuleObject* const ruleObj);
+ void clearRuleObj();
+ RBAConstraintInfo* createConstraintInfo();
+ std::shared_ptr<RBAConstraintInfo> getConstraintInfo() const;
+
+private:
+ const RBARuleObject* ruleObj_ {nullptr};
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::shared_ptr<RBAConstraintInfo> constraintInfo_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/expression/RBAVariableMaker.cpp b/src/core/expression/RBAVariableMaker.cpp
new file mode 100644
index 0000000..aa7d5e8
--- /dev/null
+++ b/src/core/expression/RBAVariableMaker.cpp
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAVariableMaker.cpp
+/// @brief Variable object generator class definition
+
+#include "RBAVariableMaker.hpp"
+#include "RBAVariable.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAVariableMaker::RBAVariableMaker()
+ : RBAModelElementMaker::RBAModelElementMaker{"Variable"}
+{
+}
+
+RBAModelElement*
+RBAVariableMaker::create(const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ // Register the instance without a name, because Variable has the same name
+ std::unique_ptr<RBAModelElement> inst
+ {createInstance(jsonElem->findChildren("name")->getString())};
+ const auto element = inst.get();
+ static_cast<void>(model->addModelElement(std::move(inst)));
+
+ return setProperty(element, jsonElem, model, owner);
+}
+
+std::unique_ptr<RBAModelElement>
+RBAVariableMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAVariable>(name);
+}
+
+RBAModelElement*
+RBAVariableMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ return element;
+}
+
+}
diff --git a/src/core/expression/RBAVariableMaker.hpp b/src/core/expression/RBAVariableMaker.hpp
new file mode 100644
index 0000000..e3d52e6
--- /dev/null
+++ b/src/core/expression/RBAVariableMaker.hpp
@@ -0,0 +1,70 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAVariableMaker.cpp
+/// @brief Variable object generator class header
+
+#ifndef RBAVARIABLEMAKER_HPP
+#define RBAVARIABLEMAKER_HPP
+
+#include "RBAModelElementMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Variable object generator class
+class RBAVariableMaker : public RBAModelElementMaker
+{
+public:
+ RBAVariableMaker();
+ RBAVariableMaker(const RBAVariableMaker&)=delete;
+ RBAVariableMaker(const RBAVariableMaker&&)=delete;
+ RBAVariableMaker& operator=(const RBAVariableMaker&)=delete;
+ RBAVariableMaker& operator=(const RBAVariableMaker&&)=delete;
+ virtual ~RBAVariableMaker()=default;
+
+public:
+ /// @brief Create ModelElement object
+ /// @details Create ModelElement object and register unique_ptr to model.
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store created object
+ /// @param[in,out] owner Parent object (Not in use)
+ /// @return ModelElement object
+ RBAModelElement* create(const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+protected:
+ /// @brief generate an empty instance
+ /// @details generate an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set attributes of model element for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store created object
+ /// @param[in,out] owner Parent object (Not in use)
+ /// @return ModelElement object
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAAffectInfo.cpp b/src/core/logic/RBAAffectInfo.cpp
new file mode 100644
index 0000000..6cf4e98
--- /dev/null
+++ b/src/core/logic/RBAAffectInfo.cpp
@@ -0,0 +1,67 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AffectInfo class definition
+ */
+
+#include "RBAAffectInfo.hpp"
+
+namespace rba
+{
+
+/**
+ * @brief Returns whether the allocable already affects the target allocable
+ * @param allocatable Influential Allocatable
+ * @param affectAllocatable Affected Allocatable
+ * @return bool
+ */
+bool
+RBAAffectInfo::alreadyKnowsThatFormerHasAffectedToLatter(const RBAAllocatable* const allocatable,
+ const RBAAllocatable* const affectAllocatable) const
+{
+ for(const auto& alloc : reaffected_[allocatable]) {
+ if(alloc == affectAllocatable) {
+ return true;
+ }
+ }
+ return false;
+}
+
+/**
+ * @brief Register Affect information
+ * @param allocatable Influential Allocatable
+ * @param affectAllocatable Affected Allocatable
+ */
+void
+RBAAffectInfo::addInfoThatFormerAffectedToLatter(const RBAAllocatable* const allocatable,
+ const RBAAllocatable* const affectAllocatable)
+{
+ static_cast<void>(reaffected_[allocatable].insert(affectAllocatable));
+}
+
+/**
+ * @brief Deletes the Affect information of "allocatable" registered by
+ *        other allocatables registered by arbitration of the specified
+ *        recursion hierarchy of the specified "allocatable".
+ * @param affectAllocatable
+ */
+void RBAAffectInfo::removeAffectInfo(const RBAAllocatable* const affectAllocatable)
+{
+ static_cast<void>(reaffected_.erase(affectAllocatable));
+}
+
+}
diff --git a/src/core/logic/RBAAffectInfo.hpp b/src/core/logic/RBAAffectInfo.hpp
new file mode 100644
index 0000000..c9c73be
--- /dev/null
+++ b/src/core/logic/RBAAffectInfo.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AffectInfo class header
+ */
+
+#ifndef RBAAFFECTINFO_HPP
+#define RBAAFFECTINFO_HPP
+
+#include <unordered_map>
+#include <set>
+
+namespace rba
+{
+
+class RBAAllocatable;
+
+class RBAAffectInfo
+{
+public:
+ RBAAffectInfo()=default;
+ RBAAffectInfo(const RBAAffectInfo&)=delete;
+ RBAAffectInfo(const RBAAffectInfo&&)=delete;
+ RBAAffectInfo& operator=(const RBAAffectInfo&)=delete;
+ RBAAffectInfo& operator=(const RBAAffectInfo&&)=delete;
+ virtual ~RBAAffectInfo()=default;
+
+public:
+ bool alreadyKnowsThatFormerHasAffectedToLatter(const RBAAllocatable* const allocatable,
+ const RBAAllocatable* const affectAllocatable) const;
+ void addInfoThatFormerAffectedToLatter(const RBAAllocatable* const allocatable,
+ const RBAAllocatable* const affectAllocatable);
+ void removeAffectInfo(const RBAAllocatable* const affectAllocatable);
+
+private:
+ // Information of other "allocatable" affected by "allocatable"
+ mutable std::unordered_map<const RBAAllocatable*,
+ std::set<const RBAAllocatable*>>reaffected_;
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAArbitrator.cpp b/src/core/logic/RBAArbitrator.cpp
new file mode 100644
index 0000000..9fdd7d3
--- /dev/null
+++ b/src/core/logic/RBAArbitrator.cpp
@@ -0,0 +1,1987 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * Arbitrator class definition
+ */
+
+#include <algorithm>
+#include <sstream>
+#include "RBAArbitrator.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAResult.hpp"
+#include "RBAResultSet.hpp"
+#include "RBAAffectInfo.hpp"
+#include "RBAConstraintImpl.hpp"
+#include "RBAViewAction.hpp"
+#include "RBAViewTransition.hpp"
+#include "RBAViewMove.hpp"
+#include "RBARollbacker.hpp"
+#include "RBALogManager.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba {
+
+RBAArbitrator::RBAArbitrator(RBAModel* newModel)
+{
+ setModel(newModel);
+}
+
+#ifdef RBA_USE_LOG
+RBAArbitrator::RBAArbitrator(RBAModel* newModel, RBALogManager* logManager)
+{
+ setModel(newModel);
+ RBALogManager::setLogManager(logManager);
+ // Even if the argument logManager is null, it may be setLogManager()
+ // from outside the rba, so it is determined by getLogManager() instead of
+ // the argument determination.
+ if (RBALogManager::getLogManager() != nullptr) {
+ setSimulationMode(true);
+ }
+}
+#endif
+
+RBAArbitrator::~RBAArbitrator() noexcept
+{
+}
+
+void
+RBAArbitrator::setModel(RBAModel* newModel)
+{
+ setModel(dynamic_cast<RBAModelImpl*>(newModel));
+}
+
+const RBAModel*
+RBAArbitrator::getModel() const
+{
+ return dynamic_cast<RBAModel*>(model_);
+}
+
+void
+RBAArbitrator::initialize(std::list<std::string>& contexts)
+{
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ setRequestData(contexts, true);
+}
+
+std::unique_ptr<RBAResult>
+RBAArbitrator::execute(const std::string& contextName, bool require)
+{
+ const std::lock_guard<std::recursive_mutex> lock {getMutex()};
+ if (isValidContext(contextName) == false) {
+ // In case of error, creates a copy of "Result",
+ // sets the error flag in it and returns
+ std::unique_ptr<RBAResultImpl> result {std::make_unique<RBAResultImpl>(
+ this, std::make_unique<RBAResultSet>(*getBackupResultSet()))};
+ result->setStatusType(RBAResultStatusType::UNKNOWN_CONTENT_STATE);
+ return std::move(result);
+ } else {
+ static_cast<void>(setRequestData(contextName, require, nullptr,
+ static_cast<std::uint32_t>(getRequestQue().size())));
+ return arbitrateMain();
+ }
+}
+
+std::unique_ptr<RBAResult>
+RBAArbitrator::execute(std::list<std::string>& contexts,
+ bool require)
+{
+ const std::lock_guard<std::recursive_mutex> lock {getMutex()};
+ if (isValidContext(contexts) == false) {
+ // In case of error, creates a copy of "Result",
+ // sets the error flag in it and returns
+ std::unique_ptr<RBAResultImpl> result {std::make_unique<RBAResultImpl>(
+ this, std::make_unique<RBAResultSet>(*getBackupResultSet()))};
+ result->setStatusType(RBAResultStatusType::UNKNOWN_CONTENT_STATE);
+ return std::move(result);
+ } else {
+ setRequestData(contexts, require);
+ return arbitrateMain();
+ }
+}
+
+std::unique_ptr<RBAResult>
+RBAArbitrator::execute(const std::string& sceneName,
+ std::list<std::pair<std::string,std::int32_t>>& properties)
+{
+ const std::lock_guard<std::recursive_mutex> lock {getMutex()};
+ // Check argument
+ if (isValidContext(sceneName) == false) {
+ // In case of error, creates a copy of "Result",
+ // sets the error flag in it and returns
+ std::unique_ptr<RBAResultImpl> result {std::make_unique<RBAResultImpl>(
+ this, std::make_unique<RBAResultSet>(*getBackupResultSet()))};
+ result->setStatusType(RBAResultStatusType::UNKNOWN_CONTENT_STATE);
+ return std::move(result);
+ } else {
+ static_cast<void>(setRequestData(sceneName, true, &properties,
+ static_cast<std::uint32_t>(getRequestQue().size())));
+ return arbitrateMain();
+ }
+}
+
+std::unique_ptr<RBAResult>
+RBAArbitrator::setResultContentState(const std::string& allocatableName,
+ const std::string& contextName)
+{
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ RBAResultSet* const backupResultSetTmp {getBackupResultSet().get()};
+ if (getReservedResultSet() == nullptr) {
+ setResult(std::make_unique<RBAResultImpl>(this,
+ std::make_unique<RBAResultSet>(),
+ std::move(getBackupResultSet())));
+ } else {
+ RBAResultSet* const reservedResultSetTmp {getReservedResultSet().get()};
+ setResult(std::make_unique<RBAResultImpl>(this,
+ std::move(getReservedResultSet()),
+ std::move(getBackupResultSet())));
+ setReservedResultSet(std::make_unique<RBAResultSet>(*reservedResultSetTmp));
+ }
+ setBackupResultSet(std::make_unique<RBAResultSet>(*backupResultSetTmp));
+
+ // find allocatable
+ const RBAAllocatable* alloc {nullptr};
+ const RBAAreaImpl* const area {model_->findAreaImpl(allocatableName)};
+ if(area != nullptr) {
+ alloc = area;
+ }
+ else {
+ const RBAZoneImpl* const zone {model_->findZoneImpl(allocatableName)};
+ if(zone != nullptr) {
+ alloc = zone;
+ }
+ }
+ // find content state
+ const RBAContentState* state {nullptr};
+ const RBAViewContentStateImpl* const viewState
+ {model_->findViewContentStateImpl(contextName)};
+ if(viewState != nullptr) {
+ state = viewState;
+ }
+ else {
+ const RBASoundContentStateImpl* const soundState
+ {model_->findSoundContentStateImpl(contextName)};
+ if(soundState != nullptr) {
+ state = soundState;
+ }
+ }
+ if( (alloc == nullptr) || (state == nullptr) ) {
+ // Unknown context or allocatable
+ getResult()->setStatusType(RBAResultStatusType::UNKNOWN_CONTENT_STATE);
+ return std::move(getResultRef());
+ }
+ // Set alloc and state to result
+ const RBAContentState* const beforeContentState {alloc->getState()};
+ const_cast<RBAAllocatable*>(alloc)->setState(state);
+ const_cast<RBAAllocatable*>(alloc)->setChecked(true);
+ getResult()->setActive(state, true);
+ getResult()->setContentState(alloc, state);
+
+ // ----------------------------------------------------------
+ // Post processing of Arbitration
+ // ----------------------------------------------------------
+ postArbitrate();
+
+ // Excecute offline constraint
+#ifdef RBA_USE_LOG
+ checkAllConstraints();
+#endif
+
+ // ----------------------------------------------------------
+ // Update the state of Content
+ // ----------------------------------------------------------
+ if (beforeContentState != nullptr) {
+ // Update the state of the Content originally assigned to
+ // the requested Allocatable
+ dynamic_cast<RBAContent*>(beforeContentState->getOwner())->updateStatus(getResultRef().get());
+ }
+ // Update the state of requested Content
+ dynamic_cast<RBAContent*>(state->getOwner())->updateStatus(getResultRef().get());
+
+ // Cancel processing of Content
+ checkCancelContent();
+
+ // Update display and non-display Area
+ updateResult();
+
+ // Generate Result
+ createResultData();
+
+ // Store backup of current arbitration result set
+ setBackupResultSet(getResult()->createBackupCurrentResultSet());
+ // Create next arbitration result set
+ setNextResultSet(getResult()->createNextCurrentResultSet());
+
+ return std::move(getResultRef());
+}
+
+std::unique_ptr<RBAResult>
+RBAArbitrator::cancelArbitration()
+{
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ if(getReservedResultSet() == nullptr) {
+ std::unique_ptr<RBAResultImpl> res
+ {std::make_unique<RBAResultImpl>(this,
+ std::make_unique<RBAResultSet>())};
+ res->setStatusType(RBAResultStatusType::CANCEL_ERROR);
+ return std::move(res);
+ }
+
+ setResult(
+ std::make_unique<RBAResultImpl>(this,
+ std::make_unique<RBAResultSet>(),
+ std::move(getReservedResultSet())));
+ setBackupResultSet(getResult()->createBackupCurrentResultSet());
+ setNextResultSet(getResult()->createNextCurrentResultSet());
+
+ return std::move(getResultRef());
+}
+
+void
+RBAArbitrator::clearArbitration()
+{
+ std::lock_guard<std::recursive_mutex> lock {getMutex()};
+ getCancelChecked().clear();
+ setReservedResultSet(nullptr);
+ setBackupResultSet(std::make_unique<RBAResultSet>());
+ for(const auto& scene : model_->getSceneImpls()) {
+ for(const std::string propertyName : scene->getPropertyNames()) {
+ const std::int32_t value {scene->getPropertyValue(propertyName)};
+ getBackupResultSet()->setSceneProperty(scene, propertyName, value);
+ }
+ }
+ setNextResultSet(
+ std::make_unique<RBAResultSet>(*getBackupResultSet().get()));
+ setResult(std::make_unique<RBAResultImpl>(
+ this,
+ std::make_unique<RBAResultSet>(*getBackupResultSet().get())));
+
+ model_->clearElementsStatus();
+}
+
+bool
+RBAArbitrator::setScene(const std::string& sceneName, bool require,
+ std::list<std::pair<std::string, std::int32_t>>& properties)
+{
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ return setRequestData(sceneName, require, &properties);
+}
+
+bool
+RBAArbitrator::setContentState(const std::string& contextName, bool require)
+{
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ const std::deque<std::unique_ptr<RBARequestQueMember>>& requestQue{getRequestQue()};
+ std::uint32_t syncIndex{static_cast<std::uint32_t>(requestQue.size())};
+ if (syncIndex > 0U ) {
+ const std::unique_ptr<RBARequestQueMember>& prevReq{requestQue.back()};
+ if (prevReq->isOn() == require) {
+ syncIndex = prevReq->getSyncIndex();
+ }
+ }
+ return setRequestData(contextName, require, nullptr, syncIndex);
+}
+
+bool
+RBAArbitrator::setAllocatableResult(const std::string& allocatableName,
+ const std::string& contextName)
+{
+ std::lock_guard<std::recursive_mutex> lock {getMutex()};
+ // Get allocatable
+ const auto alloc = model_->findAllocatable(allocatableName);
+ if(alloc == nullptr) {
+ return false;
+ }
+
+ // Get context
+ const auto state = model_->findContentState(contextName);
+ if(state == nullptr) {
+ return false;
+ }
+
+ // Set state to allocatable
+ const auto beforeContentState = alloc->getState();
+ const_cast<RBAAllocatable*>(alloc)->setState(state);
+ RBAResultSet* const nextResultSet {getNextResultSet().get()};
+ RBAResultSet* const prevResultSet {getBackupResultSet().get()};
+ nextResultSet->setContentState(alloc, state);
+ prevResultSet->setContentState(alloc, state);
+ nextResultSet->setActive(state, true);
+ prevResultSet->setActive(state, true);
+
+ // ----------------------------------------------------------
+ // Update the state of Content
+ // ----------------------------------------------------------
+ // Create "result" and update state, because updating the content state
+ // determines the transition destination this time
+ // based on previous state.
+ setResult(std::make_unique<RBAResultImpl>(
+ this,
+ std::make_unique<RBAResultSet>(*getBackupResultSet()),
+ std::make_unique<RBAResultSet>(*getNextResultSet())));
+ RBAContent* const content {dynamic_cast<RBAContent*>(state->getOwner())};
+ content->updateRequestStatus(getResult()->getCurResultSet().get(), true);
+ if (beforeContentState != nullptr) {
+ // Update the state of the content originally assigned to
+ // the requested Allocatable
+ dynamic_cast<RBAContent*>(beforeContentState->getOwner())->updateStatus(getResultRef().get());
+ }
+ // Update the state of requested Content
+ content->updateStatus(getResultRef().get());
+
+ setBackupResultSet(std::make_unique<RBAResultSet>(*getResult()->getPreResultSet()));
+ setNextResultSet(getResult()->createNextCurrentResultSet());
+
+ return true;
+}
+
+bool
+RBAArbitrator::RBAArbitrator::evaluate(RBAExpression* expression)
+{
+ if(expression == nullptr) {
+ return false;
+ }
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ RBAConstraintInfo info;
+ // Constraint expression evaluation
+ return expression->execute(&info, this);
+}
+
+const RBARuleObject*
+RBAArbitrator::evaluateObject(RBAExpression* expression)
+{
+ if(expression == nullptr) {
+ return nullptr;
+ }
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ RBAConstraintInfo info;
+ // Constraint expression evaluation
+ const RBARuleObject* const ruleObj
+ {expression->getReferenceObject(&info, this)};
+ if (ruleObj != nullptr) {
+ return ruleObj->getRawObject();
+ } else {
+ return nullptr;
+ }
+}
+
+int32_t
+RBAArbitrator::evaluateValue(RBAExpression* expression)
+{
+ if(expression == nullptr) {
+ return -99;
+ }
+ const std::lock_guard<std::recursive_mutex> lock{getMutex()};
+ RBAConstraintInfo info;
+ // Constraint expression evaluation
+ return expression->getValue(&info, this);
+}
+
+
+void
+RBAArbitrator::setModel(RBAModelImpl* const newModel)
+{
+ std::lock_guard<std::recursive_mutex> lock {getMutex()};
+ model_ = newModel;
+ model_->createSortedAllocatables();
+ clearArbitration();
+}
+
+bool
+RBAArbitrator::
+satisfiesConstraints() const
+{
+ const std::lock_guard<std::recursive_mutex> lock{mutex_};
+ // Temporarily store the actual result_
+ // because result_ is used for evaluation
+ std::unique_ptr<RBAResultImpl> tmpResult {std::move(result_)};
+ result_ = std::make_unique<RBAResultImpl>(
+ this,
+ std::make_unique<RBAResultSet>(*(reservedResultSet_.get())),
+ std::make_unique<RBAResultSet>(*(resultSetForSatisfiesConstraints_.get())));
+ bool result {true};
+ for(const RBAConstraintImpl*& constraint : model_->getConstraintImpls()) {
+ if (constraint->isRuntime() == true) {
+ result = const_cast<RBAConstraintImpl*>(constraint)->execute(const_cast<RBAArbitrator*>(this));
+ if (result == false) {
+ break;
+ }
+ }
+ }
+ result_ = std::move(tmpResult);
+ return result;
+}
+
+/**
+ * Execute arbitration
+ */
+std::unique_ptr<RBAResult>
+RBAArbitrator::arbitrateMain()
+{
+ // Store request state before arbitration,
+ // in case cancelArbitration() is executed
+ reservedResultSet_ = std::make_unique<RBAResultSet>(*backupResultSet_);
+
+ // Differential arbitration for each request
+ if (requestQue_.empty()) {
+ // Prepare Result here because it will be used in differenceArbitrate.
+ result_ = std::make_unique<RBAResultImpl>(this,
+ std::move(backupResultSet_),
+ std::move(nextResultSet_));
+ // Arbitration request without arguments.
+ // there is a possibility of being queued in "requestQue_"
+ // due to "onDisplayed" in this,
+ differenceArbitrate();
+ }
+ if (!requestQue_.empty()) {
+ result_ = std::make_unique<RBAResultImpl>(this,
+ std::move(backupResultSet_),
+ std::move(nextResultSet_));
+ do {
+ const std::unique_ptr<RBARequestQueMember> request {std::move(requestQue_.front())};
+ requestQue_.pop_front();
+ result_->setActive(request->getContentState(), request->isOn());
+ // Update the state of Content
+ RBAContent* const content {dynamic_cast<RBAContent*>(request->getContentState()->getOwner())};
+ content->updateRequestStatus(result_->getCurResultSet().get(), request->isOn());
+ if (requestQue_.empty()) {
+ differenceArbitrate();
+ if (!requestQue_.empty()) {
+ // Update "result_" for the next differenceArbitrate().
+ result_ = std::make_unique<RBAResultImpl>(this,
+ std::move(backupResultSet_),
+ std::move(nextResultSet_));
+ }
+ } else if (requestQue_.front()->getSyncIndex() != request->getSyncIndex()) {
+ differenceArbitrate();
+ // Update "result_" for the next differenceArbitrate().
+ result_ = std::make_unique<RBAResultImpl>(this,
+ std::move(backupResultSet_),
+ std::move(nextResultSet_));
+ } else {
+ // No Operation
+ }
+ } while (!requestQue_.empty());
+ }
+
+ result_ = std::make_unique<RBAResultImpl>(
+ this, std::make_unique<RBAResultSet>(*reservedResultSet_),
+ result_->createBackupCurrentResultSet());
+
+ // Cancel processing of Content
+ checkCancelContent();
+
+ // Update displayed and non-displayed Area
+ updateResult();
+
+#ifdef RBA_USE_LOG
+ RBALogManager::setType(RBALogManager::TYPE_RESULT);
+ logResultArbitration();
+
+ setLogToResult();
+ RBALogManager::setType(RBALogManager::TYPE_NOTHING);
+#endif
+
+ createResultData();
+ // Store backup of current arbitration result set
+ backupResultSet_ = result_->createBackupCurrentResultSet();
+ // Create next arbitration result set
+ nextResultSet_ = result_->createNextCurrentResultSet();
+
+ // The "result_" of the return value is changed to another name,
+ // because "result_" will be used for storing.
+ auto retResult = std::move(result_);
+
+ // Hold the arbitration result because the arbitration result may be used
+ // in cases other than arbitration.
+ result_ = std::make_unique<RBAResultImpl>(retResult.get());
+
+ // A compile error occurs if std::move() is missing because
+ // std::unique_ptr<RBAResultImpl> is cast to std::unique_ptr<RBAResult>
+ return std::move(retResult);
+}
+
+bool
+RBAArbitrator::
+isValidContext(const std::string& context)
+{
+ if (context != "") {
+ const RBAContentState* const state {model_->findContentState(context)};
+ if (state == nullptr) {
+ const RBASceneImpl* const scene {model_->findSceneImpl(context)};
+ if (scene == nullptr) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+}
+
+bool
+RBAArbitrator::
+isValidContext(std::list<std::string>& contexts)
+{
+ for(const std::string contextName : contexts) {
+ if(isValidContext(contextName) == false) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+/**
+ * Reflect input information
+ */
+
+bool
+RBAArbitrator::setRequestData(
+ const std::string& context, bool require,
+ std::list<std::pair<std::string, std::int32_t>>* const properties,
+ std::uint32_t syncIndex)
+{
+ bool isSet {false};
+ if (context != "") {
+ // When content state is specified
+ // If contextName is the only content name, pop the first content state
+ const RBAContentState* state {model_->findContentState(context)};
+ if (state != nullptr) {
+ requestQue_.push_back( std::make_unique<RBARequestQueMember>(state, require, syncIndex));
+ isSet = true;
+ } else {
+ // When Scene is specified
+ const RBASceneImpl* const scene {model_->findSceneImpl(context)};
+ if (scene != nullptr) {
+ // for next arbitration
+ nextResultSet_->setActive(scene, require);
+ // For when "Result" is referenced before the next arbitration
+ result_->setActive(scene, require);
+ isSet = true;
+ if (properties != nullptr) {
+ for (auto& p : *properties) {
+ const RBAAbstractProperty* const ap {scene->getProperty(p.first)};
+ if (ap != nullptr) {
+ // for next arbitration
+ nextResultSet_->setSceneProperty(ap, p.second);
+ // For when "Result" is referenced before the next arbitration
+ result_->setSceneProperty(ap, p.second);
+ }
+ }
+ }
+ }
+ }
+ }
+ return isSet;
+}
+
+void
+RBAArbitrator::setRequestData(const RBAContentState* state,
+ bool require)
+{
+ if (requestQue_.empty()){
+ requestQue_.push_back( std::make_unique<RBARequestQueMember>(state, require, 0U));
+ } else {
+ requestQue_.push_back( std::make_unique<RBARequestQueMember>(state, require, requestQue_.back()->getSyncIndex()));
+ }
+}
+
+void
+RBAArbitrator::setRequestData(const RBAContent* const content,
+ bool require)
+{
+ if (requestQue_.empty()){
+ requestQue_.push_back( std::make_unique<RBARequestQueMember>(content->getStates().front(), require, 0U));
+ } else {
+ requestQue_.push_back( std::make_unique<RBARequestQueMember>(content->getStates().front(), require, requestQue_.back()->getSyncIndex()));
+ }
+}
+
+void
+RBAArbitrator::setActive(const RBASceneImpl* const scene, const bool require)
+{
+ if (nextResultSet_ != nullptr) {
+ // Update nextResultSet_" when onScene is done in onRequest or onWithdrawn
+ nextResultSet_->setActive(scene, require);
+ } else {
+ result_->setActive(scene, require);
+ }
+}
+
+void
+RBAArbitrator::setSceneProperty(const RBAAbstractProperty* const prop, const std::int32_t value)
+{
+ if (nextResultSet_ != nullptr) {
+ // Update nextResultSet_" when onScene is done in onRequest or onWithdrawn
+ nextResultSet_->setSceneProperty(prop, value);
+ } else {
+ result_->getCurResultSet()->setSceneProperty(prop, value);
+ }
+}
+
+void
+RBAArbitrator::setRequestData(std::list<std::string>& contexts,
+ const bool require)
+{
+ const std::uint32_t syncIndex {static_cast<std::uint32_t>(requestQue_.size())};
+ for (auto& c : contexts) {
+ static_cast<void>(setRequestData(c, require, nullptr, syncIndex));
+ }
+}
+
+/**
+ * @brief Execute an extended version of arbitration that allows arbitration
+ when the "implication" is false
+ * @param areas
+ */
+void
+RBAArbitrator::
+arbitrate(std::list<RBAAllocatable*>& allocatables)
+{
+ LOG_arbitrateAreaLogLine("----Arbitrate----");
+ std::set<const RBAAllocatable*> revisitedInitSet;
+
+ std::set<const RBAAllocatable*> revisited;
+ for (auto& alloc : allocatables) {
+ revisited = revisitedInitSet;
+ // -------------------------------------------------------------------------
+ // To prevent an infinite loop, generate information to limit registration
+   // of other "allocable" that affected the target "allocatable"
+ // during arbitration
+ // -------------------------------------------------------------------------
+ RBAAffectInfo affectInfo;
+ LOG_arbitrateAreaLogLine(
+ alloc->getSymbol() + "[" + alloc->getElementName() + "] check start");
+ arbitrateAllocatable(alloc, revisited, 0, &affectInfo, nullptr);
+ }
+ for (auto& a : model_->getSortedAllocatables()) {
+ result_->setContentState(a, a->getState());
+ }
+}
+
+/**
+ * @brief Recursively arbitrate "allocatable"
+ * @param allocatable Allocatable that you want to arbitrate
+ * @param revisited Allocatable that re-arbitration is complete
+ * @param nest Re-arbitration nesting hierarchy (first arbitration is zero)
+ * @param affectInfo Allocatable information affected by "allocatable"
+ */
+void RBAArbitrator::arbitrateAllocatable(
+ RBAAllocatable* allocatable,
+ std::set<const RBAAllocatable*>& revisited,
+ const std::int32_t nest,
+ RBAAffectInfo* const affectInfo,
+ RBARollbacker* const parentRollbacker)
+{
+#ifdef RBA_USE_LOG
+ RBALogManager::setIndent(nest);
+#endif
+ // "Allocable" affected by "Allocable" which is the target of this arbitration
+ // during the recursive process until this variable is defined,
+ std::set<const RBAAllocatable*> affectAllocatables;
+ affectAllocatables.insert(allocatable->getAllocatablesAffectedByYou().begin(),
+ allocatable->getAllocatablesAffectedByYou().end());
+
+ const RBAContentState* const beforeState {allocatable->getState()};
+
+ // Mark Content allocation for target Allocable" as "checked"
+ allocatable->setChecked(true);
+ // Get content status sorted by arbitration policy
+ // (only active requests)
+ std::list<const RBAContentState*> contentStates;
+ getSortedContentStates(allocatable, contentStates);
+ for(const RBAContentState* const contentState : contentStates) {
+ // Allocate Content to Area
+ allocatable->setState(contentState);
+#ifdef RBA_USE_LOG
+ {
+ std::string str = " Content[";
+ if (contentState == nullptr) {
+ str += "null";
+ } else {
+ str += contentState->getOwner()->getElementName() + "::"
+ + contentState->getElementName();
+ }
+ str += "] check online constraints start";
+ RBALogManager::arbitrateContentLogLine(str);
+ }
+#endif
+ bool isSkipped {false};
+ const bool isPassed {checkConstraintAndReArbitrate(
+ allocatable, revisited, nest, affectInfo, parentRollbacker,
+ allocatable->getConstraints(), &isSkipped, false)};
+ if (isPassed == true) {
+
+ // ----------------------------------------------------------
+ // Check if self-allocatable should be hidden
+ // by constraint expression after content allocation process.
+ // Check even if content is not assigned because there is contentValue()
+ // ----------------------------------------------------------
+#ifdef RBA_USE_LOG
+ std::string alloSymbol = allocatable->getSymbol();
+ std::string alloName = allocatable->getElementName();
+ if (allocatable->isArea() == true) {
+ LOG_arbitrateAreaLogLine(
+ " check online constraints to confirm area hidden state");
+ } else {
+ LOG_arbitrateAreaLogLine(
+ " check online constraints to confirm zone muted state");
+ }
+#endif
+ // Mark "hidden" of target "Allocable" as "checked"
+ allocatable->setHiddenChecked(true);
+ // Set "hidden" of target "Allocable" to false
+ allocatable->setHidden(false);
+ bool hiddenIsPassed {checkConstraintAndReArbitrate(
+ allocatable, revisited, nest, affectInfo, parentRollbacker,
+ allocatable->getHiddenFalseCheckConstraints(), &isSkipped,
+ !allocatable->isZone())};
+ if (hiddenIsPassed == false) {
+ allocatable->setHidden(true);
+ hiddenIsPassed = checkConstraintAndReArbitrate(
+ allocatable, revisited, nest, affectInfo, parentRollbacker,
+ allocatable->getHiddenTrueCheckConstraints(), &isSkipped,
+ !allocatable->isZone());
+ if (hiddenIsPassed == false) {
+ // Clear hiding state of Allocatable
+ allocatable->setHiddenChecked(false);
+ } else {
+ LOG_arbitrateAreaLogLine(
+ alloSymbol + "[" + alloName + "] change "
+ + allocatable->getHiddenSymbol());
+ }
+ }
+
+ // -------------------------------------
+ // For Zone, judge attenuation after hiding (mute)
+ // -------------------------------------
+ bool attenuateIsPassed {true};
+ if (allocatable->isZone()) {
+ RBAZoneImpl* const zone {dynamic_cast<RBAZoneImpl*>(allocatable)};
+ // Mark "attenuattion" of target "Zone" as checked"
+ zone->setAttenuateChecked(true);
+ // Set "attenuattion" of target "Zone" to false
+ zone->setAttenuated(false);
+ LOG_arbitrateAreaLogLine(
+ " check online constraints to confirm zone attenuated state");
+ attenuateIsPassed = checkConstraintAndReArbitrate(
+ allocatable, revisited, nest, affectInfo, parentRollbacker,
+ allocatable->getAttenuateFalseCheckConstraints(), &isSkipped, true);
+ if (attenuateIsPassed == false) {
+ zone->setAttenuated(true);
+ attenuateIsPassed = checkConstraintAndReArbitrate(
+ allocatable, revisited, nest, affectInfo, parentRollbacker,
+ allocatable->getAttenuateTrueCheckConstraints(), &isSkipped, true);
+ if (attenuateIsPassed == false) {
+ allocatable->setAttenuateChecked(false);
+ } else {
+ LOG_arbitrateAreaLogLine(
+ alloSymbol + "[" + alloName + "] change attenuated");
+ }
+ }
+ }
+#ifdef RBA_USE_LOG
+ {
+ std::string str = alloSymbol + "[" + alloName + "] ";
+ if (allocatable->isArea() == true) {
+ str += "displays";
+ } else {
+ str += "outputs";
+ }
+ str += " Content[";
+ const RBAContentState* state = allocatable->getState();
+ if (state == nullptr) {
+ str += "null";
+ } else {
+ str += state->getOwner()->getElementName() + "::"
+ + state->getElementName();
+ }
+ str += "] " + allocatable->getHiddenSymbol() + "["
+ + RBALogManager::boolToString(allocatable->isHidden()) + "]";
+ if (allocatable->isZone() == true) {
+ str += " attenuated["
+ + RBALogManager::boolToString(allocatable->isAttenuated()) + "]";
+ }
+ str += "\n";
+ LOG_arbitrateAreaLogLine(str);
+ }
+#endif
+ if ((hiddenIsPassed == true) && (attenuateIsPassed == true)) {
+ break;
+ }
+ }
+ }
+ // ---------------------------------------------------------------------
+ // Re-arbitration of the Allocatable that influenced
+ // ---------------------------------------------------------------------
+ if ((beforeState != allocatable->getState())
+ || allocatable->isHidden()
+ || allocatable->isAttenuated()) {
+
+ // Re-arbitration is performed in a state other than "hidden"
+ // When allocating content. Therefore, if state become "hidden" or
+ // "attenuation", re-arbitration is required for the "allocatable"
+ // that was affected by re-arbitration during content allocation.
+ // Update the increased Area that influenced
+ if (allocatable->isHidden() || allocatable->isAttenuated()) {
+ for (const auto& a : allocatable->getAllocatablesAffectedByYou()) {
+ static_cast<void>(affectAllocatables.insert(a));
+ }
+ }
+
+ // If the re-arbitration source of Area/Zone (including any re-arbitration
+ // sources, if any reconciliation nests) becomes an Area/Zone affected by
+ // the re-arbitration area/zone, such Area/Zone is excluded from
+ // the re-arbitration target and the affected Area/Zone is re-arbitrated.
+ // Further, even if the affected Area/Zone is unarbitrated Allocatable
+ // at that time, it is excluded from the re-arbitration target of
+ // the affected Area. This is because it is sufficient to arbitrate
+ // during normal arbitration.
+ for (const auto& a : revisited) {
+ if (affectAllocatables.find(a) != affectAllocatables.end()
+ || (!a->isChecked())) {
+ static_cast<void>(affectAllocatables.erase(a));
+ }
+ }
+ std::list<const RBAAllocatable*> sortedAllocatables(affectAllocatables.begin(),affectAllocatables.end());
+ sortedAllocatables.sort(&RBAAllocatable::compareIndex);
+ if (parentRollbacker != nullptr) {
+ std::shared_ptr<RBARollbacker> rollbacker {std::make_shared<RBARollbacker>()};
+ parentRollbacker->addChild(rollbacker);
+ rollbacker->backup(sortedAllocatables);
+ }
+
+ for (auto& affect : sortedAllocatables) {
+ // Remove Allocatable which will be re-arbitration from Allocatable
+ // that influenced Allocable during arbitration.
+ allocatable->removeAffectAllocatable(affect);
+ }
+ static_cast<void>(revisited.insert(allocatable)); // Add to arbitrated Area
+ for (auto& affectAllocatable : sortedAllocatables) {
+ // @Deviation (EXP55-CPP,Rule-5_2_5,A5-2-3)
+ // [Contents that deviate from the rules]
+ // This is a 'const_cast' expression that strips away a 'const' or
+ // 'volatile' qualifier.
+ // [Why there is no problem if it deviate from the rules]
+   // Confirmed that there is no problem from the design point of view.
+ // We won't fix it now because we need to redesign the class, but
+ // no much effort as of now.
+ RBAAllocatable* allo {const_cast<RBAAllocatable*>(affectAllocatable)};
+
+ // Initialize the check flag of the Allocatable that performs the
+ // re-arbitration of the affetcted Allocatable
+ // If the affected Allocables are cleared in advance, a skip occurred in
+ // the constraint expression evaluation during the re-arbitration of
+ // the affected Allocatable that was carried out earlier, after that
+ // re-arbitration will work during re-arbitration of affected Allocatable.
+ // Therefore, clear check flag individually
+ // before re-arbitration of affected Allocable
+ allo->clearChecked();
+
+ LOG_arbitrateAreaLogLine( " " +
+ affectAllocatable->getSymbol() + "["
+ + affectAllocatable->getElementName()
+ + "] affect allocatable check start");
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Recursively calling arbitrateAllocatable()
+ // [Why there is no problem if it deviate from the rules]
+ // - This process is necessary for re-arbitration of the affected Area,
+ // - stack overflow will not occur becasue the infinite loop
+ // prevention process is imeplemented.
+ arbitrateAllocatable(allo, revisited, nest + 1, affectInfo,
+ parentRollbacker);
+ }
+ for(const RBAAllocatable* const revisitAllocatable : sortedAllocatables) {
+ static_cast<void>(revisited.erase(revisitAllocatable));
+ }
+ }
+
+ // --------------------------------------------------
+ // Delete temporary affect information
+ // to prevent infinite loop during re-arbitration
+ // --------------------------------------------------
+ affectInfo->removeAffectInfo(allocatable);
+#ifdef RBA_USE_LOG
+ RBALogManager::setIndent(nest-1);
+#endif
+}
+
+/**
+ * @brief Sort content state based on arbitration policy
+ * @param allocatable
+ * @param contentStates
+ * @return success/failure of sort
+ */
+bool
+RBAArbitrator::
+sortContentStates(const RBAAllocatable* const allocatable,
+ std::list<const RBAContentState*>& states) const
+{
+ bool isResult {true};
+ switch(allocatable->getAllocatableArbitrationPolicy()) {
+ case RBAArbitrationPolicy::FIRST_COME_FIRST:
+ states.sort(&RBAContentState::compareFirstComeFirst);
+ break;
+ case RBAArbitrationPolicy::LAST_COME_FIRST:
+ states.sort(&RBAContentState::compareLastComeFirst);
+ break;
+ case RBAArbitrationPolicy::PRIORITY_FIRST_COME_FIRST:
+ states.sort(&RBAContentState::comparePriorityFirstComeFirst);
+ break;
+ case RBAArbitrationPolicy::DEFAULT:
+ case RBAArbitrationPolicy::PRIORITY_LAST_COME_FIRST:
+ states.sort(&RBAContentState::comparePriorityLastComeFirst);
+ break;
+ default:
+ isResult = false;
+ break;
+ }
+
+ return isResult;
+}
+
+/**
+ * @brief Get re-arbitration list from judgment NG constraint
+ * @param totalRevisitAllocatables
+ * @param allocatable
+ * @param falseConstraints
+ * @param revisited
+ */
+void
+RBAArbitrator::
+collectRevisitAllocatable(std::list<const RBAAllocatable*>* const totalRevisitAllocatables,
+ RBAAllocatable*& allocatable,
+ std::list<RBAConstraintImpl*>& falseConstraints,
+ std::set<const RBAAllocatable*>& revisited)
+{
+ std::set<const RBAAllocatable*> revisitAllocatablesSet;
+
+  // Determine if re-arbitration should be done based on the constraint
+ // that the determination was NG
+ for(RBAConstraintImpl*& constraint : falseConstraints) {
+ // Get Contraint information
+ const RBAConstraintInfo* const info {constraint->getInfo()};
+ // Allocatable, a candidate for re-arbitration
+ std::set<const RBAAllocatable*> rightFalseAllocatables;
+
+ if (info->needsRearbitrationFor(allocatable)) {
+ info->collectRearbitrationTargetFor(allocatable, rightFalseAllocatables, false);
+ }
+ if (rightFalseAllocatables.empty()) {
+ // Non-implication constraint expression
+ // To ensure that "currently arbitrated allocable" does not lose to lower
+ // priority allocable, arbitration of low priority Allocable is performed
+ // if low priority Allocable is included in
+ // "re-arbitration candidate Allocable".
+ info->collectFalseAllocatables(rightFalseAllocatables);
+ bool isContainsLowPriorityAllocatable {false};
+ for(const RBAAllocatable* const rightFalseAllocatable
+ : rightFalseAllocatables) {
+ if(RBAAllocatable::compareIndex(allocatable,rightFalseAllocatable)) {
+ // index is smaller for higher priority allocable
+ isContainsLowPriorityAllocatable = true;
+ break;
+ }
+ }
+ if(!isContainsLowPriorityAllocatable) {
+ continue;
+ }
+ }
+
+ // Remove Allocable during arbitration from re-arbitration target
+ static_cast<void>(rightFalseAllocatables.erase(allocatable));
+
+ // If even one Allocable candidate for re-arbitration has been
+ // re-arbitrated, re-arbitration will not be performed again.
+ // Go to next content assignment
+ for(const RBAAllocatable* const rightFalseAllocatable : rightFalseAllocatables) {
+ if(revisited.find(rightFalseAllocatable) != revisited.end()) {
+ return;
+ }
+ }
+
+ // Set re-arbitration Allocable
+ for(const RBAAllocatable* const alloc : rightFalseAllocatables) {
+ static_cast<void>(revisitAllocatablesSet.insert(alloc));
+ }
+ }
+
+ // Re-arbitration Allocatable exists
+ if(!(revisitAllocatablesSet.empty())) {
+ // copy std::set to std::list
+ static_cast<void>(totalRevisitAllocatables->insert(totalRevisitAllocatables->end(),
+ revisitAllocatablesSet.begin(),
+ revisitAllocatablesSet.end()));
+ // Sort re-arbitration Areas in ascending order based on priority
+ // It is necessary to sort by index comparison considering the order of models.
+ totalRevisitAllocatables->sort(&RBAAllocatable::compareIndex);
+ }
+}
+
+/**
+ * Confirm cancellation of all content status
+ * to cancel Request which lost in arbitration
+ */
+void
+RBAArbitrator::
+postArbitrate()
+{
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine("----Cancel Request----");
+#endif
+ for(const RBAContentState* const state : model_->getContentStates()) {
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine("Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] check start");
+#endif
+ static_cast<void>(cancelChecked_.insert(state));
+ if(!result_->isActive(state)) {
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine(" Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] is not Active skip");
+#endif
+ continue;
+ }
+ if(result_->isAlreadyOutputting(state)) {
+#ifdef RBA_USE_LOG
+ std::string contTypeName;
+ if(state->isViewContentState()) {
+ contTypeName = "Visible";
+ }
+ else {
+ contTypeName = "Sounding";
+ }
+ RBALogManager::cancelRequestLogLine(" Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] is "+contTypeName+" skip");
+#endif
+ continue;
+ }
+
+ changeContentStateCancelWithPolicy(state);
+ }
+
+#ifdef RBA_USE_LOG
+ // Log output for coverage of request cancellation
+ for(const RBAContentState* state : model_->getContentStates()) {
+ std::string contentName = state->getOwner()->getElementName();
+ std::string stateName = state->getElementName();
+ std::string canceled = isCancel(state) ? "t" : "f";
+ RBALogManager::coverageCanceledRequestLogLine(
+ contentName + "," + stateName + ',' +canceled);
+ }
+#endif
+}
+
+/**
+ * @brief Change the cancellation information of hidden Content status
+ based on arbitration results and cancellation policy
+ * @param state
+ */
+void
+RBAArbitrator::
+changeContentStateCancelWithPolicy(const RBAContentState* const state)
+{
+ switch(dynamic_cast<RBAContent*>(state->getOwner())->getContentLoserType()) {
+ case RBAContentLoserType::GOOD_LOSER:
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine(" Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] is Canceled because GOOD_LOSER");
+#endif
+ setCancel(state, true);
+ break;
+ case RBAContentLoserType::NEVER_GIVEUP:
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine(" Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] is not Canceled because NEVER_GIVEUP");
+#endif
+ setCancel(state, false);
+ break;
+ case RBAContentLoserType::DO_NOT_GIVEUP_UNTIL_WIN:
+ if(state->isModelElementType(RBAModelElementType::ViewContentState)) {
+ if(result_->isPreVisible(dynamic_cast<const RBAViewContentStateImpl*>(state))) {
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine(" Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] is Canceled because DO_NOT_GIVEUP_UNTIL_WIN");
+#endif
+ setCancel(state, true);
+ } else {
+#ifdef RBA_USE_LOG
+ RBALogManager::cancelRequestLogLine(" Content["+
+ state->getOwner()->getElementName()+"::"+
+ state->getElementName()+
+ "] is not Canceled because DO_NOT_GIVEUP_UNTIL_WIN");
+#endif
+ setCancel(state, false);
+ }
+ }
+ else {
+ if(result_->isPreSounding(dynamic_cast<const RBASoundContentStateImpl*>(state))) {
+ setCancel(state, true);
+ } else {
+ setCancel(state, false);
+ }
+ }
+ break;
+ default:
+ break;
+ }
+}
+
+#ifdef RBA_USE_LOG
+void
+RBAArbitrator::
+checkAllConstraints()
+{
+ std::string log;
+ LOG_arbitrateConstraintLogLine("----Check All Constraint----");
+
+ if(simulationMode_) {
+ for(const RBAConstraintImpl* constraint : model_->getConstraintImpls()) {
+ bool result = const_cast<RBAConstraintImpl*>(constraint)->execute(this);
+ if(result == false) {
+ result_->addFailedConstraint(constraint);
+ }
+ if (constraint->isRuntime() == true) {
+ log += "online ";
+ } else {
+ log += "offline ";
+ }
+ log += "constraint[" + constraint->getElementName() + "] ";
+ log += "result[" + RBALogManager::boolToString(result) + "]\n";
+ }
+ if (log.empty() != true ) {
+ log.erase(log.end() - 1, log.end()); // Remove last line break
+ }
+ }
+
+}
+#endif
+
+void
+RBAArbitrator::
+checkCancelContent() const
+{
+ for(const RBAViewContentState* const viewState
+ : result_->getActiveViewContentStates()) {
+ if(result_->isCancel(viewState)) {
+ result_->cancelContentState(dynamic_cast<const RBAContentState*>(viewState));
+ }
+ }
+ for(const RBASoundContentState* const soundState
+ : result_->getActiveSoundContentStates()) {
+ if(result_->isCancel(soundState)) {
+ result_->cancelContentState(dynamic_cast<const RBAContentState*>(soundState));
+ }
+ }
+}
+
+/**
+ * @brief Update display and non-dislay Allocatable List
+ */
+void
+RBAArbitrator::
+updateResult()
+{
+ // Deactivate canceled Content
+ result_->updateActiveContentStates();
+
+ // Update coordinates of Area
+ for(auto& area : result_->getVisibleAreas()) {
+ const RBAAreaImpl* const areaImpl {dynamic_cast<const RBAAreaImpl*>(area)};
+ const auto posCont = model_->findPositionContainerImpl(area->getName());
+ const auto sizeObj = result_->getSize(area);
+ if((posCont != nullptr) && (sizeObj != nullptr)) {
+ const auto offset = posCont->getOffset(sizeObj->getName());
+ const_cast<RBAAreaImpl*>(areaImpl)->setOffsetX(offset.first);
+ const_cast<RBAAreaImpl*>(areaImpl)->setOffsetY(offset.second);
+ }
+ }
+
+ // Set output Content state list
+ std::set<const RBAContentState*> outputtingContentStateSet;
+ for(auto& alloc : result_->getOutputtingAllocatables()) {
+ const auto state = result_->getAllocatedContentState(alloc);
+ static_cast<void>(outputtingContentStateSet.insert(state));
+ }
+ for(auto& state : outputtingContentStateSet) {
+ static_cast<void>(result_->addOutputtingContentState(state));
+ }
+
+ for(auto& state : result_->getActiveContentStates()) {
+ // If the Area allocated in the display request is not displayed,
+ // set it to "Stanby Content".
+ const auto allocs = result_->getAllocatable(state);
+ if(allocs.empty()) {
+ result_->addStandbyContent(dynamic_cast<RBAContent*>(state->getOwner()));
+ }
+ }
+}
+
+/**
+ * ### Generate result information
+ *
+ * Generate animation information (RBAViewAction) and register it in the
+ * viewActions list of RBAResult.
+ * The animation information generation pattern is as follows.
+ * | Area A(pre) | Area B(pre) | Area A(cur) | Area B(cur) | type |
+ * |:-: |:-: |:-: |:-: |:---- |
+ * | (none) | - | **content** | - | TRANSITON_ADD |
+ * | **content** | - | (none) | - | TRANSITION_REMOVE |
+ * | **contentA** | - | **contentB** | - | TRANSITION_REPLACE |
+ * | **content** | (none) | (none) | **content** | MOVE |
+ */
+void
+RBAArbitrator::
+createResultData()
+{
+ std::list<std::unique_ptr<RBAViewAction>> actions;
+ // Check the Areas that have not changed
+ std::set<const RBAArea*> stableAreas;
+ for(const RBAArea* const preArea : result_->getPreVisibleAreas()) {
+ if(result_->isVisible(preArea)) {
+ const RBAViewContent* const curContent {result_->getContentState(preArea)->getOwner()};
+ const RBAViewContent* const preContent {result_->getPreContentState(preArea)->getOwner()};
+ if(curContent == preContent) {
+ static_cast<void>(stableAreas.insert(preArea));
+ }
+ }
+ }
+ // Check "MOVE"
+ std::set<const RBAViewContent*> movedContents;
+ for(const RBAArea* curArea : result_->getVisibleAreas()) {
+ // Current display Area
+ const RBAViewContentState* curState {result_->getContentState(curArea)};
+ const RBAViewContent* const curContent {curState->getOwner()};
+ // Skip stable Area
+ if(stableAreas.find(curArea) != stableAreas.end()) {
+ continue;
+ }
+ for(const RBAArea* preArea : result_->getPreVisibleAreas()) {
+ // Do not consider stable areas to have changed
+ if (stableAreas.find(preArea) != stableAreas.end()) {
+ continue;
+ }
+ // Previous display Area
+ const RBAViewContent* const preContent {result_->getPreContentState(preArea)->getOwner()};
+ if(curContent == preContent) {
+ // "MOVE" if there is matching content
+ actions.push_back(std::make_unique<RBAViewMove>(preArea, curArea,
+ curState));
+ // Check moved Content
+ static_cast<void>(movedContents.insert(curState->getOwner()));
+ }
+ }
+ }
+ // Check "REMOVE"
+ for(const RBAArea* preArea : result_->getPreVisibleAreas()) {
+ // Skip stable Area
+ if(stableAreas.find(preArea) != stableAreas.end()) {
+ continue;
+ }
+ const RBAViewContentState* preState {result_->getPreContentState(preArea)};
+ // Skip if Content is "MOVE"
+ if(movedContents.find(preState->getOwner())
+ != movedContents.end()) {
+ continue;
+ }
+ if(!result_->isVisible(preArea)) {
+ // If the previously displayed Area isn't displayed, it is REMOVE.
+ actions.push_back(std::make_unique<RBAViewTransition>(
+ RBAViewActionType::TRANSITION_REMOVE, preArea, preState));
+ }
+ }
+ // Check Examine ADD/REMOVE and REPLACE related to MOVE
+ for(const RBAArea* curArea : result_->getVisibleAreas()) {
+ // Display Area at this time
+ // Skip stable Area
+ if(stableAreas.find(curArea) != stableAreas.end()) {
+ continue;
+ }
+ const RBAViewContentState* curState {result_->getContentState(curArea)};
+ const RBAViewContent* const curContent {curState->getOwner()};
+ const RBAViewContentState* preState {result_->getPreContentState(curArea)};
+
+ if(movedContents.find(curContent) != movedContents.end()) {
+ if((preState != nullptr) && (!result_->isVisible(preState))) {
+ // If the previously displayed content isn't displayed, it is REMOVE.
+ actions.push_back(std::make_unique<RBAViewTransition>(
+ RBAViewActionType::TRANSITION_REMOVE,
+ curArea, preState));
+ }
+ else {
+ continue;
+ }
+ }
+ else if(result_->isPreVisible(curArea)) {
+ // It was the display Area last time
+ // If pre is MOVE content
+ const RBAViewContent* const preContent {preState->getOwner()};
+ if(movedContents.find(preContent) != movedContents.end()) {
+ // Content at this time is ADD
+ actions.push_back(std::make_unique<RBAViewTransition>(
+ RBAViewActionType::TRANSITION_ADD,
+ curArea, curState));
+ }
+ else if(curContent != preContent) {
+ // REPLACE because the content is different
+ actions.push_back(std::make_unique<RBAViewTransition>(
+ RBAViewActionType::TRANSITION_REPLACE,
+ curArea, preState, curState));
+ } else {
+ ;
+ }
+ }
+ else {
+ // ADD because it was not the display Area last time
+ actions.push_back(std::make_unique<RBAViewTransition>(
+ RBAViewActionType::TRANSITION_ADD,
+ curArea, curState));
+ }
+ }
+
+ // Sort and register
+ actions.sort(&compareViewAction);
+ for(auto& action : actions) {
+ result_->addViewAction(action);
+ }
+}
+
+void
+RBAArbitrator::differenceArbitrate()
+{
+#ifdef RBA_USE_LOG
+ // Set request information in log
+ RBALogManager::setType(RBALogManager::TYPE_REQUEST);
+ logRequestArbitration();
+ RBALogManager::setType(RBALogManager::TYPE_PREVIOUS_RESULT);
+ logPreResultArbitration();
+ logRequestForCoverage();
+#endif
+
+ for (auto& a : model_->getSortedAllocatables()) {
+ a->clearStatus();
+ }
+
+ // ----------------------------------------------------------
+ // Arbitration
+ // ----------------------------------------------------------
+ // Priority and post-win arbitoration
+ // (Value arbitration is the same as priority arbitration)
+#ifdef RBA_USE_LOG
+RBALogManager::setType(RBALogManager::TYPE_ARBITRATE);
+#endif
+ arbitrate(model_->getSortedAllocatables());
+
+ // ----------------------------------------------------------
+ // Post processing of arbitration
+ // ----------------------------------------------------------
+#ifdef RBA_USE_LOG
+RBALogManager::setType(RBALogManager::TYPE_CANCEL_REQUEST);
+#endif
+ // when the constraint expression is evaluated by satisfiesConstraints(),
+ // if the cancel state is different from the time when execute() is executed,
+ // the result may be false. Therefore, it is necessary to store
+ // the state before cancellation processing.
+ // When performing the constraint expression evaluation in
+ // satisfiedConstraints(), restore to this value and evaluate.
+ resultSetForSatisfiesConstraints_ = std::make_unique<RBAResultSet>(
+ *result_->getCurResultSet());
+ postArbitrate();
+
+ // Move offline Constraint
+#ifdef RBA_USE_LOG
+RBALogManager::setType(RBALogManager::TYPE_CHECK_ALL_CONSTRAINTS);
+ checkAllConstraints();
+#endif
+
+ // ----------------------------------------------------------
+ // Update Content state
+ // ----------------------------------------------------------
+ for (auto& c : model_->getContents()){
+ const_cast<RBAContent*>(c)->updateStatus(result_.get());
+ }
+
+ backupResultSet_ = result_->createBackupCurrentResultSet();
+ nextResultSet_ = result_->createNextCurrentResultSet();
+
+#ifdef RBA_USE_LOG
+ logResultForCoverage();
+#endif
+}
+
+bool
+RBAArbitrator::
+checkConstraints( std::list<RBAConstraintImpl*>& constraints,
+ std::list<RBAConstraintImpl*>& falseConstraints,
+ const RBAAllocatable* const allocatable)
+{
+ bool containsSkip {false};
+ for (const auto& constraint : constraints) {
+ const bool isPassed {constraint->execute(this)};
+ if (isPassed == false) {
+ falseConstraints.push_back(constraint);
+ }
+ if (constraint->getInfo()->isExceptionBeforeArbitrate()) {
+ if (constraint->getInfo()->needsReRearbitrationFor(allocatable)) {
+ containsSkip = true;
+ }
+ }
+ }
+ return containsSkip;
+}
+
+bool
+RBAArbitrator::
+checkConstraintAndReArbitrate(RBAAllocatable* allocatable,
+ std::set<const RBAAllocatable*>& revisited,
+ const std::int32_t nest,
+ RBAAffectInfo* const affectInfo,
+ RBARollbacker* const parentRollbacker,
+ std::list<RBAConstraintImpl*>& constraints,
+ bool * const isSkipped,
+ const bool isFinal)
+{
+ bool isPassed {false};
+ std::list<RBAConstraintImpl*> falseConstraints;
+ const bool containsSkip {checkConstraints(constraints, falseConstraints, allocatable)};
+ if(falseConstraints.empty()) {
+ *isSkipped = (*isSkipped || containsSkip);
+ if(!containsSkip && !*isSkipped && isFinal) {
+ static_cast<void>(revisited.insert(allocatable));
+ }
+ isPassed = true;
+ } else {
+ std::list<const RBAAllocatable*> revisitAllocatables;
+ collectRevisitAllocatable(&revisitAllocatables, allocatable, falseConstraints, revisited);
+ if(!(revisitAllocatables.empty())) {
+ // There is re-arbitration Allocatable.
+ // Generates backup information for rollback when re-arbitration fails.
+ // For efficiency, instantiate only once when re-arbitration is needed
+ // for the first time.
+ // Since it is backed up after content allocation,
+ // it is necessary to set NULL to the allocated content after rollback.
+
+ // Rollback information when arbitration fails
+ std::shared_ptr<RBARollbacker> rollbacker {std::make_shared<RBARollbacker>()};
+ if (parentRollbacker != nullptr) {
+ parentRollbacker->addChild(rollbacker);
+ }
+ rollbacker->backup(revisitAllocatables);
+ // Initialize all re-arbitration Allocatable
+ for (auto& a : revisitAllocatables) {
+ const_cast<RBAAllocatable*>(a)->clearChecked();
+ }
+ // --------------------------------------------------
+ // Re-arbitrate "Allocatable" that has not been re-arbitrated
+ // in the re-arbitration candidate list
+ // --------------------------------------------------
+ static_cast<void>(revisited.insert(allocatable));
+ for(const RBAAllocatable* const revisitAllocatable : revisitAllocatables) {
+ LOG_arbitrateAreaLogLine( " " +
+ revisitAllocatable->getSymbol() + "["
+ + revisitAllocatable->getElementName()
+ + "] revisit allocatable check start");
+ arbitrateAllocatable(const_cast<RBAAllocatable*>(revisitAllocatable),
+ revisited, nest + 1, affectInfo, rollbacker.get());
+ }
+ for(const RBAAllocatable* const revisitAllocatable : revisitAllocatables) {
+ static_cast<void>(revisited.erase(revisitAllocatable));
+ }
+ // --------------------------------------------------
+ // Check if content allocation succeeded as a result of re-arbitration
+ // --------------------------------------------------
+ falseConstraints.clear();
+ static_cast<void>(checkConstraints(constraints, falseConstraints, allocatable));
+ if (falseConstraints.empty()) {
+ // The content of the allocatable allocation is fixed by re-arbitration,
+ // so exit the loop and proceed to the next allocatable.
+ // In some cases, "Allocatable" is re-arbitrated due to recursion and
+ // allocated Content is lost, but go to the next Allocable because
+ // all contents have been checked
+ isPassed = true;
+ } else {
+ // Roll back arbitration status and affected information
+ rollbacker->rollback();
+ if (parentRollbacker != nullptr) {
+ parentRollbacker->removeChild(rollbacker);
+ }
+ }
+ }
+ }
+ if (isPassed == false) {
+ //Collect Areas that affected the area in arbitration status
+ std::set<const RBAAllocatable*> allocatablesWhichHaveAffectedToThisAllocatable;
+
+ for (const RBAConstraintImpl* const constraint : falseConstraints) {
+ constraint->getInfo()->collectAffectedAllocatables(
+ false, allocatablesWhichHaveAffectedToThisAllocatable, false,
+ false);
+ }
+ static_cast<void>(allocatablesWhichHaveAffectedToThisAllocatable.erase(allocatable));
+
+ // Record fact that affected the area being arbitrated on Area that
+ // affected Area during arbitration.
+ // The re-arbitration of the affected area is recorded in AffectInfo,
+ // so it does not record the re-arbitrated area.
+ for (const RBAAllocatable* const a : allocatablesWhichHaveAffectedToThisAllocatable) {
+ if (!(affectInfo->alreadyKnowsThatFormerHasAffectedToLatter(a,
+ allocatable))) {
+ const_cast<RBAAllocatable*>(a)->addAllocatableWhichHasBeenAffectedByYou(
+ allocatable);
+ affectInfo->addInfoThatFormerAffectedToLatter(a, allocatable);
+ }
+ }
+ }
+ return isPassed;
+}
+
+void
+RBAArbitrator::
+setCancel(const RBAContentState* const state, const bool checked)
+{
+ result_->setCancel(state, checked);
+}
+
+bool
+RBAArbitrator::
+isCancel(const RBAContentState* const state) const
+{
+ if(state->isViewContentState()) {
+ return result_->isCancel(state);
+ }
+ else {
+ return result_->isCancel(state);
+ }
+}
+
+void
+RBAArbitrator::
+getSortedContentStates(const RBAAllocatable* const allocatable,
+ std::list<const RBAContentState*>& contentStates) const
+{
+ for (const RBAContent* const content : allocatable->getInternalContents()) {
+ const RBAContentState* const state {result_->getActiveState(content)};
+ if (state != nullptr) {
+ contentStates.push_back(state);
+#ifdef RBA_USE_LOG
+ } else {
+ RBALogManager::arbitrateContentLogLine(
+ " Content[" + content->getElementName() + "] is not Active skip");
+#endif
+ }
+ }
+ static_cast<void>(sortContentStates(allocatable, contentStates));
+ // Add null at the end, to evaluate constraint expression when unassigned
+ contentStates.push_back(nullptr);
+}
+
+std::int32_t
+RBAArbitrator::
+getViewActionPriority(const RBAViewActionType viewActionType)
+{
+ std::int32_t result{0};
+
+ switch(viewActionType) {
+ case RBAViewActionType::TRANSITION_REMOVE:
+ result = 4;
+ break;
+ case RBAViewActionType::MOVE:
+ result = 3;
+ break;
+ case RBAViewActionType::TRANSITION_ADD:
+ result = 2;
+ break;
+ case RBAViewActionType::TRANSITION_REPLACE:
+ result = 1;
+ break;
+ default:
+ break;
+ }
+
+ return result;
+}
+
+bool
+RBAArbitrator::
+compareViewAction(const std::unique_ptr<RBAViewAction>& lhs,
+ const std::unique_ptr<RBAViewAction>& rhs)
+{
+ const std::int32_t lval {getViewActionPriority(lhs->getViewActionType())};
+ const std::int32_t rval {getViewActionPriority(rhs->getViewActionType())};
+
+ return lval > rval;
+}
+
+RBAResultImpl*
+RBAArbitrator::getResult() const
+{
+ return result_.get();
+}
+
+void RBAArbitrator::setResult(std::unique_ptr<RBAResultImpl> result)
+{
+ result_ = std::move(result);
+}
+
+std::set<const RBAContentState*>& RBAArbitrator::getCancelChecked()
+{
+ return cancelChecked_;
+}
+
+std::unique_ptr<RBAResultImpl>& RBAArbitrator::getResultRef() const
+{
+ return result_;
+}
+
+std::unique_ptr<RBAResultSet>& RBAArbitrator::getNextResultSet()
+{
+ return nextResultSet_;
+}
+
+void RBAArbitrator::setNextResultSet(std::unique_ptr<RBAResultSet> nextResultSet)
+{
+ nextResultSet_ = std::move(nextResultSet);
+}
+
+std::unique_ptr<RBAResultSet>& RBAArbitrator::getBackupResultSet()
+{
+ return backupResultSet_;
+}
+
+void RBAArbitrator::setBackupResultSet(std::unique_ptr<RBAResultSet> backupResultSet)
+{
+ backupResultSet_ = std::move(backupResultSet);
+}
+
+std::unique_ptr<RBAResultSet>& RBAArbitrator::getReservedResultSet()
+{
+ return reservedResultSet_;
+}
+
+void RBAArbitrator::setReservedResultSet(std::unique_ptr<RBAResultSet> reservedResultSet)
+{
+ reservedResultSet_ = std::move(reservedResultSet);
+}
+
+std::recursive_mutex& RBAArbitrator::getMutex() const
+{
+ return mutex_;
+}
+
+#ifdef RBA_USE_LOG
+void RBAArbitrator::setSimulationMode(bool simulationMode)
+{
+ simulationMode_ = simulationMode;
+}
+#endif
+
+std::deque<std::unique_ptr<RBARequestQueMember>>& RBAArbitrator::getRequestQue()
+{
+ return requestQue_;
+}
+
+#ifdef RBA_USE_LOG
+/**
+ * Output request information for log view
+ */
+void
+RBAArbitrator::logRequestArbitration()
+{
+ const std::list<const RBAAllocatable*> allocatables =
+ model_->getAllocatables();
+ RBALogManager::requestLogLine("----Request Information----");
+ RBALogManager::requestLogLine(
+ "Allocatable Count:" + std::to_string(allocatables.size()));
+ for (const RBAAllocatable* allocatable : allocatables) {
+ RBALogManager::requestLogLine(
+ " " + allocatable->getSymbol() + "[" + allocatable->getElementName()
+ + "] policy[" + allocatable->getArbitrationPolicyString()
+ + "] visibility[" + allocatable->getVisibilityString() + "]");
+ }
+
+ const std::list<const RBAContentState*> contentStates = model_
+ ->getContentStates();
+ RBALogManager::requestLogLine(
+ "ContentState Count:" + std::to_string(contentStates.size()));
+ for (const RBAContentState* contentState : contentStates) {
+ std::string active;
+ if (contentState->getModelElementType() == RBAModelElementType::ViewContentState) {
+ active = RBALogManager::boolToString(
+ result_->isActive(
+ dynamic_cast<const RBAViewContentState*>(contentState)));
+ } else {
+ active = RBALogManager::boolToString(
+ result_->isActive(
+ dynamic_cast<const RBASoundContentState*>(contentState)));
+ }
+ RBALogManager::requestLogLine(
+ " " + dynamic_cast<RBAContent*>(contentState->getOwner())->getSymbol() + "["
+ + contentState->getOwner()->getElementName() + "::"
+ + contentState->getElementName() + "] priority["
+ + contentState->getPriorityString() + "] isActive[" + active
+ + "] order[" + contentState->getOrderString() + "]");
+ }
+
+ const std::list<const RBAScene*> scenes = model_->getScenes();
+ RBALogManager::requestLogLine("Scene Count:" + std::to_string(scenes.size()));
+ for (const RBAScene* scene : scenes) {
+ RBALogManager::requestLogLine(
+ " Scene[" + scene->getName() + "] isActive["
+ + RBALogManager::boolToString(result_->isActive(scene))
+ + "]");
+ }
+
+ std::list<RBAConstraint*> constraints = model_->getConstraints();
+ RBALogManager::requestLogLine(
+ "Constraint Count:" + std::to_string(constraints.size()));
+ for (RBAConstraint* constraint : constraints) {
+ RBAConstraintImpl* impl = dynamic_cast<RBAConstraintImpl*>(constraint);
+ RBALogManager::requestLogLine(
+ " Constraint[" + impl->getName() + "] Expression["
+ + impl->getExpression()->getExpressionText() + "] runtime["
+ + RBALogManager::boolToString(impl->isRuntime()) + "]");
+ }
+
+}
+
+/**
+ * Output previous arbitration result for log view
+ */
+void
+RBAArbitrator::logPreResultArbitration()
+{
+ RBALogManager::resultLogLine("----Previous Result Information----");
+
+ auto allocs = model_->getAllocatables();
+ RBALogManager::resultLogLine("Allocatable TotalCount:"
+ + std::to_string(allocs.size()));
+ for (auto& alloc : allocs) {
+ auto contentState = result_->getPreContentState(alloc);
+ auto hidden = result_->isPreHidden(alloc);
+ std::string str = " " + alloc->getSymbol()
+ + "[" + alloc->getElementName() + "] Content[";
+ if (contentState == nullptr) {
+ str += "null";
+ } else {
+ str += contentState->getOwner()->getElementName()
+ + "::" + contentState->getElementName();
+ }
+ str += "] " + alloc->getHiddenSymbol()
+ + "[" + RBALogManager::boolToString(hidden) + "]";
+ if (alloc->isZone() == true) {
+ str += " attenuated[";
+ str += RBALogManager::boolToString(
+ result_->isPreAttenuated(dynamic_cast<const RBAZone*>(alloc)));
+ str += "]";
+ }
+ RBALogManager::resultLogLine(str);
+ if (contentState && !hidden) {
+ RBALogManager::coveragePrevResultLogLine(
+ "A," + alloc->getElementName() + ","
+ + contentState->getOwner()->getElementName() + ","
+ + contentState->getElementName());
+ }
+ }
+
+ auto contents = model_->getContents();
+ RBALogManager::resultLogLine("Content TotalCount:"
+ + std::to_string(contents.size()));
+ for (auto& content : contents) {
+ auto state = result_->getPreActiveState(content);
+ bool isOutputting = false;
+ bool isActive = false;
+ if (state != nullptr) {
+ isActive = true;
+ isOutputting = result_->isPreOutputting(state);
+ }
+ RBALogManager::resultLogLine(
+ " " + content->getSymbol() + "[" + content->getElementName() + "] "
+ + content->getVisibleSymbol() + "["
+ + RBALogManager::boolToString(isOutputting) + "] active["
+ + RBALogManager::boolToString(isActive) + "]");
+ for (auto alloc : content->getAllocatables()) {
+ auto allocatedState = result_->getPreContentState(alloc);
+ if ((allocatedState != nullptr)
+ && (allocatedState->getOwner() == content)) {
+ RBALogManager::resultLogLine(
+ " allocated " + alloc->getSymbol() + "["
+ + alloc->getElementName() + "]");
+ }
+ }
+ }
+}
+
+/**
+ * Output current arbitration result for log view
+ */
+void
+RBAArbitrator::logResultArbitration()
+{
+ RBALogManager::resultLogLine("----Result Information----");
+
+ const std::list<const RBAAllocatable*> allocatables
+ = model_->getAllocatables();
+ RBALogManager::resultLogLine("Allocatable TotalCount:" + std::to_string(allocatables.size()));
+ for(const RBAAllocatable* allocatable : allocatables) {
+ const RBAContentState* contentState = result_->getContentState(allocatable);
+ std::string str = " ";
+ str += allocatable->getSymbol();
+ str += "[";
+ str += allocatable->getElementName();
+ str += "] Content[";
+ if (contentState == nullptr) {
+ str += "null";
+ } else {
+ str += contentState->getOwner()->getElementName() + "::"
+ + contentState->getElementName();
+ }
+ str += "] ";
+ str += allocatable->getHiddenSymbol();
+ str += "[";
+ str += RBALogManager::boolToString(result_->isHidden(allocatable));
+ str += "]";
+ if (allocatable->isZone() == true) {
+ str += " attenuated[";
+ str += RBALogManager::boolToString(result_->isAttenuated(dynamic_cast<const RBAZone*>(allocatable)));
+ str += "]";
+ }
+ RBALogManager::resultLogLine(str);
+ }
+
+ const std::list<const RBAContent*> contents = model_->getContents();
+ RBALogManager::resultLogLine("Content TotalCount:" + std::to_string(contents.size()));
+ for(const RBAContent* content : contents) {
+ bool isOutputting = false;
+ bool isCancel = false;
+ const RBAContentState* state = result_->getActiveState(content);
+ if(state != nullptr) {
+ isOutputting = result_->isOutputting(state);
+ } else {
+ for(const RBAContentState* state : content->getStates()) {
+ isCancel |= result_->isCancel(state);
+ }
+ }
+ RBALogManager::resultLogLine(" "
+ + content->getSymbol()
+ + "["
+ + content->getElementName()
+ + "] "
+ + content->getVisibleSymbol()
+ + "["
+ + RBALogManager::boolToString(isOutputting)
+ + "] cancel["
+ + RBALogManager::boolToString(isCancel)
+ + "]");
+ for(const RBAAllocatable* allocatable : content->getAllocatables()) {
+ const RBAContentState* allocatedState
+ = result_->getContentState(allocatable);
+ if((allocatedState != nullptr) && (allocatedState->getOwner() == content)) {
+ RBALogManager::resultLogLine(" allocated "
+ + allocatable->getSymbol() + "["
+ + allocatable->getElementName() + "]");
+ }
+ }
+ }
+}
+
+/**
+ * For coverage: Output request information
+ */
+void
+RBAArbitrator::logRequestForCoverage()
+{
+ for(const RBAContentState* contentState : model_->getContentStates()) {
+ std::ostringstream oss;
+ oss << "C,";
+ if(result_->isActive(contentState)) {
+ oss << "on,";
+ }
+ else {
+ oss << "off,";
+ }
+ oss << contentState->getOwner()->getElementName() << ",";
+ oss << contentState->getElementName() << ",";
+ oss << contentState->getContentStateOrder();
+ RBALogManager::coverageRequestLogLine(oss.str());
+ }
+ for(const RBAScene* scene : model_->getScenes()) {
+ std::ostringstream oss;
+ oss << "S,";
+ if(result_->isActive(scene)) {
+ oss << "on,";
+ }
+ else {
+ oss << "off,";
+ }
+ oss << scene->getName();
+ for(const auto& name : scene->getPropertyNames()) {
+ std::int32_t value {result_->getSceneProperty(scene, name)};
+ oss << ",";
+ oss << name;
+ oss << ":";
+ oss << value;
+ }
+ RBALogManager::coverageRequestLogLine(oss.str());
+ }
+}
+
+/**
+ * For coverage: Output result information
+ */
+void
+RBAArbitrator::logResultForCoverage()
+{
+ for(const RBAAllocatable* allocatable : model_->getAllocatables()) {
+ std::ostringstream oss;
+ oss << "A,";
+ oss << allocatable->getElementName() + ",";
+ const RBAContentState* contentState = result_->getContentState(allocatable);
+ if((contentState != nullptr) && (!result_->isHidden(allocatable))) {
+ oss << contentState->getOwner()->getElementName();
+ }
+ RBALogManager::coverageResultLogLine(oss.str());
+ }
+}
+
+void
+RBAArbitrator::setLogToResult()
+{
+ std::ostringstream oss;
+ oss << RBALogManager::getAllConstraintLog();
+ oss << RBALogManager::getRequestLog();
+ oss << RBALogManager::getPreviousResultLog();
+ oss << RBALogManager::getArbitrateLog();
+ oss << RBALogManager::getCancelRequestLog();
+ oss << RBALogManager::getCheckAllConstraintLog();
+ oss << RBALogManager::getResultLog();
+ result_->setLog(oss.str());
+}
+#endif
+
+}
diff --git a/src/core/logic/RBABackUpAllocatable.cpp b/src/core/logic/RBABackUpAllocatable.cpp
new file mode 100644
index 0000000..2843db1
--- /dev/null
+++ b/src/core/logic/RBABackUpAllocatable.cpp
@@ -0,0 +1,33 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * BackUpAllocatable class
+ */
+
+#include "RBABackUpAllocatable.hpp"
+
+namespace rba
+{
+
+RBABackUpAllocatable::RBABackUpAllocatable(const std::string& name)
+ : RBARuleObject{name},
+ RBAAllocatable{name}
+{
+}
+
+}
+
diff --git a/src/core/logic/RBABackUpAllocatable.hpp b/src/core/logic/RBABackUpAllocatable.hpp
new file mode 100644
index 0000000..a57aa01
--- /dev/null
+++ b/src/core/logic/RBABackUpAllocatable.hpp
@@ -0,0 +1,42 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * BackUpAllocatable class header
+ */
+
+#ifndef RBABACKUPALLOCATABLE_HPP
+#define RBABACKUPALLOCATABLE_HPP
+
+#include "RBAAllocatable.hpp"
+
+namespace rba
+{
+class RBABackUpAllocatable : public RBAAllocatable
+{
+public:
+ explicit RBABackUpAllocatable(const std::string& name);
+ RBABackUpAllocatable(const RBABackUpAllocatable&)=delete;
+ RBABackUpAllocatable(const RBABackUpAllocatable&&)=delete;
+ RBABackUpAllocatable& operator=(const RBABackUpAllocatable&)=delete;
+ RBABackUpAllocatable& operator=(const RBABackUpAllocatable&&)=delete;
+ virtual ~RBABackUpAllocatable()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBACommonMakerTable.cpp b/src/core/logic/RBACommonMakerTable.cpp
new file mode 100644
index 0000000..dde13b7
--- /dev/null
+++ b/src/core/logic/RBACommonMakerTable.cpp
@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBACommonMakerTable.cpp
+/// @brief Expression element maker table class definition file
+
+#include "RBACommonMakerTable.hpp"
+#include "RBAActiveStateMaker.hpp"
+#include "RBAAllocatedContentMaker.hpp"
+#include "RBAActiveContentsMaker.hpp"
+#include "RBAAndOperatorMaker.hpp"
+#include "RBAContentValueMaker.hpp"
+#include "RBAExistsOperatorMaker.hpp"
+#include "RBAForAllOperatorMaker.hpp"
+#include "RBAGetAllocatablesMaker.hpp"
+#include "RBAGetContentsListMaker.hpp"
+#include "RBAGetPropertyMaker.hpp"
+#include "RBAHasBeenDisplayedMaker.hpp"
+#include "RBAHasComeEarlierThanMaker.hpp"
+#include "RBAHasComeLaterThanMaker.hpp"
+#include "RBAIfStatementMaker.hpp"
+#include "RBAImpliesOperatorMaker.hpp"
+#include "RBAIntegerValueMaker.hpp"
+#include "RBAIsActiveMaker.hpp"
+#include "RBAIsEqualToOperatorMaker.hpp"
+#include "RBAIsGreaterThanEqualOperatorMaker.hpp"
+#include "RBAIsGreaterThanOperatorMaker.hpp"
+#include "RBAIsLowerThanEqualOperatorMaker.hpp"
+#include "RBAIsLowerThanOperatorMaker.hpp"
+#include "RBAIsOnMaker.hpp"
+#include "RBAIsTypeOfOperatorMaker.hpp"
+#include "RBALambdaExpressionMaker.hpp"
+#include "RBAMaxOperatorMaker.hpp"
+#include "RBAMemberFeatureReferenceMaker.hpp"
+#include "RBAMinOperatorMaker.hpp"
+#include "RBASelectOperatorMaker.hpp"
+#include "RBANotOperatorMaker.hpp"
+#include "RBAObjectCompareMaker.hpp"
+#include "RBAObjectReferenceMaker.hpp"
+#include "RBAOrOperatorMaker.hpp"
+#include "RBAPlusOperatorMaker.hpp"
+#include "RBAPreviousModifierMaker.hpp"
+#include "RBASetOfOperatorMaker.hpp"
+#include "RBASizeOperatorMaker.hpp"
+#include "RBAStateValueMaker.hpp"
+#include "RBAVariableMaker.hpp"
+#include "RBAConstraintMaker.hpp"
+#include "RBASceneMaker.hpp"
+#include "RBAModelElement.hpp"
+
+namespace rba
+{
+
+RBACommonMakerTable::RBACommonMakerTable()
+ : RBAAbstractMakerTable{}
+{
+ addTag("scenes");
+ addTag("constraints");
+ addTag("postconstraints");
+ addTag("rules");
+}
+
+std::list<std::unique_ptr<RBAModelElementMaker>>
+RBACommonMakerTable::getMakers() const
+{
+ std::list<std::unique_ptr<RBAModelElementMaker>> makers;
+ makers.push_back(std::make_unique<RBAActiveStateMaker>());
+ makers.push_back(std::make_unique<RBAAllocatedContentMaker>());
+ makers.push_back(std::make_unique<RBAActiveContentsMaker>());
+ makers.push_back(std::make_unique<RBAAndOperatorMaker>());
+ makers.push_back(std::make_unique<RBAContentValueMaker>());
+ makers.push_back(std::make_unique<RBAExistsOperatorMaker>());
+ makers.push_back(std::make_unique<RBAForAllOperatorMaker>());
+ makers.push_back(std::make_unique<RBAGetAllocatablesMaker>());
+ makers.push_back(std::make_unique<RBAGetContentsListMaker>());
+ makers.push_back(std::make_unique<RBAGetPropertyMaker>());
+ makers.push_back(std::make_unique<RBAHasBeenDisplayedMaker>());
+ makers.push_back(std::make_unique<RBAHasComeEarlierThanMaker>());
+ makers.push_back(std::make_unique<RBAHasComeLaterThanMaker>());
+ makers.push_back(std::make_unique<RBAIfStatementMaker>());
+ makers.push_back(std::make_unique<RBAImpliesOperatorMaker>());
+ makers.push_back(std::make_unique<RBAIntegerValueMaker>());
+ makers.push_back(std::make_unique<RBAIsActiveMaker>());
+ makers.push_back(std::make_unique<RBAIsEqualToOperatorMaker>());
+ makers.push_back(std::make_unique<RBAIsGreaterThanEqualOperatorMaker>());
+ makers.push_back(std::make_unique<RBAIsGreaterThanOperatorMaker>());
+ makers.push_back(std::make_unique<RBAIsLowerThanEqualOperatorMaker>());
+ makers.push_back(std::make_unique<RBAIsLowerThanOperatorMaker>());
+ makers.push_back(std::make_unique<RBAIsOnMaker>());
+ makers.push_back(std::make_unique<RBAIsTypeOfOperatorMaker>());
+ makers.push_back(std::make_unique<RBALambdaExpressionMaker>());
+ makers.push_back(std::make_unique<RBAMaxOperatorMaker>());
+ makers.push_back(std::make_unique<RBAMemberFeatureReferenceMaker>());
+ makers.push_back(std::make_unique<RBAMinOperatorMaker>());
+ makers.push_back(std::make_unique<RBASelectOperatorMaker>());
+ makers.push_back(std::make_unique<RBANotOperatorMaker>());
+ makers.push_back(std::make_unique<RBAObjectCompareMaker>());
+ makers.push_back(std::make_unique<RBAObjectReferenceMaker>());
+ makers.push_back(std::make_unique<RBAOrOperatorMaker>());
+ makers.push_back(std::make_unique<RBAPlusOperatorMaker>());
+ makers.push_back(std::make_unique<RBAPreviousModifierMaker>());
+ makers.push_back(std::make_unique<RBASetOfOperatorMaker>());
+ makers.push_back(std::make_unique<RBASizeOperatorMaker>());
+ makers.push_back(std::make_unique<RBAStateValueMaker>());
+ makers.push_back(std::make_unique<RBAVariableMaker>());
+ makers.push_back(std::make_unique<RBAConstraintMaker>());
+ makers.push_back(std::make_unique<RBASceneMaker>());
+ RBAModelElementMaker::addMaker("SCENE", std::make_unique<RBASceneMaker>());
+
+ return makers;
+}
+
+}
diff --git a/src/core/logic/RBACommonMakerTable.hpp b/src/core/logic/RBACommonMakerTable.hpp
new file mode 100644
index 0000000..ae18dad
--- /dev/null
+++ b/src/core/logic/RBACommonMakerTable.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBACommonMakerTable.hpp
+/// @brief Expression element maker table class header
+
+#ifndef RBACOMMONMAKERTABLE_HPP
+#define RBACOMMONMAKERTABLE_HPP
+
+#include "RBAAbstractMakerTable.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBACommonMakerTable : public RBAAbstractMakerTable
+{
+public:
+ RBACommonMakerTable();
+ RBACommonMakerTable(const RBACommonMakerTable&)=delete;
+ RBACommonMakerTable(const RBACommonMakerTable&&)=delete;
+ RBACommonMakerTable& operator=(const RBACommonMakerTable&)=delete;
+ RBACommonMakerTable& operator=(const RBACommonMakerTable&&)=delete;
+ virtual ~RBACommonMakerTable()=default;
+
+public:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::list<std::unique_ptr<RBAModelElementMaker>> getMakers() const override;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAConstraintInfo.cpp b/src/core/logic/RBAConstraintInfo.cpp
new file mode 100644
index 0000000..b208c5f
--- /dev/null
+++ b/src/core/logic/RBAConstraintInfo.cpp
@@ -0,0 +1,695 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// ConstraintInfo class
+
+#include <algorithm>
+#include "RBAAllocatable.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAExpression.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void RBAConstraintInfo::setExpression(const RBAExpression* const expression)
+{
+ expression_ = expression;
+}
+
+const RBAExpression*
+RBAConstraintInfo::getExpression() const
+{
+ return expression_;
+}
+
+void RBAConstraintInfo::addOperandAllocatable(const RBAAllocatable* const operandAllocatable)
+{
+ static_cast<void>(operandAllocatable_.insert(operandAllocatable));
+}
+
+void RBAConstraintInfo::setResult(const RBAExecuteResult result)
+{
+ result_ = result;
+}
+
+RBAConstraintInfo*
+RBAConstraintInfo::getChild(const std::uint32_t index) const
+{
+ const std::size_t requiredSize {static_cast<std::size_t>(index + 1U)};
+ if (children_.size() < requiredSize) {
+ children_.resize(requiredSize, std::make_unique<RBAConstraintInfo>());
+ }
+ // Use "[]" instead of "at" because it doesn't access out of range
+ return children_[static_cast<std::size_t>(index)].get();
+}
+
+void RBAConstraintInfo::setChild(const std::shared_ptr<RBAConstraintInfo> info)
+{
+ // This function is used in "let" expressions, which generate a new
+ // "ConstraintInfo" on each evaluation.
+ // Therefore, in the case of "add", "children" will be added for each arbitration,
+ // so use "set" to set "children" for each arbitration.
+ children_ = { info };
+}
+
+void RBAConstraintInfo::addTrueAllocatable(const RBAAllocatable* const allocatable)
+{
+ static_cast<void>(trueAllocatables_.insert(allocatable));
+}
+
+void RBAConstraintInfo::addFalseAllocatable(const RBAAllocatable* const allocatable)
+{
+ static_cast<void>(falseAllocatables_.insert(allocatable));
+}
+
+void RBAConstraintInfo::addTrueAllocatableFromOperand()
+{
+ for (const auto& c : children_) {
+ for (const auto& a : c->operandAllocatable_) {
+ static_cast<void>(trueAllocatables_.insert(a));
+ }
+ }
+}
+
+void RBAConstraintInfo::addFalseAllocatableFromOperand()
+{
+ for (const auto& c : children_) {
+ for (const auto& a : c->operandAllocatable_) {
+ static_cast<void>(falseAllocatables_.insert(a));
+ }
+ }
+}
+
+void RBAConstraintInfo::clearFalseAllocatable()
+{
+ falseAllocatables_.clear();
+}
+
+/// TCheck whether to invert True/False
+/// @return
+bool RBAConstraintInfo::isRevert() const
+{
+ if ((expression_ != nullptr)
+ && expression_->isModelElementType(RBAModelElementType::NotOperator)) {
+ return true;
+ }
+ return false;
+}
+
+bool RBAConstraintInfo::isSizeOperator() const
+{
+ if ((expression_ != nullptr)
+ && (expression_->isModelElementType(RBAModelElementType::SizeOperator))) {
+ return true;
+ }
+ return false;
+}
+
+const bool RBAConstraintInfo::isImplies() const
+{
+ if ((expression_ != nullptr)
+ && (expression_->isModelElementType(RBAModelElementType::ImpliesOperator)
+ || expression_->isModelElementType(RBAModelElementType::IfStatement))) {
+ return true;
+ }
+ return false;
+}
+
+void RBAConstraintInfo::clear()
+{
+ for (const std::shared_ptr<RBAConstraintInfo>& child : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // recursively calling clear()
+ //  [Reason that there is no problem if the rule is deviated]
+ // ConstraintInfo is created for each node in the Constraint expression
+ // tree. The Constraint expression tree is determined by the constraint
+ // expressions written in the model file, and its depth is finite.
+ // Therefore, stack overflow does not occur and there is no problem
+ child->clear();
+ }
+ result_ = RBAExecuteResult::SKIP;
+ exceptionBeforeArbitrate_ = false;
+ trueAllocatables_.clear();
+ falseAllocatables_.clear();
+ operandAllocatable_.clear();
+}
+
+bool RBAConstraintInfo::isExceptionBeforeArbitrate() const
+{
+ return exceptionBeforeArbitrate_;
+}
+
+void RBAConstraintInfo::setExceptionBeforeArbitrate(
+ const bool exceptionBeforeArbitrate)
+{
+ exceptionBeforeArbitrate_ = exceptionBeforeArbitrate;
+}
+
+bool RBAConstraintInfo::needsReRearbitrationFor(
+ const RBAAllocatable* const allocatable) const
+{
+ bool result {false};
+ if (children_.empty() == false) {
+ switch (expression_->getModelElementType()) {
+ case RBAModelElementType::ImpliesOperator:
+ if (children_.front()->isExceptionBeforeArbitrate()) {
+ result = children_.back()->needsReRearbitrationFor(allocatable);
+ }
+ break;
+ case RBAModelElementType::IfStatement:
+ if (children_.front()->isExceptionBeforeArbitrate()) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::needsReRearbitrationFor=(_,
+ // p={c::rba::RBAAllocatable})' is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ result = children_.back()->needsReRearbitrationFor(allocatable);
+ }
+ break;
+ default:
+ for (const auto& child : children_) {
+ result = (result || child->needsReRearbitrationFor(allocatable));
+ }
+ result =
+ (result || (trueAllocatables_.find(allocatable) != trueAllocatables_.end())
+ || (falseAllocatables_.find(allocatable) != falseAllocatables_.end()));
+ break;
+ }
+ }
+ return result;
+}
+
+bool RBAConstraintInfo::needsRearbitrationFor(const RBAAllocatable* const allocatable,
+ bool isImplies) const
+{
+ bool result {false}; // 再調停要否
+ if (children_.empty() == false) {
+ // When the syntax of the constraint expression is
+ // - ImpliesOperator
+ // - IfStatement
+ // - other than the above
+ switch (expression_->getModelElementType()) {
+ case RBAModelElementType::ImpliesOperator:
+ // If the left side of the implication is true and
+ // the left side contains an Allocatable during arbitration,
+ // re-arbitration is required.
+ //
+ // If the left side of the implication is true and
+ // the left side contains an allocatable state reference expression,
+ // re-arbitration is NOT required.
+ if (children_.front()->isTrue()) {
+ if (children_.front()->contains(allocatable)) {
+ result = true;
+ } else {
+ if (children_.front()->contains(nullptr)) {
+ isImplies = true;
+ }
+ result = (result || children_.back()->needsRearbitrationFor(allocatable,
+ isImplies));
+ }
+ }
+ break;
+ case RBAModelElementType::IfStatement:
+ // If the IF condition includes Allocatble in arbitration,
+ // re-arbitration is required.
+ // If the IF condition includes an Allocatable state reference
+ // expression, re-arbitration is NOT required.
+ // If the IF condition does not include an allocatable state reference
+ // expression, search the child syntax.
+ if (children_.front()->contains(allocatable)) {
+ result = true;
+ } else {
+ if (children_.front()->contains(nullptr)) {
+ isImplies = true;
+ }
+ result = (result || children_.back()->needsRearbitrationFor(allocatable,
+ isImplies));
+ }
+ break;
+ default:
+ for (const auto& child : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::needsRearbitrationFor=(_,
+ // p={c::rba::RBAAllocatable},_o)' is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ result = (result || child->needsRearbitrationFor(allocatable, isImplies));
+ }
+ // The Constraint expression does not include IF or implication,
+ // or
+ // the Allocatable state reference expression is not included in the
+ // left side of the IF condition of the parent syntax or
+ // the implication of the parent syntax,
+ // or
+ // "Allocable" during arbitration is included in the left side of
+ // the IF condition of the parent syntax or the implication of the
+ // parent syntax,
+ //
+ // re-arbitration is required.
+ if (!isImplies && contains(allocatable)) {
+ result = true;
+ }
+ break;
+ }
+ }
+ return result;
+}
+
+/// @brief Collect "Allocatable" whose right side is false.
+/// @details
+/// - Do not collect if an exception has occurred
+/// - When expression_ is nullptr or When expression_ is implication
+/// - If the left side is satisfied and there is a condition on the left
+/// side that is affected by the allocatable state, collect the
+/// allocatable that caused the right side to be false.
+/// - If the left side is satisfied and there is NO condition affected by
+/// the allocatable state on the left side, this function is called on
+/// the right side. (To correspond to implication or IF nest)
+/// - When expression_ is IF
+/// - If there is a condition on the left side that is affected by the
+/// "Allocatable" state, collect the "Allocatable that caused the
+/// right side to be false.
+/// - If there is no condition affected by the allocatable state on the left
+/// side, call this function for the right side.
+/// (To correspond to the implication or nest of IF)
+/// - When expression_ is negative
+/// - Call this function with "isNot" inverted for the left side.
+/// (To deal with implications or IFs present in children.)
+/// - When expression_ is above
+/// - Call this function for the child ConstraintInfo.
+/// (To deal with implications or IFs present in children.)
+/// @param[in] allocatable "Allcatable" during arbitration
+/// @param[out] targets "Allocatable" for re-arbitration
+/// @param[in] isNot Inversion state of right and wrong by negation operator.
+void RBAConstraintInfo::collectRearbitrationTargetFor(
+ const RBAAllocatable* const allocatable, std::set<const RBAAllocatable*>& targets,
+ const bool isNot) const
+{
+ if (isExceptionBeforeArbitrate()) {
+ return;
+ }
+ if (children_.empty() == false) {
+ switch (expression_->getModelElementType()) {
+ case RBAModelElementType::ImpliesOperator:
+ if (children_.front()->isTrue()) {
+ if (isNot) {
+ children_.back()->collectTrueAllocatables(targets);
+ } else {
+ children_.back()->collectFalseAllocatables(targets);
+ }
+ } else if (!children_.front()->isFalse()) {
+ children_.back()->collectRearbitrationTargetFor(allocatable, targets,
+ isNot);
+ } else {
+ }
+ break;
+ case RBAModelElementType::IfStatement:
+ if (isNot) {
+ children_.back()->collectTrueAllocatables(targets);
+ } else {
+ children_.back()->collectFalseAllocatables(targets);
+ }
+ break;
+ case RBAModelElementType::NotOperator:
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::collectRearbitrationTargetFor=(_,p={c::rba::RBAAllocatable},
+ // &{c::std::set<p={c::rba::RBAAllocatable},{c::std::less<p={c::rba::RBAAllocatable}>},
+ // {c::std::allocator<p={c::rba::RBAAllocatable}>}>},_o)' is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ children_.front()->collectRearbitrationTargetFor(allocatable, targets,
+ !isNot);
+ break;
+ default:
+ for (const auto& child : children_) {
+ child->collectRearbitrationTargetFor(allocatable, targets, isNot);
+ }
+ break;
+ }
+ }
+}
+
+void RBAConstraintInfo::collectTrueAllocatables(
+ std::set<const RBAAllocatable*>& allocatables) const
+{
+ if (isExceptionBeforeArbitrate() || isFalse()) {
+ return;
+ }
+ if (isRevert()) {
+ for (const auto& child : children_) {
+ child->collectFalseAllocatables(allocatables);
+ }
+ allocatables.insert(falseAllocatables_.begin(), falseAllocatables_.end());
+ } else if (isImplies()) {
+ children_.back()->collectTrueAllocatables(allocatables);
+ } else if (isSizeOperator()) {
+ // Since the size operator evaluates the number of sets,
+ // the Allocatable that combines FalseAllocatable and TrueAllocatable
+ // becomes TrueAllocatables.
+ children_.back()->collectTrueAllocatables(allocatables);
+ children_.back()->collectFalseAllocatables(allocatables);
+ } else {
+ for (const auto& child : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::collectTrueAllocatables=(_,
+ // &{c::std::set<p={c::rba::RBAAllocatable},
+ // {c::std::less<p={c::rba::RBAAllocatable}>},
+ // {c::std::allocator<p={c::rba::RBAAllocatable}>}>})' is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ child->collectTrueAllocatables(allocatables);
+ }
+ allocatables.insert(trueAllocatables_.begin(), trueAllocatables_.end());
+ }
+ return;
+}
+
+void RBAConstraintInfo::collectFalseAllocatables(
+ std::set<const RBAAllocatable*>& allocatables) const
+{
+ if (isExceptionBeforeArbitrate() || isTrue()) {
+ return;
+ }
+ if (isRevert()) {
+ for (const auto& child : children_) {
+ child->collectTrueAllocatables(allocatables);
+ }
+ allocatables.insert(trueAllocatables_.begin(), trueAllocatables_.end());
+ } else if (isImplies()) {
+ children_.back()->collectFalseAllocatables(allocatables);
+ } else if (isSizeOperator()) {
+ // The size operator evaluates the number of sets, so "Allocatable",
+ // which is a combination of "FalseAllocatable" and "TrueAllocatable",
+ // becomes "FalseAllocatables".
+ children_.back()->collectTrueAllocatables(allocatables);
+ children_.back()->collectFalseAllocatables(allocatables);
+ } else {
+ for (const auto& child : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::collectFalseAllocatables=(_,
+ // &{c::std::set<p={c::rba::RBAAllocatable},
+ // {c::std::less<p={c::rba::RBAAllocatable}>},
+ // {c::std::allocator<p={c::rba::RBAAllocatable}>}>})'
+ // is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ child->collectFalseAllocatables(allocatables);
+ }
+ allocatables.insert(falseAllocatables_.begin(), falseAllocatables_.end());
+ }
+ return;
+}
+
+bool RBAConstraintInfo::contains(const RBAAllocatable* const allocatable) const
+{
+ if (allocatable != nullptr) {
+ if (trueAllocatables_.find(allocatable) != trueAllocatables_.end()) {
+ return true;
+ }
+ if (falseAllocatables_.find(allocatable) != falseAllocatables_.end()) {
+ return true;
+ }
+ } else {
+ if (!trueAllocatables_.empty() || !falseAllocatables_.empty()) {
+ return true;
+ }
+ }
+ for (const auto& child : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::contains=(_,
+ // p={c::rba::RBAAllocatable})'
+ // is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ if (child->contains(allocatable)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+bool RBAConstraintInfo::isTrue() const
+{
+ return (result_ == RBAExecuteResult::TRUE);
+}
+
+bool RBAConstraintInfo::isFalse() const
+{
+ return (result_ == RBAExecuteResult::FALSE);
+}
+
+void RBAConstraintInfo::collectAffectedAllocatables(
+ const bool isRevert, std::set<const RBAAllocatable*>& affectAllocatables,
+ const bool collecting,
+ const bool forObject)
+{
+ // Collect the allocatable that caused the constraint expression to be False.
+ // It is implemented by recursively calling ConstraintInfo of the tree
+ // structure created at the time of "Constraint" expression evaluation.
+ // with this function.
+ // Collect True because the success or failure of ConstraintInfo below
+ // "negative" is reversed.
+ switch (getExpression()->getModelElementType()) {
+ case RBAModelElementType::NotOperator:
+ // ConstraintInfo below negative negates success or failure,
+ // so invert isRevert and call child Info.
+ children_[0U]->collectAffectedAllocatables(!isRevert, affectAllocatables,
+ collecting, forObject);
+ break;
+ case RBAModelElementType::SizeOperator:
+ // Since the size operator evaluates the number of sets,
+ // "Allocatable" which is a combination of "FalseAllocatable" and
+ // "TrueAllocatable" becomes "affectAllocatables".
+ children_[0U]->collectAffectedAllocatables(false, affectAllocatables,
+ true, true);
+ break;
+ case RBAModelElementType::OrOperator:
+ case RBAModelElementType::ExistsOperator:
+ // the same processing is performed, because "Exists {A,B}{x|x.isXXX}"
+ // is equivalent to "A.isXXX OR B.isXXX"
+ if (!isRevert) {
+ // Processing when "Info" of "OR" in which evaluation result that is not
+ // qualified by an odd number of negative is "Skip" or evaluation reslt
+ // that is not qualified by an odd number of negative is "False".
+ if (!isTrue()) {
+ // Collect the Allocatable of child Info whose
+ // whose evaluation result is False.
+ // When "A.isXXX OR B.isXXX", if the evaluation result of A is True,
+ // the evaluation result of OR will be True even if the evaluation
+ // result of B is False. Therefore, A affects B.
+ // Conversely, B also affects A.
+ // Therefore, set "collecting" to True and
+ // search "child Info" for allocatable.
+ for (auto& i : children_) {
+ i->collectAffectedAllocatables(isRevert, affectAllocatables, true,
+ forObject); // Collct when "OR"
+ }
+ }
+ } else {
+ // Processing when "Info" of "OR" in which evaluation result that is not
+ // qualified by an odd number of negative is "Skip" or evaluation reslt
+ // that is not qualified by an odd number of negative is "False".
+ // "!(A.isXXX OR B.isXXX)" can be decomposed into
+ // "!A.isXXX AND !B.isXXX", so if "NOT", perform the same processing
+ // as "AND".
+ if (!isFalse()) {
+ for (auto& i : children_) {
+ i->collectAffectedAllocatables(isRevert, affectAllocatables,
+ collecting, forObject);
+ }
+ }
+ }
+ break;
+ case RBAModelElementType::AndOperator:
+ case RBAModelElementType::ForAllOperator:
+ //"For-All {A,B}{x|x.isXXX}" is equivalent to "A.isXXX AND B.isXXX",
+ // so the same processing is performed
+ if (isRevert) {
+ // Processing when "Info" of "AND" in which evaluation result that
+ // is not qualified by an odd number of "negative" is "Skip" or
+ // evaluation reslt that is not qualified by an odd number of negative
+ // is "True".
+ //
+ // "!(A.isXXX AND B.isXXX)" can be decomposed into
+ // "!A.isXXX OR !B.isXXX", so if "NOT", perform the same processing
+ // as "OR".
+ if (!isFalse()) {
+ for (auto& i : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAConstraintInfo::collectAffectedAllocatables(_,_o,&{c::std::set<p={c::rba::RBAAllocatable},
+ // {c::std::less<p={c::rba::RBAAllocatable}>},{c::std::allocator<p={c::rba::RBAAllocatable}>}>},_o)' is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ i->collectAffectedAllocatables(isRevert, affectAllocatables, true,
+ forObject);
+ }
+ }
+ } else {
+ // Processing when "Info" of "AND" in which evaluation result that
+ // is not qualified by an odd number of "negative" is "Skip" or
+ // evaluation reslt that is not qualified by an odd number of negative
+ // is "True".
+ //
+ // When "A.isXXX AND B.isXXX", the evaluation result of "AND" does not
+ // become True unless the evaluation result of B becomes True,
+ // regardless of the evaluation result of A. Therefore, A does not
+ // affect B, and B does not affect A.
+ // Therefore, "collecting" is as it is, and the "child Info" is
+ // searched for an allocable influence.
+ if (!isTrue()) {
+ for (auto& i : children_) {
+ i->collectAffectedAllocatables(isRevert, affectAllocatables,
+ collecting, forObject);
+ }
+ }
+ }
+ break;
+ case RBAModelElementType::MaxOperator:
+ case RBAModelElementType::MinOperator:
+ {
+ // When the <set> expression is "IF(A.isDisplayed) THEN {B,C} ELSE {D,E}",
+ // scan the left side to extract A as the area of influence
+ children_[0U]->collectAffectedAllocatables(false, affectAllocatables,
+ collecting,forObject);
+ // All the operands that are "x" in the lambda expression affect
+ // each other, so it is necessary to extract them as the affected Area.
+ for (std::uint8_t i { 1U }; i < children_.size(); ++i) {
+ children_[i]->collectAffectedAllocatables(isRevert, affectAllocatables,
+ true, true);
+ }
+ break;
+ }
+ // "A -> B" is the same as "!A OR B".
+ case RBAModelElementType::ImpliesOperator:
+ if (!isRevert) {
+ if (!isTrue()) {
+ // "A.isXXX -> B.isXXX" can be decomposed into "!A.isXXX OR B.isXXX",
+ // so the same process as OR is performed
+ // For the above reason, the acquisition target on the left side
+ // inverts isRevert.
+ children_[0U]->collectAffectedAllocatables(!isRevert,
+ affectAllocatables, true,
+ forObject);
+ children_[1U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ }
+ } else {
+ if (!isFalse()) {
+ // "!(A.isXXX -> B.isXXX)" can be decomposed into "A.isXXX OR !B.isXXX"
+ // For the above reason, the acquisition target on the left side
+ // inverts isRevert.
+ children_[0U]->collectAffectedAllocatables(!isRevert,
+ affectAllocatables,
+ collecting, forObject);
+ children_[1U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables,
+ collecting, forObject);
+ }
+ }
+ break;
+ case RBAModelElementType::IfStatement:
+ // "IF(A) THEN B ELSE C" is the same as "!A OR B" if A is True,
+ // and the same as "A OR C" if A is False
+ if (children_[0U]->isTrue()) {
+ if (!isRevert) {
+ if (!isTrue()) {
+ // "IF(A.isXXX) THEN B.isXXX ELSE C.isXXX" can be decomposed into
+ // "(!A.isXXX OR B.isXXX)" when A is True.
+ // For the above reason, the acquisition target on the left side
+ // inverts isRevert.
+ children_[0U]->collectAffectedAllocatables(!isRevert,
+ affectAllocatables, true,
+ forObject);
+ children_[1U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ }
+ } else {
+ if (!isFalse()) {
+ // "!(IF(A.isXXX) THEN B.isXXX ELSE C.isXXX)" can be decomposed into
+ // "(!A.isXXX OR !B.isXXX)" when A is True.
+ // For the above reason, the acquisition target on the left side
+ // inverts isRevert.
+ children_[0U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ children_[1U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ }
+ }
+ } else {
+ if (!isRevert) {
+ if (!isTrue()) {
+ // "IF(A.isXXX) THEN B.isXXX ELSE C.isXXX" can be decomposed into
+ // "(A.isXXX OR C.isXXX)" when A is False.
+ children_[0U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ children_[1U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ }
+ } else {
+ if (!isFalse()) {
+ // "!(IF(A.isXXX) THEN B.isXXX ELSE C.isXXX)" can be decomposed into
+ // "(A.isXXX OR !C.isXXX)" when A is False.
+ children_[0U]->collectAffectedAllocatables(!isRevert,
+ affectAllocatables, true,
+ forObject);
+ children_[1U]->collectAffectedAllocatables(isRevert,
+ affectAllocatables, true,
+ forObject);
+ }
+ }
+ }
+ break;
+ default: // Collect Allocatable
+ if (collecting) {
+ if (isRevert) {
+ affectAllocatables.insert(trueAllocatables_.begin(),
+ trueAllocatables_.end());
+ } else {
+ affectAllocatables.insert(falseAllocatables_.begin(),
+ falseAllocatables_.end());
+ }
+ if (forObject) {
+ for (const auto& a : operandAllocatable_) {
+ affectAllocatables.insert(a);
+ }
+ }
+ }
+ for (auto& i : children_) {
+ i->collectAffectedAllocatables(isRevert, affectAllocatables, collecting,
+ forObject);
+ }
+ break;
+ }
+ return;
+}
+
+}
+
diff --git a/src/core/logic/RBAConstraintInfo.hpp b/src/core/logic/RBAConstraintInfo.hpp
new file mode 100644
index 0000000..8ab88dd
--- /dev/null
+++ b/src/core/logic/RBAConstraintInfo.hpp
@@ -0,0 +1,119 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// ConstraintInfo (Constraint expression Information) class header
+
+#ifndef RBACONSTRAINTINFO_HPP
+#define RBACONSTRAINTINFO_HPP
+
+#include <cstdint>
+#include <memory>
+#include <set>
+#include <vector>
+#include "RBAExecuteResult.hpp"
+#include "RBADllExport.hpp"
+
+namespace rba {
+
+class RBAAllocatable;
+class RBAExpression;
+
+class DLL_EXPORT RBAConstraintInfo
+{
+public:
+ RBAConstraintInfo()=default;
+ RBAConstraintInfo(const RBAConstraintInfo&)=delete;
+ RBAConstraintInfo(const RBAConstraintInfo&&)=delete;
+ RBAConstraintInfo& operator=(const RBAConstraintInfo&)=delete;
+ RBAConstraintInfo& operator=(const RBAConstraintInfo&&)=delete;
+ virtual ~RBAConstraintInfo()=default;
+
+public:
+ void setExpression(const RBAExpression* const expression);
+ const RBAExpression* getExpression() const;
+ void addOperandAllocatable(const RBAAllocatable* const operandAllocatable);
+ void setResult(const RBAExecuteResult result);
+ RBAConstraintInfo* getChild(const std::uint32_t index) const;
+ void setChild(const std::shared_ptr<RBAConstraintInfo> info);
+ void addTrueAllocatable(const RBAAllocatable* const allocatable);
+ void addFalseAllocatable(const RBAAllocatable* const allocatable);
+ void addTrueAllocatableFromOperand();
+ void addFalseAllocatableFromOperand();
+ void clearFalseAllocatable();
+ const bool isImplies() const;
+ void clear();
+
+ bool isExceptionBeforeArbitrate() const;
+ void setExceptionBeforeArbitrate(const bool exceptionBeforeArbitrate);
+
+ /// @brief Determine the need for re-arbitration
+ /// @param [in] allocatable Allcatable druing arbitration
+ /// @param [in] isImplies Whether the constraint expression contains
+ /// implication syntax.
+ /// @return Necessity of re-arbitration (true: need / false: No need)
+ bool needsRearbitrationFor(const RBAAllocatable* const allocatable,
+ bool isImplies = false) const;
+
+ bool needsReRearbitrationFor(const RBAAllocatable* const allocatable) const;
+ void collectRearbitrationTargetFor(const RBAAllocatable* const allocatable,
+ std::set<const RBAAllocatable*>& targets,
+ const bool isNot) const;
+ void collectTrueAllocatables(std::set<const RBAAllocatable*>& allocatables) const;
+ void collectFalseAllocatables(std::set<const RBAAllocatable*>& allocatables) const;
+ bool contains(const RBAAllocatable* const allocatable) const;
+ bool isTrue() const;
+ bool isFalse() const;
+
+ /// @brief Extraction of affected Area/Zone
+ /// @param [in] isRevert Negative context (true: inside / false: outside)
+ /// @param [out] affectAllocatables List of affected Allcatable
+ /// @param [out] collecting Collection target context
+ /// (true: inside / false: outside)
+ /// @param [out] forObject ReferenceObject context
+ /// (true: inside / false: outside)
+ /// @return Necessity of re-arbitration (true: need / false: No need)
+ void collectAffectedAllocatables(
+ const bool isRevert, std::set<const RBAAllocatable*>& affectAllocatables,
+ const bool collecting,
+ const bool forObject);
+
+private:
+ bool isRevert() const;
+ bool isSizeOperator() const;
+
+private:
+ bool exceptionBeforeArbitrate_ {false};
+ const RBAExpression* expression_ {nullptr};
+ RBAExecuteResult result_ {RBAExecuteResult::SKIP};
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::set<const RBAAllocatable*> trueAllocatables_;
+ std::set<const RBAAllocatable*> falseAllocatables_;
+ std::set<const RBAAllocatable*> operandAllocatable_;
+ // use to respond with an empty set
+ const std::set<const RBAAllocatable*> emptyAllocatables_;
+ mutable std::vector<std::shared_ptr<RBAConstraintInfo>> children_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAConstraintMap.hpp b/src/core/logic/RBAConstraintMap.hpp
new file mode 100644
index 0000000..6f37694
--- /dev/null
+++ b/src/core/logic/RBAConstraintMap.hpp
@@ -0,0 +1,38 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAConstraintMap.hpp
+ */
+
+#ifndef RBACONSTRAINTMAP_HPP
+#define RBACONSTRAINTMAP_HPP
+
+namespace rba
+{
+
+enum class RBAConstraintMap : std::uint8_t
+{
+ CONTENT_ALLOCATE_CONSTRAINTS,
+ HIDDEN_TRUE_CHECK_CONSTRAINTS,
+ HIDDEN_FALSE_CHECK_CONSTRAINTS,
+ ATTENUATE_TRUE_CHECK_CONSTRAINTS,
+ ATTENUATE_FALSE_CHECK_CONSTRAINTS,
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAContentStatus.cpp b/src/core/logic/RBAContentStatus.cpp
new file mode 100644
index 0000000..04ed6d9
--- /dev/null
+++ b/src/core/logic/RBAContentStatus.cpp
@@ -0,0 +1,72 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// ContentStatus (Content state transition management) class
+//
+
+#include "RBAContentState.hpp"
+#include "RBAContentStatus.hpp"
+#include "RBAContentStatusType.hpp"
+
+namespace rba
+{
+
+void RBAContentStatus::onRequest()
+{
+ if ((status_ != RBAContentStatusType::Displayed)
+ && (status_ != RBAContentStatusType::StandBy)) {
+ status_ = RBAContentStatusType::Undisplayed;
+ }
+}
+void RBAContentStatus::setStatusType(
+ const RBAContentStatusType type)
+{
+ status_ = type;
+}
+RBAContentStatusType RBAContentStatus::getStatusType() const
+{
+ return status_;
+}
+bool RBAContentStatus::isActive() const
+{
+ return ((status_ != RBAContentStatusType::NoRequest)
+ && (status_ != RBAContentStatusType::Canceled));
+}
+
+bool RBAContentStatus::isUndisplayed() const
+{
+ return (status_ == RBAContentStatusType::Undisplayed);
+}
+
+bool RBAContentStatus::isDisplayed() const
+{
+ return (status_ == RBAContentStatusType::Displayed);
+}
+bool RBAContentStatus::isStandby() const
+{
+ return (status_ == RBAContentStatusType::StandBy);
+}
+bool RBAContentStatus::hasBeenCanceled() const
+{
+ return (status_ == RBAContentStatusType::Canceled);
+}
+bool RBAContentStatus::hasBeenDisplayed() const
+{
+ return ((status_ == RBAContentStatusType::Displayed)
+ || (status_ == RBAContentStatusType::StandBy));
+}
+} /* namespace rba */
diff --git a/src/core/logic/RBAContentStatus.hpp b/src/core/logic/RBAContentStatus.hpp
new file mode 100644
index 0000000..69f7e8d
--- /dev/null
+++ b/src/core/logic/RBAContentStatus.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+//
+// ContentStatus (Content state transition management) class
+//
+
+#ifndef RBACONTENTSTATUS_HPP
+#define RBACONTENTSTATUS_HPP
+#include <cstdint>
+
+#include "RBAContentStatusType.hpp"
+
+namespace rba
+{
+class RBAContentState;
+
+class RBAContentStatus
+{
+ public:
+ RBAContentStatus()=default;
+ // Copy constructor is defined in default because it is used in another class
+ RBAContentStatus(const RBAContentStatus&)=default;
+ RBAContentStatus(const RBAContentStatus&&)=delete;
+ // Copy assignment operator is defined in default
+ // because it is used in other classes
+ RBAContentStatus& operator=(const RBAContentStatus&)=default;
+ RBAContentStatus& operator=(const RBAContentStatus&&)=delete;
+ virtual ~RBAContentStatus()=default;
+ void onRequest();
+ void setStatusType(const RBAContentStatusType type);
+ RBAContentStatusType getStatusType() const;
+ bool isActive() const;
+ bool isUndisplayed() const;
+ bool isDisplayed() const;
+ bool isStandby() const;
+ bool hasBeenCanceled() const;
+ bool hasBeenDisplayed() const;
+ private:
+ RBAContentStatusType status_ {RBAContentStatusType::NoRequest};
+};
+
+} /* namespace rba */
+
+#endif /* RBACONTENTSTATUS_HPP */
diff --git a/src/core/logic/RBARequest.cpp b/src/core/logic/RBARequest.cpp
new file mode 100644
index 0000000..c55cac1
--- /dev/null
+++ b/src/core/logic/RBARequest.cpp
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * RBARequest (request arbitration) class implementation
+ */
+
+#include "RBARequest.hpp"
+
+namespace rba
+{
+
+RBARequest::RBARequest(const std::string& context, const bool isOn) :
+ context_{context},
+ isOn_{isOn}
+{
+}
+
+std::string
+RBARequest::getContext() const
+{
+ return context_;
+}
+
+bool
+RBARequest::isOn() const
+{
+ return isOn_;
+}
+
+}
diff --git a/src/core/logic/RBARequest.hpp b/src/core/logic/RBARequest.hpp
new file mode 100644
index 0000000..b6da5e4
--- /dev/null
+++ b/src/core/logic/RBARequest.hpp
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * RBARequest (request arbitration) class header
+ */
+
+#ifndef RBAREQUEST_HPP
+#define RBAREQUEST_HPP
+
+#include <string>
+#include "RBADllExport.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBARequest
+{
+ public:
+ explicit RBARequest(const std::string& context, const bool isOn = true);
+ RBARequest(const RBARequest&)=delete;
+ RBARequest(const RBARequest&&)=delete;
+ RBARequest& operator=(const RBARequest&)=delete;
+ RBARequest& operator=(const RBARequest&&)=delete;
+ virtual ~RBARequest()=default;
+
+ public:
+ std::string getContext() const;
+ bool isOn() const;
+
+ private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::string context_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+ bool isOn_;
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBARequestQueMember.cpp b/src/core/logic/RBARequestQueMember.cpp
new file mode 100644
index 0000000..a5a0d35
--- /dev/null
+++ b/src/core/logic/RBARequestQueMember.cpp
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * RBARequestQueueMember class implementation
+ */
+
+#include <cstdint>
+
+#include "RBARequestQueMember.hpp"
+#include "RBAContentState.hpp"
+
+namespace rba {
+
+RBARequestQueMember::RBARequestQueMember(const RBAContentState* const contentState, const bool isOn,
+ const std::uint32_t syncIndex):
+ contentState_{contentState},
+ isOn_{isOn},
+ syncIndex_{syncIndex}
+{
+}
+
+const RBAContentState* RBARequestQueMember::getContentState() const {
+ return contentState_;
+}
+
+bool RBARequestQueMember::isOn() const {
+ return isOn_;
+}
+
+std::uint32_t RBARequestQueMember::getSyncIndex() const {
+ return syncIndex_;
+}
+
+}
diff --git a/src/core/logic/RBARequestQueMember.hpp b/src/core/logic/RBARequestQueMember.hpp
new file mode 100644
index 0000000..cb18987
--- /dev/null
+++ b/src/core/logic/RBARequestQueMember.hpp
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * RBARequestQueueMember class header
+ */
+
+#ifndef RBAREQUESTQUEMEMBER_HPP
+#define RBAREQUESTQUEMEMBER_HPP
+
+#include <cstdint>
+
+namespace rba {
+
+class RBAContentState;
+
+class RBARequestQueMember {
+ public:
+ RBARequestQueMember(const RBAContentState* const contentState, const bool isOn, const std::uint32_t syncIndex);
+ RBARequestQueMember()=delete;
+ RBARequestQueMember(const RBARequestQueMember&)=delete;
+ RBARequestQueMember(const RBARequestQueMember&&)=delete;
+ RBARequestQueMember& operator=(const RBARequestQueMember&)=delete;
+ RBARequestQueMember& operator=(const RBARequestQueMember&&)=delete;
+ virtual ~RBARequestQueMember() = default;
+
+ const RBAContentState* getContentState() const;
+ bool isOn() const;
+ std::uint32_t getSyncIndex() const;
+
+ private:
+ // Content state for which arbitration was requested
+ const RBAContentState* contentState_;
+ // Whether display/output request or scene ON request
+ bool isOn_;
+
+ /// Index of arbitration syntax
+ /// QueMenber with the same value will be arbitrated at the same timing,
+ /// and if the values are different, differential arbitration is performed.
+ /// When a request for execute(list,bool) is received, the content icluded
+ /// in the list will all have the same value.
+ /// When setContentState(ContentState, bool) request is received twice,
+ /// the first request and the second request have different values.
+ /// When created by onRequest or onWithdrawn,
+ /// it has the same value as the request that triggered it.
+ std::uint32_t syncIndex_;
+};
+
+}
+
+#endif /* RBAREQUESTQUEMEMBER_HPP */
diff --git a/src/core/logic/RBAResultImpl.cpp b/src/core/logic/RBAResultImpl.cpp
new file mode 100644
index 0000000..41c291f
--- /dev/null
+++ b/src/core/logic/RBAResultImpl.cpp
@@ -0,0 +1,1088 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAResultImpl (result of arbitration implementation) class
+ */
+
+#include "RBAResultImpl.hpp"
+
+#include "RBAContentStatusType.hpp"
+#include "RBAArbitrator.hpp"
+#include "RBAViewContentImpl.hpp"
+#include "RBAViewContentStateImpl.hpp"
+#include "RBASoundContentImpl.hpp"
+#include "RBASoundContentStateImpl.hpp"
+#include "RBAResultSet.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAContentState.hpp"
+#include "RBAContent.hpp"
+#include "RBAAreaImpl.hpp"
+#include "RBAZoneImpl.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBASizeImpl.hpp"
+#include "RBAConstraint.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAViewActionType.hpp"
+#include "RBAViewTransition.hpp"
+#include "RBAViewMove.hpp"
+
+namespace rba {
+
+RBAResultImpl::RBAResultImpl(const RBAArbitrator* const arb,
+ std::unique_ptr<RBAResultSet> newPrevResultSet):
+ RBAResult(),
+ preResultSet_{std::move(newPrevResultSet)},
+ arb_{arb},
+ statusType_{RBAResultStatusType::SUCCESS}
+{
+ curResultSet_ = std::make_unique<RBAResultSet>();
+ curResultSet_->copyActives(preResultSet_);
+ curResultSet_->copyProperties(preResultSet_);
+}
+
+RBAResultImpl::RBAResultImpl(const RBAArbitrator* const arb,
+ std::unique_ptr<RBAResultSet> newPrevResultSet,
+ std::unique_ptr<RBAResultSet> newCurResultSet):
+ RBAResult(),
+ curResultSet_{std::move(newCurResultSet)},
+ preResultSet_{std::move(newPrevResultSet)},
+ arb_{arb},
+ statusType_{RBAResultStatusType::SUCCESS}
+{
+}
+
+RBAResultImpl::RBAResultImpl(const RBAResultImpl* const replicationTarget)
+ : RBAResult{},
+ curResultSet_{std::make_unique<RBAResultSet>(*(replicationTarget->curResultSet_.get()))},
+ preResultSet_{std::make_unique<RBAResultSet>(*(replicationTarget->preResultSet_.get()))},
+ arb_{replicationTarget->arb_},
+ statusType_{RBAResultStatusType::SUCCESS},
+ log_{replicationTarget->log_}
+{
+ for (const auto &va : replicationTarget->viewActions_) {
+ if (va->getViewActionType() == RBAViewActionType::MOVE) {
+ viewActions_.push_back(
+ std::make_unique<RBAViewMove>(va->getFromArea(), va->getToArea(),
+ va->getContentState()));
+ } else if (va->getViewActionType()
+ == RBAViewActionType::TRANSITION_REPLACE) {
+ viewActions_.push_back(
+ std::make_unique<RBAViewTransition>(va->getViewActionType(),
+ va->getArea(),
+ va->getFromContentState(),
+ va->getToContentState()));
+ } else {
+ viewActions_.push_back(
+ std::make_unique<RBAViewTransition>(va->getViewActionType(),
+ va->getArea(),
+ va->getContentState()));
+ }
+ }
+}
+
+//
+// External
+//
+
+// [get VisibleArea/SoundingZone]
+
+const std::list<const RBAArea*>&
+RBAResultImpl::getVisibleAreas() const
+{
+ return curResultSet_->getVisibleAreas();
+}
+
+const std::list<const RBAArea*>&
+RBAResultImpl::getPreVisibleAreas() const
+{
+ return preResultSet_->getVisibleAreas();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getSoundingZones() const
+{
+ return curResultSet_->getSoundingZones();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getPreSoundingZones() const
+{
+ return preResultSet_->getSoundingZones();
+}
+
+// [get Visible/Sounding ContentStates]
+
+const std::list<const RBAViewContentState*>&
+RBAResultImpl::getVisibleContentStates() const
+{
+ return curResultSet_->getVisibleContentStates();
+}
+
+const std::list<const RBAViewContentState*>&
+RBAResultImpl::getPreVisibleContentStates() const
+{
+ return preResultSet_->getVisibleContentStates();
+}
+
+const std::list<const RBASoundContentState*>&
+RBAResultImpl::getSoundingContentStates() const
+{
+ return curResultSet_->getSoundingContentStates();
+}
+
+const std::list<const RBASoundContentState*>&
+RBAResultImpl::getPreSoundingContentStates() const
+{
+ return preResultSet_->getSoundingContentStates();
+}
+
+// [get Active View/Sound ContentStates]
+
+const std::list<const RBAViewContentState*>&
+RBAResultImpl::getActiveViewContentStates() const
+{
+ return curResultSet_->getActiveViewContentStates();
+}
+
+const std::list<const RBAViewContentState*>&
+RBAResultImpl::getPreActiveViewContentStates() const
+{
+ return preResultSet_->getActiveViewContentStates();
+}
+
+const std::list<const RBASoundContentState*>&
+RBAResultImpl::getActiveSoundContentStates() const
+{
+ return curResultSet_->getActiveSoundContentStates();
+}
+
+const std::list<const RBASoundContentState*>&
+RBAResultImpl::getPreActiveSoundContentStates() const
+{
+ return preResultSet_->getActiveSoundContentStates();
+}
+
+// [get etActive Scenes]
+
+const std::list<const RBAScene*>&
+RBAResultImpl::getActiveScenes() const
+{
+ return curResultSet_->getActiveScenes();
+}
+
+const std::list<const RBAScene*>&
+RBAResultImpl::getPreActiveScenes() const
+{
+ return preResultSet_->getActiveScenes();
+}
+
+// [get InvisibleAreas/UnsoundingZone]
+
+const std::list<const RBAArea*>&
+RBAResultImpl::getInvisibleAreas() const
+{
+ return curResultSet_->getInvisibleAreas();
+}
+
+const std::list<const RBAArea*>&
+RBAResultImpl::getPreInvisibleAreas() const
+{
+ return preResultSet_->getInvisibleAreas();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getUnsoundingZones() const
+{
+ return curResultSet_->getUnsoundingZones();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getPreUnsoundingZones() const
+{
+ return preResultSet_->getUnsoundingZones();
+}
+
+// [get HiddenAreas/MuteZones]
+
+const std::list<const RBAArea*>&
+RBAResultImpl::getHiddenAreas() const
+{
+ return curResultSet_->getHiddenAreas();
+}
+
+const std::list<const RBAArea*>&
+RBAResultImpl::getPreHiddenAreas() const
+{
+ return preResultSet_->getHiddenAreas();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getMuteZones() const
+{
+ return curResultSet_->getMuteZones();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getPreMuteZones() const
+{
+ return preResultSet_->getMuteZones();
+}
+
+// [get Attenuated]
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getAttenuatedZones() const
+{
+ return curResultSet_->getAttenuatedZones();
+}
+
+const std::list<const RBAZone*>&
+RBAResultImpl::getPreAttenuatedZones() const
+{
+ return preResultSet_->getAttenuatedZones();
+}
+
+// [get Canceled Contents]
+
+const std::list<const RBAViewContent*>&
+RBAResultImpl::getCanceledViewContents() const
+{
+ return curResultSet_->getCanceledViewContents();
+}
+
+const std::list<const RBAViewContent*>&
+RBAResultImpl::getPreCanceledViewContents() const
+{
+ return preResultSet_->getCanceledViewContents();
+}
+
+const std::list<const RBASoundContent*>&
+RBAResultImpl::getCanceledSoundContents() const
+{
+ return curResultSet_->getCanceledSoundContents();
+}
+
+const std::list<const RBASoundContent*>&
+RBAResultImpl::getPreCanceledSoundContents() const
+{
+ return preResultSet_->getCanceledSoundContents();
+}
+
+// [get Standby Contents]
+
+const std::list<const RBAViewContent*>&
+RBAResultImpl::getStandbyViewContents() const
+{
+ return curResultSet_->getStandbyViewContents();
+}
+
+const std::list<const RBAViewContent*>&
+RBAResultImpl::getPreStandbyViewContents() const
+{
+ return preResultSet_->getStandbyViewContents();
+}
+
+const std::list<const RBASoundContent*>&
+RBAResultImpl::getStandbySoundContents() const
+{
+ return curResultSet_->getStandbySoundContents();
+}
+
+const std::list<const RBASoundContent*>&
+RBAResultImpl::getPreStandbySoundContents() const
+{
+ return preResultSet_->getStandbySoundContents();
+}
+
+// [get ContentStates]
+
+const RBAViewContentState*
+RBAResultImpl::getContentState(const RBAArea* area) const
+{
+ return dynamic_cast<const RBAViewContentState*>(
+ curResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(area)));
+}
+
+const RBAViewContentState*
+RBAResultImpl::getPreContentState(const RBAArea* area) const
+{
+ return dynamic_cast<const RBAViewContentState*>(
+ preResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(area)));
+}
+
+const RBASoundContentState*
+RBAResultImpl::getContentState(const RBAZone* zone) const
+{
+ return dynamic_cast<const RBASoundContentState*>(
+ curResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(zone)));
+}
+
+const RBASoundContentState*
+RBAResultImpl::getPreContentState(const RBAZone* zone) const
+{
+ return dynamic_cast<const RBASoundContentState*>(
+ preResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(zone)));
+}
+
+// [get Areas/Zones by ConentState]
+
+const std::list<const RBAArea*>
+RBAResultImpl::getArea(const RBAViewContentState* state) const
+{
+ std::list<const RBAArea*> areaList;
+ curResultSet_->getArea(state, areaList);
+ return areaList;
+}
+
+const std::list<const RBAArea*>
+RBAResultImpl::getPreArea(const RBAViewContentState* state) const
+{
+ std::list<const RBAArea*> areaList;
+ preResultSet_->getArea(state, areaList);
+ return areaList;
+}
+
+const std::list<const RBAZone*>
+RBAResultImpl::getZone(const RBASoundContentState* state) const
+{
+ std::list<const RBAZone*> zoneList;
+ curResultSet_->getZone(state, zoneList);
+ return zoneList;
+}
+
+const std::list<const RBAZone*>
+RBAResultImpl::getPreZone(const RBASoundContentState* state) const
+{
+ std::list<const RBAZone*> zoneList;
+ preResultSet_->getZone(state, zoneList);
+ return zoneList;
+}
+
+// [get Areas/Zones by Content]
+
+const std::list<const RBAArea*>
+RBAResultImpl::getArea(const RBAViewContent* content) const
+{
+ std::list<const RBAArea*> areaList;
+ curResultSet_->getArea(content, areaList);
+ return areaList;
+}
+
+const std::list<const RBAArea*>
+RBAResultImpl::getPreArea(const RBAViewContent* content) const
+{
+ std::list<const RBAArea*> areaList;
+ preResultSet_->getArea(content, areaList);
+ return areaList;
+}
+
+const std::list<const RBAZone*>
+RBAResultImpl::getZone(const RBASoundContent* content) const
+{
+ std::list<const RBAZone*> zoneList;
+ curResultSet_->getZone(content, zoneList);
+ return zoneList;
+}
+
+const std::list<const RBAZone*>
+RBAResultImpl::getPreZone(const RBASoundContent* content) const
+{
+ std::list<const RBAZone*> zoneList;
+ preResultSet_->getZone(content, zoneList);
+ return zoneList;
+}
+
+// [get Size]
+
+const RBASize*
+RBAResultImpl::getSize(const RBAArea* area) const
+{
+ return curResultSet_->getSize(area);
+}
+
+const RBASize*
+RBAResultImpl::getPreSize(const RBAArea* area) const
+{
+ return preResultSet_->getSize(area);
+}
+
+// [check Active Scene]
+bool
+RBAResultImpl::isActive(const RBAScene* scene) const
+{
+ return curResultSet_->isActive(scene);
+}
+
+bool
+RBAResultImpl::isPreActive(const RBAScene* scene) const
+{
+ return preResultSet_->isActive(scene);
+}
+
+// [check Active Content]
+bool
+RBAResultImpl::isActive(const RBAContent* const content) const
+{
+ return curResultSet_->isActive(content);
+}
+bool
+RBAResultImpl::isActive(const RBAViewContent* content) const
+{
+ return curResultSet_->isActive(dynamic_cast<const RBAContent*>(content));
+}
+
+bool
+RBAResultImpl::isActive(const RBASoundContent* content) const
+{
+ return curResultSet_->isActive(dynamic_cast<const RBAContent*>(content));
+}
+bool
+RBAResultImpl::isPreActive(const RBAContent* const content) const
+{
+ return preResultSet_->isActive(content);
+}
+bool
+RBAResultImpl::isPreActive(const RBAViewContent* content) const
+{
+ return preResultSet_->isActive(dynamic_cast<const RBAContent*>(content));
+}
+
+bool
+RBAResultImpl::isPreActive(const RBASoundContent* content) const
+{
+ return preResultSet_->isActive(dynamic_cast<const RBAContent*>(content));
+}
+
+// [check Active ContentState]
+bool
+RBAResultImpl::isActive(const RBAContentState* const state) const
+{
+ return curResultSet_->isActive(state);
+}
+
+bool
+RBAResultImpl::isActive(const RBAViewContentState* const state) const
+{
+ return isActive(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isActive(const RBASoundContentState* const state) const
+{
+ return isActive(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isPreActive(const RBAContentState* const state) const
+{
+ return preResultSet_->isActive(state);
+}
+
+bool
+RBAResultImpl::isPreActive(const RBAViewContentState* const state) const
+{
+ return isPreActive(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isPreActive(const RBASoundContentState* const state) const
+{
+ return isPreActive(dynamic_cast<const RBAContentState*>(state));
+}
+
+const RBAContentState*
+RBAResultImpl::getActiveState(const RBAContent* const content) const
+{
+ if (curResultSet_->isActive(content)){
+ return curResultSet_->getReqestState(content);
+ }
+ return nullptr;
+}
+
+const RBAContentState*
+RBAResultImpl::getPreActiveState(const RBAContent* const content) const
+{
+ if (preResultSet_->isActive(content)){
+ return preResultSet_->getReqestState(content);
+ }
+ return nullptr;
+}
+
+// [check Visible/Sounding Alloc ContentState]
+
+bool
+RBAResultImpl::isOutputting(const RBAAllocatable* const alloc) const
+{
+ return curResultSet_->isOutputting(alloc);
+}
+
+bool
+RBAResultImpl::isPreOutputting(const RBAAllocatable* const alloc) const
+{
+ return preResultSet_->isOutputting(alloc);
+}
+
+bool
+RBAResultImpl::isOutputting(const RBAContentState* const state) const
+{
+ return curResultSet_->isOutputting(state);
+}
+
+bool
+RBAResultImpl::isPreOutputting(const RBAContentState* const state) const
+{
+ return preResultSet_->isOutputting(state);
+}
+
+bool
+RBAResultImpl::isVisible(const RBAViewContentState* state) const
+{
+ return isOutputting(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isPreVisible(const RBAViewContentState* state) const
+{
+ return isPreOutputting(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isSounding(const RBASoundContentState* state) const
+{
+ return isOutputting(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isPreSounding(const RBASoundContentState* state) const
+{
+ return isPreOutputting(dynamic_cast<const RBAContentState*>(state));
+}
+
+// [get View/Sound ContentState]
+
+const RBAContentState*
+RBAResultImpl::getAllocatedContentState(const RBAAllocatable* const allocatable) const
+{
+ return curResultSet_->getContentState(allocatable);
+}
+
+const RBAContentState*
+RBAResultImpl::getPreAllocatedContentState(const RBAAllocatable* const allocatable) const
+{
+ return preResultSet_->getContentState(allocatable);
+}
+
+const RBAViewContentState*
+RBAResultImpl::getViewContentState(const RBAArea* area) const
+{
+ return dynamic_cast<const RBAViewContentState*>(
+ curResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(area)));
+}
+
+const RBAViewContentState*
+RBAResultImpl::getPreViewContentState(const RBAArea* area) const
+{
+ return dynamic_cast<const RBAViewContentState*>(
+ preResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(area)));
+}
+
+const RBASoundContentState*
+RBAResultImpl::getSoundContentState(const RBAZone* zone) const
+{
+ return dynamic_cast<const RBASoundContentState*>(
+ curResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(zone)));
+}
+
+const RBASoundContentState*
+RBAResultImpl::getPreSoundContentState(const RBAZone* zone) const
+{
+ return dynamic_cast<const RBASoundContentState*>(
+ preResultSet_->getContentState(dynamic_cast<const RBAAllocatable*>(zone)));
+}
+
+// [check Hidden/Mute]
+
+bool
+RBAResultImpl::isHidden(const RBAArea* area) const
+{
+ return isHidden(dynamic_cast<const RBAAllocatable*>(area));
+}
+
+bool
+RBAResultImpl::isPreHidden(const RBAArea* area) const
+{
+ return isPreHidden(dynamic_cast<const RBAAllocatable*>(area));
+}
+
+bool
+RBAResultImpl::isMute(const RBAZone* zone) const
+{
+ return isHidden(dynamic_cast<const RBAAllocatable*>(zone));
+}
+
+bool
+RBAResultImpl::isPreMute(const RBAZone* zone) const
+{
+ return isPreHidden(dynamic_cast<const RBAAllocatable*>(zone));
+}
+
+// [check Attenuated]
+bool
+RBAResultImpl::isAttenuated(const RBAZone* zone) const
+{
+ return curResultSet_->isAttenuated(zone);
+}
+
+bool
+RBAResultImpl::isPreAttenuated(const RBAZone* zone) const
+{
+ return preResultSet_->isAttenuated(zone);
+}
+
+// [common]
+
+const std::list<const RBAViewAction*>&
+RBAResultImpl::getViewActions() const
+{
+ viewActionsForPublicUse_.clear();
+ for (auto& va :viewActions_) {
+ viewActionsForPublicUse_.push_back(va.get());
+ }
+ return viewActionsForPublicUse_;
+}
+
+RBAResultStatusType
+RBAResultImpl::getStatusType() const
+{
+ return statusType_;
+}
+
+bool
+RBAResultImpl::isLater(const RBAContent* const target,
+ const RBAContent* const comparisonTarget) const
+{
+ return curResultSet_->isLater(target, comparisonTarget);
+}
+
+std::string
+RBAResultImpl::getLog() const
+{
+ return log_;
+}
+
+void
+RBAResultImpl::setLog(const std::string& log)
+{
+ log_ = log;
+}
+
+bool
+RBAResultImpl::hasDisplayingArea(const RBADisplay* display) const
+{
+ if (display == nullptr) {
+ return false;
+ } else {
+ return curResultSet_->hasDisplayingArea(display);
+ }
+}
+
+bool
+RBAResultImpl::satisfiesConstraints() const
+{
+ if(statusType_ != RBAResultStatusType::SUCCESS) {
+ return false;
+ }
+ return arb_->satisfiesConstraints();
+}
+
+void
+RBAResultImpl::setSceneProperty(const RBASceneImpl* const scene,
+ const std::string& propertyName,
+ const std::int32_t value)
+{
+ curResultSet_->setSceneProperty(scene->getProperty(propertyName), value);
+}
+
+void
+RBAResultImpl::setSceneProperty(const RBAAbstractProperty* const property,
+ const std::int32_t value)
+{
+ curResultSet_->setSceneProperty(property, value);
+}
+
+std::int32_t
+RBAResultImpl::getSceneProperty(const RBAScene* scene,
+ const std::string& propertyName) const
+{
+ if(scene == nullptr) {
+ return -99;
+ }
+
+ const RBAAbstractProperty* const prop
+ {dynamic_cast<const RBASceneImpl*>(scene)->getProperty(propertyName)};
+ if(prop == nullptr) {
+ return -99;
+ }
+
+ return curResultSet_->getSceneProperty(prop);
+}
+
+std::int32_t
+RBAResultImpl::getSceneProperty(const RBAAbstractProperty* const property) const
+{
+ return curResultSet_->getSceneProperty(property);
+}
+
+std::int32_t
+RBAResultImpl::getPreSceneProperty(const RBAAbstractProperty* const property) const
+{
+ return preResultSet_->getSceneProperty(property);
+}
+
+//
+// Internal
+//
+
+// Impl [VisibleArea/SoundingZone]
+
+const std::set<const RBAAllocatable*>&
+RBAResultImpl::getOutputtingAllocatables() const
+{
+ return curResultSet_->getOutputtingAllocatables();
+}
+
+// Impl [get Active View/Sound ContentStates]
+
+const std::set<const RBAContentState*>&
+RBAResultImpl::getActiveContentStates() const
+{
+ return curResultSet_->getActiveContentStates();
+}
+
+// Impl [get ContentStates]
+const RBAContentState*
+RBAResultImpl::getContentState(const RBAAllocatable* const allocatable) const
+{
+ return curResultSet_->getContentState(allocatable);
+}
+
+const RBAContentState*
+RBAResultImpl::getDirectContentState(const RBAAllocatable* const allocatable) const
+{
+ return curResultSet_->getDirectContentState(allocatable);
+}
+
+const RBAContentState*
+RBAResultImpl::getPreContentState(const RBAAllocatable* const allocatable) const
+{
+ return preResultSet_->getContentState(allocatable);
+}
+
+const RBAContentState*
+RBAResultImpl::getDirectPreContentState(const RBAAllocatable* const allocatable) const
+{
+ return preResultSet_->getDirectContentState(allocatable);
+}
+
+// Impl [get Areas/Zones by ConentState]
+
+std::list<const RBAAllocatable*>
+RBAResultImpl::getAllocatable(const RBAContentState* const state) const
+{
+ std::list<const RBAAllocatable*> allocatables;
+ if(state->isViewContentState()) {
+ std::list<const RBAArea*> areaList;
+ curResultSet_->getArea(dynamic_cast<const RBAViewContentState*>(state),
+ areaList);
+ for (const auto& area : areaList) {
+ allocatables.push_back(dynamic_cast<const RBAAllocatable*>(area));
+ }
+ }
+ else {
+ std::list<const RBAZone*> zoneList;
+ curResultSet_->getZone(dynamic_cast<const RBASoundContentState*>(state),
+ zoneList);
+ for (const auto& zone : zoneList) {
+ allocatables.push_back(dynamic_cast<const RBAAllocatable*>(zone));
+ }
+ }
+ return allocatables;
+}
+
+// Impl [check Aleady Visible/Sounding]
+bool
+RBAResultImpl::isAlreadyOutputting(const RBAContentState* const state) const
+{
+ return curResultSet_->isAlreadyOutputting(state);
+}
+
+// Impl [set Active Scene]
+
+void
+RBAResultImpl::setActive(const RBAScene* const scene, const bool newActive)
+{
+ curResultSet_->setActive(scene, newActive);
+}
+
+// Impl [set Active ContentState]
+
+void
+RBAResultImpl::setActive(const RBAContentState* const state, const bool newActive)
+{
+ curResultSet_->setActive(state, newActive);
+}
+
+// Impl [add Standby Content]
+
+void
+RBAResultImpl::addStandbyContent(const RBAContent* const content)
+{
+ curResultSet_->addStandbyContent(content);
+}
+
+// Impl [check Visible/Sounding Area/Zone]
+
+bool
+RBAResultImpl::isVisible(const RBAArea* area) const
+{
+ return curResultSet_->isOutputting(dynamic_cast<const RBAAllocatable*>(area));
+}
+
+bool
+RBAResultImpl::isPreVisible(const RBAArea* area) const
+{
+ return preResultSet_->isOutputting(dynamic_cast<const RBAAllocatable*>(area));
+}
+
+bool
+RBAResultImpl::isSounding(const RBAZone* zone) const
+{
+ return curResultSet_->isOutputting(dynamic_cast<const RBAAllocatable*>(zone));
+}
+
+bool
+RBAResultImpl::isPreSounding(const RBAZone* zone) const
+{
+ return preResultSet_->isOutputting(dynamic_cast<const RBAAllocatable*>(zone));
+}
+
+// Impl [set View/Sound ContentState]
+
+void RBAResultImpl::setContentState(const RBAAllocatable* const allocatable,
+ const RBAContentState* const state)
+{
+ curResultSet_->setContentState(allocatable, state);
+}
+
+// Impl [check Hidden/Mute Area/Zone]
+
+bool
+RBAResultImpl::isHidden(const RBAAllocatable* const allocatable) const
+{
+ return curResultSet_->isHidden(allocatable);
+}
+
+bool
+RBAResultImpl::isPreHidden(const RBAAllocatable* const allocatable) const
+{
+ return preResultSet_->isHidden(allocatable);
+}
+
+// Impl [set Cancel ContentState]
+
+void
+RBAResultImpl::setCancel(const RBAContentState* const state, const bool checked)
+{
+ curResultSet_->setCancel(state, checked);
+}
+
+// Impl [check Cancel ContentState]
+
+bool
+RBAResultImpl::isCancel(const RBAContentState* const state) const
+{
+ return curResultSet_->isCancel(state);
+}
+
+bool
+RBAResultImpl::isPreCancel(const RBAContentState* const state) const
+{
+ return preResultSet_->isCancel(state);
+}
+
+bool
+RBAResultImpl::isCancel(const RBAViewContentState* state) const
+{
+ return isCancel(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isPreCancel(const RBAViewContentState* state) const
+{
+ return isPreCancel(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isCancel(const RBASoundContentState* state) const
+{
+ return isCancel(dynamic_cast<const RBAContentState*>(state));
+}
+
+bool
+RBAResultImpl::isPreCancel(const RBASoundContentState* state) const
+{
+ return isPreCancel(dynamic_cast<const RBAContentState*>(state));
+}
+
+// Impl [add Visible/Sounding ContentState]
+
+void
+RBAResultImpl::addOutputtingContentState(const RBAContentState* const state)
+{
+ curResultSet_->addOutputtingContentState(state);
+}
+
+// Impl [cancel ContentState]
+
+void
+RBAResultImpl::cancelContentState(const RBAContentState* const state)
+{
+ curResultSet_->cancelContentState(state);
+}
+
+// Impl [common]
+
+std::unique_ptr<RBAResultSet>
+RBAResultImpl::createBackupCurrentResultSet()
+{
+ return std::make_unique<RBAResultSet>(*curResultSet_);
+}
+
+std::unique_ptr<RBAResultSet>
+RBAResultImpl::createNextCurrentResultSet()
+{
+ std::unique_ptr<RBAResultSet> nextResultSet {std::make_unique<RBAResultSet>()};
+ nextResultSet->copyActives(curResultSet_);
+ nextResultSet->copyProperties(curResultSet_);
+ return nextResultSet;
+}
+
+void
+RBAResultImpl::addViewAction(std::unique_ptr<RBAViewAction>& newViewAction)
+{
+ viewActions_.push_back(move(newViewAction));
+}
+
+void
+RBAResultImpl::setStatusType(const RBAResultStatusType newStatusType)
+{
+ statusType_ = newStatusType;
+}
+
+void
+RBAResultImpl::updateActiveContentStates()
+{
+ curResultSet_->updateActiveContentStates();
+}
+
+void
+RBAResultImpl::setContentOfEventProcessing(const RBAEventProcessing* const eventProcessing,
+ const RBAContent* const viewContent)
+{
+ curResultSet_->setContentOfEventProcessing(eventProcessing, viewContent);
+}
+
+std::unique_ptr<RBAResultSet>&
+RBAResultImpl::getCurResultSet()
+{
+ return curResultSet_;
+}
+
+std::unique_ptr<RBAResultSet>&
+RBAResultImpl::getPreResultSet()
+{
+ return preResultSet_;
+}
+
+RBAContentStatusType RBAResultImpl::getStatusType(const RBAContent* const content) const
+{
+ return curResultSet_->getStatusType(content);
+}
+bool RBAResultImpl::isStandby(const RBAContent* const content) const
+{
+ return curResultSet_->isStandby(content);
+}
+
+bool RBAResultImpl::hasBeenCanceled(const RBAContent* const content) const
+{
+ return curResultSet_->hasBeenCanceled(content);
+}
+
+bool RBAResultImpl::hasBeenPreCanceled(const RBAContent* const content) const
+{
+ return preResultSet_->hasBeenCanceled(content);
+}
+
+bool RBAResultImpl::hasBeenDisplayed(const RBAContent* const content) const
+{
+ return curResultSet_->hasBeenDisplayed(content);
+}
+bool RBAResultImpl::hasBeenPreDisplayed(const RBAContent* const content) const
+{
+ return preResultSet_->hasBeenDisplayed(content);
+}
+
+void RBAResultImpl::updateStatus(const RBAContent* const content)
+{
+ const RBAContentState* const s {getActiveState(content)};
+ if (s != nullptr) {
+ if (isOutputting(s)) {
+ curResultSet_->setStatusType(content, RBAContentStatusType::Displayed);
+ } else if (isCancel(s)) {
+ curResultSet_->setStatusType(content, RBAContentStatusType::Canceled);
+ } else if (curResultSet_->getStatusType(content) != RBAContentStatusType::Undisplayed) {
+ curResultSet_->setStatusType(content, RBAContentStatusType::StandBy);
+ } else {
+ ;
+ }
+ }
+}
+
+std::unordered_map<const RBAContent*, RBAContentStatus>* RBAResultImpl::getCurStatus() const
+{
+ return curResultSet_->getStatus();
+}
+
+std::set<const RBASceneImpl*>& RBAResultImpl::getDifferentConditionScenes() const
+{
+ return (curResultSet_->getDifferentConditionScenes(*preResultSet_.get()));
+}
+#ifdef RBA_USE_LOG
+void
+RBAResultImpl::addFailedConstraint(const RBAConstraint* constraint)
+{
+ curResultSet_->addFailedConstraint(constraint);
+}
+
+const std::list<const RBAConstraint*>&
+RBAResultImpl::getFailedConstraints() const
+{
+ return curResultSet_->getFailedConstraints();
+}
+#endif
+
+}
diff --git a/src/core/logic/RBAResultImpl.hpp b/src/core/logic/RBAResultImpl.hpp
new file mode 100644
index 0000000..d7a1aa1
--- /dev/null
+++ b/src/core/logic/RBAResultImpl.hpp
@@ -0,0 +1,343 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAResultImpl (result of arbitration implementation) class header
+ */
+
+#ifndef RBARESULTIMPL_HPP
+#define RBARESULTIMPL_HPP
+
+#include <memory>
+#include <unordered_map>
+#include <set>
+#include "RBAResult.hpp"
+#include "RBAResultStatusType.hpp"
+#include "RBAContentStatusType.hpp"
+
+namespace rba {
+
+class RBAArbitrator;
+class RBAArea;
+class RBAViewContent;
+class RBAViewContentState;
+class RBASize;
+class RBAScene;
+class RBAAbstractProperty;
+class RBAAreaImpl;
+class RBAContentStateImpl;
+class RBAViewContentImpl;
+class RBAViewContentStateImpl;
+class RBASizeImpl;
+class RBASceneImpl;
+class RBAResultSet;
+class RBAViewAction;
+class RBAZoneImpl;
+class RBASoundContentImpl;
+class RBASoundContentStateImpl;
+class RBASoundContent;
+class RBASoundContentState;
+class RBAContentState;
+class RBAAllocatable;
+class RBAContent;
+class RBAEventProcessing;
+class RBAConstraint;
+class RBAContentStatus;
+
+class DLL_EXPORT RBAResultImpl : public RBAResult
+{
+public:
+ RBAResultImpl(const RBAArbitrator* const arb,
+ std::unique_ptr<RBAResultSet> newPrevResultSet);
+ RBAResultImpl(const RBAArbitrator* const arb,
+ std::unique_ptr<RBAResultSet> newPrevResultSet,
+ std::unique_ptr<RBAResultSet> newCurResultSet);
+ RBAResultImpl(const RBAResultImpl* const replicationTarget);
+ RBAResultImpl(const RBAResultImpl&)=delete;
+ RBAResultImpl(const RBAResultImpl&&)=delete;
+ RBAResultImpl& operator=(const RBAResultImpl&)=delete;
+ RBAResultImpl& operator=(const RBAResultImpl&&)=delete;
+ virtual ~RBAResultImpl()=default;
+
+public:
+
+ //
+ // External
+ //
+
+ // [get VisibleArea/SoundingZone]
+ const std::list<const RBAArea*>& getVisibleAreas() const override;
+ const std::list<const RBAArea*>& getPreVisibleAreas() const override;
+ const std::list<const RBAZone*>& getSoundingZones() const override;
+ const std::list<const RBAZone*>& getPreSoundingZones() const override;
+
+ // [get Visible/Sounding ContentStates]
+ const std::list<const RBAViewContentState*>& getVisibleContentStates() const override;
+ const std::list<const RBAViewContentState*>& getPreVisibleContentStates() const override;
+ const std::list<const RBASoundContentState*>& getSoundingContentStates() const override;
+ const std::list<const RBASoundContentState*>& getPreSoundingContentStates() const override;
+
+ // [get Active View/Sound ContentStates]
+ const std::list<const RBAViewContentState*>& getActiveViewContentStates() const override;
+ const std::list<const RBAViewContentState*>& getPreActiveViewContentStates() const override;
+ const std::list<const RBASoundContentState*>& getActiveSoundContentStates() const override;
+ const std::list<const RBASoundContentState*>& getPreActiveSoundContentStates() const override;
+
+ // [get Active Scenes]
+ const std::list<const RBAScene*>& getActiveScenes() const override;
+ const std::list<const RBAScene*>& getPreActiveScenes() const override;
+
+ // [get InvisibleAreas/UnsoundingZone]
+ const std::list<const RBAArea*>& getInvisibleAreas() const override;
+ const std::list<const RBAArea*>& getPreInvisibleAreas() const override;
+ const std::list<const RBAZone*>& getUnsoundingZones() const override;
+ const std::list<const RBAZone*>& getPreUnsoundingZones() const override;
+
+ // [get HiddenAreas/MuteZones]
+ const std::list<const RBAArea*>& getHiddenAreas() const override;
+ const std::list<const RBAArea*>& getPreHiddenAreas() const override;
+ const std::list<const RBAZone*>& getMuteZones() const override;
+ const std::list<const RBAZone*>& getPreMuteZones() const override;
+
+ // [get Attenuated]
+ const std::list<const RBAZone*>& getAttenuatedZones() const override;
+ const std::list<const RBAZone*>& getPreAttenuatedZones() const override;
+
+ // [get Canceled Contents]
+ const std::list<const RBAViewContent*>& getCanceledViewContents() const override;
+ const std::list<const RBAViewContent*>& getPreCanceledViewContents() const override;
+ const std::list<const RBASoundContent*>& getCanceledSoundContents() const override;
+ const std::list<const RBASoundContent*>& getPreCanceledSoundContents() const override;
+
+ // [get Standby Contents]
+ const std::list<const RBAViewContent*>& getStandbyViewContents() const override;
+ const std::list<const RBAViewContent*>& getPreStandbyViewContents() const override;
+ const std::list<const RBASoundContent*>& getStandbySoundContents() const override;
+ const std::list<const RBASoundContent*>& getPreStandbySoundContents() const override;
+
+ // [get ContentStates]
+ const RBAViewContentState* getContentState(const RBAArea* area) const override;
+ const RBAViewContentState* getPreContentState(const RBAArea* area) const override;
+ const RBASoundContentState* getContentState(const RBAZone* zone) const override;
+ const RBASoundContentState* getPreContentState(const RBAZone* zone) const override;
+
+ // [get Areas/Zones by ConentState]
+ const std::list<const RBAArea*> getArea(const RBAViewContentState* state) const override;
+ const std::list<const RBAArea*> getPreArea(const RBAViewContentState* state) const override;
+ const std::list<const RBAZone*> getZone(const RBASoundContentState* state) const override;
+ const std::list<const RBAZone*> getPreZone(const RBASoundContentState* state) const override;
+
+ // [get Areas/Zones by Content]
+ const std::list<const RBAArea*> getArea(const RBAViewContent* content) const override;
+ const std::list<const RBAArea*> getPreArea(const RBAViewContent* content) const override;
+ const std::list<const RBAZone*> getZone(const RBASoundContent* content) const override;
+ const std::list<const RBAZone*> getPreZone(const RBASoundContent* content) const override;
+
+ // [get Size]
+ const RBASize* getSize(const RBAArea* area) const override;
+ const RBASize* getPreSize(const RBAArea* area) const override;
+
+ // [check Active Scene]
+ bool isActive(const RBAScene* scene) const override;
+ bool isPreActive(const RBAScene* scene) const override;
+
+ // [check Active Content]
+ bool isActive(const RBAContent* const content) const;
+ bool isPreActive(const RBAContent* const content) const;
+ bool isActive(const RBAViewContent* content) const override;
+ bool isActive(const RBASoundContent* content) const override;
+ bool isPreActive(const RBAViewContent* content) const override;
+ bool isPreActive(const RBASoundContent* content) const override;
+
+ // [check Visible/Sounding Area/Zone]
+ bool isVisible(const RBAArea* area) const override;
+ bool isPreVisible(const RBAArea* area) const override;
+ bool isSounding(const RBAZone* zone) const override;
+ bool isPreSounding(const RBAZone* zone) const override;
+
+ // [check Visible/Sounding ContentState]
+ bool isVisible(const RBAViewContentState* state) const override;
+ bool isPreVisible(const RBAViewContentState* state) const override;
+ bool isSounding(const RBASoundContentState* state) const override;
+ bool isPreSounding(const RBASoundContentState* state) const override;
+
+ // [get View/Sound ContentState]
+ const RBAViewContentState* getViewContentState(const RBAArea* area) const override;
+ virtual const RBAViewContentState* getPreViewContentState(const RBAArea* area) const;
+ const RBASoundContentState* getSoundContentState(const RBAZone* zone) const override;
+ const RBASoundContentState* getPreSoundContentState(const RBAZone* zone) const override;
+
+ // [check Hidden/Mute]
+ bool isHidden(const RBAArea* area) const override;
+ bool isPreHidden(const RBAArea* area) const override;
+ bool isMute(const RBAZone* zone) const override;
+ bool isPreMute(const RBAZone* zone) const override;
+
+ // [check Attenuated]
+ bool isAttenuated(const RBAZone* zone) const override;
+ bool isPreAttenuated(const RBAZone* zone) const override;
+
+ // [check Cancel]
+ bool isCancel(const RBAViewContentState* state) const override;
+ bool isPreCancel(const RBAViewContentState* state) const override;
+ bool isCancel(const RBASoundContentState* state) const override;
+ bool isPreCancel(const RBASoundContentState* state) const override;
+
+ // [common]
+ const std::list<const RBAViewAction*>& getViewActions() const override;
+ RBAResultStatusType getStatusType() const override;
+ bool isLater(const RBAContent* const target,
+ const RBAContent* const comparisonTarget) const;
+
+ std::string getLog() const override;
+ void setLog(const std::string& log);
+
+ bool hasDisplayingArea(const RBADisplay* display) const override;
+
+ bool satisfiesConstraints() const override;
+
+ std::int32_t getSceneProperty(const RBAScene* scene,
+ const std::string& propertyName) const override;
+ //
+ // Internal
+ //
+
+ // Impl [get VisibleArea/SoundingZone]
+ const std::set<const RBAAllocatable*>& getOutputtingAllocatables() const;
+
+ // Impl [get Active View/Sound ContentStates]
+ const std::set<const RBAContentState*>& getActiveContentStates() const;
+
+ // Impl [get ContentStates]
+ const RBAContentState* getContentState(const RBAAllocatable* const allocatable) const;
+ const RBAContentState* getDirectContentState(const RBAAllocatable* const allocatable) const;
+ const RBAContentState* getPreContentState(const RBAAllocatable* const allocatable) const;
+ const RBAContentState* getDirectPreContentState(const RBAAllocatable* const allocatable) const;
+
+ // Impl [get Areas/Zones by ConentState]
+ std::list<const RBAAllocatable*> getAllocatable(const RBAContentState* const state) const;
+
+ // Impl [check Aleady Outputting]
+ bool isAlreadyOutputting(const RBAContentState* const state) const;
+
+ // Impl [set Active Scene]
+ void setActive(const RBAScene* const scene, const bool newActive);
+
+ // Impl [check Active ContentState]
+ bool isActive(const RBAContentState* const state) const;
+ bool isActive(const RBAViewContentState* const state) const;
+ bool isActive(const RBASoundContentState* const state) const;
+ bool isPreActive(const RBAContentState* const state) const;
+ bool isPreActive(const RBAViewContentState* const state) const;
+ bool isPreActive(const RBASoundContentState* const state) const;
+ const RBAContentState* getActiveState(const RBAContent* const content) const;
+ const RBAContentState* getPreActiveState(const RBAContent* const content) const;
+
+ // Impl [set Active ContentState]
+ void setActive(const RBAContentState* const state, const bool newActive);
+
+ // Impl [add Standby Content]
+ void addStandbyContent(const RBAContent* const content);
+
+ // Impl [check Visible/Sounding Alloc ContentState]
+ bool isOutputting(const RBAAllocatable* const alloc) const;
+ bool isPreOutputting(const RBAAllocatable* const alloc) const;
+ bool isOutputting(const RBAContentState* const state) const;
+ bool isPreOutputting(const RBAContentState* const state) const;
+
+ // Impl [get View/Sound ContentState by Allocatable]
+ const RBAContentState* getAllocatedContentState(const RBAAllocatable* const allocatable) const;
+ const RBAContentState* getPreAllocatedContentState(const RBAAllocatable* const allocatable) const;
+
+ // Impl [set View/Sound ContentState]
+ void setContentState(const RBAAllocatable* const allocatable, const RBAContentState* const state);
+
+ // Impl [check Hidden/Mute Area/Zone]
+ bool isHidden(const RBAAllocatable* const allocatable) const;
+ bool isPreHidden(const RBAAllocatable* const allocatable) const;
+
+ // Impl [set Cancel ContentState]
+ void setCancel(const RBAContentState* const state, const bool checked);
+
+ // Impl [check Cancel ContentState]
+ bool isCancel(const RBAContentState* const state) const;
+ bool isPreCancel(const RBAContentState* const state) const;
+
+ // Impl [add Visible/Sounding ContentState]
+ void addOutputtingContentState(const RBAContentState* const state);
+
+ // Impl [cancel ContentState]
+ void cancelContentState(const RBAContentState* const state);
+
+ // Impl [common]
+ std::unique_ptr<RBAResultSet> createBackupCurrentResultSet();
+ std::unique_ptr<RBAResultSet> createNextCurrentResultSet();
+ void addViewAction(std::unique_ptr<RBAViewAction>& newViewAction);
+ void setStatusType(const RBAResultStatusType newStatusType);
+ void updateActiveContentStates();
+ void setSceneProperty(const RBASceneImpl* const scene,
+ const std::string& propertyName,
+ const std::int32_t value);
+ void setSceneProperty(const RBAAbstractProperty* const property,
+ const std::int32_t value);
+ std::int32_t getSceneProperty(const RBAAbstractProperty* const property) const;
+ std::int32_t getPreSceneProperty(const RBAAbstractProperty* const property) const;
+ void setContentOfEventProcessing(const RBAEventProcessing* const eventProcessing,
+ const RBAContent* const viewContent);
+ std::unique_ptr<RBAResultSet>& getCurResultSet();
+ std::unique_ptr<RBAResultSet>& getPreResultSet();
+ RBAContentStatusType getStatusType(const RBAContent* const content) const;
+ bool isStandby(const RBAContent* const content) const;
+ bool hasBeenCanceled(const RBAContent* const content) const;
+ bool hasBeenPreCanceled(const RBAContent* const content) const;
+ bool hasBeenDisplayed(const RBAContent* const content) const;
+ bool hasBeenPreDisplayed(const RBAContent* const content) const;
+
+ /// @brief Update status of Content
+ /// @details Update the status based on the request status,
+ /// output status, and status at the time of request of the content
+ /// @param[in] content Content to be updated
+ void updateStatus(const RBAContent* const content);
+
+ std::unordered_map<const RBAContent*, RBAContentStatus>* getCurStatus() const;
+ std::set<const RBASceneImpl*>& getDifferentConditionScenes() const;
+#ifdef RBA_USE_LOG
+ void addFailedConstraint(const RBAConstraint* constraint);
+ const std::list<const RBAConstraint*>& getFailedConstraints() const;
+#endif
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::unique_ptr<RBAResultSet> curResultSet_;
+ std::unique_ptr<RBAResultSet> preResultSet_;
+ mutable std::list<std::unique_ptr<RBAViewAction>> viewActions_;
+ mutable std::list<const RBAViewAction*> viewActionsForPublicUse_;
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ const RBAArbitrator* arb_;
+ RBAResultStatusType statusType_;
+ std::string log_;
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAResultSet.cpp b/src/core/logic/RBAResultSet.cpp
new file mode 100644
index 0000000..bcc9892
--- /dev/null
+++ b/src/core/logic/RBAResultSet.cpp
@@ -0,0 +1,996 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ResultSet (set arbitration result) class
+ */
+
+#include <algorithm>
+#include <unordered_map>
+#include "RBAResultSet.hpp"
+
+#include "RBAContentStatusType.hpp"
+#include "RBAAreaImpl.hpp"
+#include "RBAViewContentImpl.hpp"
+#include "RBAViewContentState.hpp"
+#include "RBASizeImpl.hpp"
+#include "RBAZone.hpp"
+#include "RBAZoneImpl.hpp"
+#include "RBASoundContent.hpp"
+#include "RBASoundContentState.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBAContentState.hpp"
+#include "RBAContent.hpp"
+#include "RBAAbstractAllocatable.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAConstraint.hpp"
+#include "RBADisplay.hpp"
+#include "RBAAbstractProperty.hpp"
+
+namespace rba {
+
+RBAResultSet::RBAResultSet(const RBAResultSet& resultSet)
+ : outputtingAllocs_{resultSet.outputtingAllocs_}
+ , hiddenAllocs_{resultSet.hiddenAllocs_}
+ , activeContentStates_{resultSet.activeContentStates_}
+ , canceledContentStates_{resultSet.canceledContentStates_}
+ , allocToContentState_{resultSet.allocToContentState_}
+ , visibleAreas_{resultSet.visibleAreas_}
+ , soundingZones_{resultSet.soundingZones_}
+ , invisibleAreas_{resultSet.invisibleAreas_}
+ , unsoundingZones_{resultSet.unsoundingZones_}
+ , hiddenAreas_{resultSet.hiddenAreas_}
+ , muteZones_{resultSet.muteZones_}
+ , attenuatedZones_{resultSet.attenuatedZones_}
+ , canceledViewContents_{resultSet.canceledViewContents_}
+ , canceledSoundContents_{resultSet.canceledSoundContents_}
+ , standbyViewContents_{resultSet.standbyViewContents_}
+ , standbySoundContents_{resultSet.standbySoundContents_}
+ , visibleContentStates_{resultSet.visibleContentStates_}
+ , soundingContentStates_{resultSet.soundingContentStates_}
+ , activeViewContentStates_{resultSet.activeViewContentStates_}
+ , activeSoundContentStates_{resultSet.activeSoundContentStates_}
+ , requestOrderView_{resultSet.requestOrderView_}
+ , requestOrderSound_{resultSet.requestOrderSound_}
+ , activeScenes_{resultSet.activeScenes_}
+ , propertyMap_{resultSet.propertyMap_}
+ , event_content_{resultSet.event_content_}
+ , contentToStatus_{resultSet.contentToStatus_}
+ , requestContentStateMap_{resultSet.requestContentStateMap_}
+#ifdef RBA_USE_LOG
+ , failedConstraints_{resultSet.failedConstraints_}
+#endif
+{
+}
+
+// Impl [get VisibleArea/SoundingZone]
+
+const std::set<const RBAAllocatable*>&
+RBAResultSet::getOutputtingAllocatables() const
+{
+ return outputtingAllocs_;
+}
+
+const std::list<const RBAArea*>&
+RBAResultSet::getVisibleAreas() const
+{
+ return visibleAreas_;
+}
+
+const std::list<const RBAZone*>&
+RBAResultSet::getSoundingZones() const
+{
+ return soundingZones_;
+}
+
+// Impl [get Visible/Sounding ContentStates]
+
+const std::list<const RBAViewContentState*>&
+RBAResultSet::getVisibleContentStates() const
+{
+ return visibleContentStates_;
+}
+
+const std::list<const RBASoundContentState*>&
+RBAResultSet::getSoundingContentStates() const
+{
+ return soundingContentStates_;
+}
+
+// Impl [get Active View/Sound ContentStates]
+
+const std::set<const RBAContentState*>&
+RBAResultSet::getActiveContentStates() const
+{
+ return activeContentStates_;
+}
+
+const std::list<const RBAViewContentState*>&
+RBAResultSet::getActiveViewContentStates() const
+{
+ return activeViewContentStates_;
+}
+
+const std::list<const RBASoundContentState*>&
+RBAResultSet::getActiveSoundContentStates() const
+{
+ return activeSoundContentStates_;
+}
+
+// Impl [get Active Scenes]
+
+const std::list<const RBAScene*>&
+RBAResultSet::getActiveScenes() const
+{
+ return activeScenes_;
+}
+
+// Impl [get InvisibleAreas/UnsoundingZone]
+
+const std::list<const RBAArea*>&
+RBAResultSet::getInvisibleAreas() const
+{
+ return invisibleAreas_;
+}
+
+const std::list<const RBAZone*>&
+RBAResultSet::getUnsoundingZones() const
+{
+ return unsoundingZones_;
+}
+
+// Impl [get HiddenAreas/MuteZones]
+
+const std::list<const RBAArea*>&
+RBAResultSet::getHiddenAreas() const
+{
+ return hiddenAreas_;
+}
+
+const std::list<const RBAZone*>&
+RBAResultSet::getMuteZones() const
+{
+ return muteZones_;
+}
+
+// Impl [get Attenuated]
+const std::list<const RBAZone*>&
+RBAResultSet::getAttenuatedZones() const
+{
+ return attenuatedZones_;
+}
+
+// Impl [get Canceled Contents]
+
+const std::list<const RBAViewContent*>&
+RBAResultSet::getCanceledViewContents() const
+{
+ return canceledViewContents_;
+}
+
+const std::list<const RBASoundContent*>&
+RBAResultSet::getCanceledSoundContents() const
+{
+ return canceledSoundContents_;
+}
+
+// Impl [get Standby Contents]
+
+const std::list<const RBAViewContent*>&
+RBAResultSet::getStandbyViewContents() const
+{
+ return standbyViewContents_;
+}
+
+const std::list<const RBASoundContent*>&
+RBAResultSet::getStandbySoundContents() const
+{
+ return standbySoundContents_;
+}
+
+// Impl [get ContentStates]
+
+const RBAContentState*
+RBAResultSet::getContentState(const RBAAllocatable* const alloc) const
+{
+ if(alloc != nullptr) {
+ auto it = allocToContentState_.find(alloc);
+ if(it != allocToContentState_.end()) {
+ auto state = it->second;
+ // If the content(state) assigned to the "alloc" has the
+ // allocatable function (such as cyclic), the contentState assigned to it
+ // is the contentState assigned to the "alloc".
+ // Search this until it is not allocatable content.
+ while ((state != nullptr)
+ && (dynamic_cast<RBAAllocatable*>(state->getOwner()) != nullptr)) {
+ it = allocToContentState_.find(dynamic_cast<RBAAllocatable*>(state->getOwner()));
+ state = it->second;
+ }
+ return state;
+ }
+ }
+ return nullptr;
+}
+
+const RBAContentState*
+RBAResultSet::getDirectContentState(const RBAAllocatable* const alloc) const
+{
+ if(alloc != nullptr) {
+ auto it = allocToContentState_.find(alloc);
+ if(it != allocToContentState_.end()) {
+ return it->second;
+ }
+ }
+ return nullptr;
+}
+
+// Impl [get Areas/Zones by ConentState]
+
+void
+RBAResultSet::getAlloc(const RBAContentState* const state,
+ std::list<const RBAAllocatable*>& allocList) const
+{
+ if(state != nullptr) {
+ for(const auto& it : allocToContentState_) {
+ if(it.second == state) {
+ allocList.push_back(it.first);
+ }
+ }
+ }
+}
+
+void
+RBAResultSet::getArea(const RBAViewContentState* const state,
+ std::list<const RBAArea*>& areaList) const
+{
+ if(state != nullptr) {
+ for(const auto& it : allocToContentState_) {
+ if(dynamic_cast<const RBAViewContentState*>(it.second) == state) {
+ const RBAContent* const content {dynamic_cast<const RBAContent*>(it.first)};
+ if (content != nullptr) { // In case of CyclicContent
+ // Get ViewContentState assigned to CyclicContent
+ const RBAViewContentState* const ownerState
+ {dynamic_cast<const RBAViewContentState*>(getReqestState(content))};
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // calling getArea() recursively
+ //  [Reason that there is no problem if the rule is deviated]
+ // When getArea() is performed on CyclicContent, at that time,
+ // respond Area where ViewContent assigned to CyclicContent
+ // is assigned. When CyclicContent is assigned to CyclicContent,
+ // multiple recursive calls may be made, but the rule model
+ // definition is finite.
+ // Therefore, stack overflow will not be occured, no problem.
+ getArea(ownerState, areaList);
+ } else {
+ areaList.push_back(dynamic_cast<const RBAArea*>(it.first));
+ }
+ }
+ }
+ }
+}
+
+void
+RBAResultSet::getZone(const RBASoundContentState* const state,
+ std::list<const RBAZone*>& zoneList) const
+{
+ if(state != nullptr) {
+ for(const auto& it : allocToContentState_) {
+ if (dynamic_cast<const RBASoundContentState*>(it.second) == state) {
+ const RBAContent* const content {dynamic_cast<const RBAContent*>(it.first)};
+ if (content != nullptr) {
+ const RBASoundContentState* const ownerState
+ {dynamic_cast<const RBASoundContentState*>(getReqestState(content))};
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Function '::rba::RBAResultSet::getZone=(_,
+ // p={c::rba::RBASoundContentState},
+ // &{c::std::__cxx11::list<p={c::rba::RBAZone},
+ // {c::std::allocator<p={c::rba::RBAZone}>}>})'
+ // is recursive.
+ //  [Reason that there is no problem if the rule is deviated]
+ // Recursive call is required as a feature
+ getZone(ownerState, zoneList);
+ } else {
+ zoneList.push_back(dynamic_cast<const RBAZone*>(it.first));
+ }
+ }
+ }
+ }
+}
+
+// Impl [get Areas/Zones by Content]
+
+void
+RBAResultSet::getArea(const RBAViewContent* const content,
+ std::list<const RBAArea*>& areaList) const
+{
+ if(content != nullptr) {
+ for(auto& state : content->getContentStates()) {
+ getArea(state, areaList);
+ if(!areaList.empty()) {
+ break;
+ }
+ }
+ }
+}
+
+void
+RBAResultSet::getZone(const RBASoundContent* const content,
+ std::list<const RBAZone*>& zoneList) const
+{
+ if(content != nullptr) {
+ for(auto& state : content->getContentStates()) {
+ getZone(state, zoneList);
+ if(!zoneList.empty()) {
+ break;
+ }
+ }
+ }
+}
+
+// Impl [get Size]
+
+const RBASize*
+RBAResultSet::getSize(const RBAArea* const area) const
+{
+ if(area == nullptr) {
+ return nullptr;
+ }
+ const RBAAreaImpl* const areaImpl {dynamic_cast<const RBAAreaImpl*>(area)};
+ auto it = allocToContentState_.find(areaImpl);
+ if(it == allocToContentState_.end() || (it->second == nullptr)) {
+ return nullptr;
+ }
+ const RBAContent* const content {dynamic_cast<RBAContent*>(it->second->getOwner())};
+ const RBASize* backupAreaSize {nullptr};
+ std::int32_t backupDiffVal {-1};
+ for(auto& areaSize : areaImpl->getSizes()) {
+ const RBASizeImpl* const areaSizeImpl {dynamic_cast<const RBASizeImpl*>(areaSize)};
+ for(auto& contentSize : content->getSizes()) {
+ const RBASizeImpl* const contentSizeImpl {dynamic_cast<const RBASizeImpl*>(contentSize)};
+ const auto diffVal = areaSizeImpl->diff(contentSizeImpl);
+ if(diffVal == 0) {
+ return areaSizeImpl;
+ }
+ else if((backupDiffVal < 0) || (backupDiffVal > diffVal)) {
+ backupAreaSize = areaSizeImpl;
+ backupDiffVal = diffVal;
+ } else {
+ ;
+ }
+ }
+ }
+
+ return backupAreaSize;
+}
+
+// Impl [check Active Scene]
+
+bool
+RBAResultSet::isActive(const RBAScene* const scene) const
+{
+ return (std::find(activeScenes_.begin(), activeScenes_.end(), scene)
+ != activeScenes_.end());
+}
+
+// Impl [check Active ContentState]
+bool
+RBAResultSet::isActive(const RBAContent* const content) const
+{
+ if (contentToStatus_.find(content) != contentToStatus_.end()) {
+ return contentToStatus_[content].isActive();
+ }
+ return false;
+}
+
+bool
+RBAResultSet::isActive(const RBAContentState* const state) const
+{
+ const RBAContent* const content {dynamic_cast<RBAContent*>(state->getOwner())};
+ return (isActive(content) && (getReqestState(content) == state));
+}
+
+const RBAContentState*
+RBAResultSet::getReqestState(const RBAContent* const content) const
+{
+ if (requestContentStateMap_.find(content) != requestContentStateMap_.end()) {
+ return requestContentStateMap_[content];
+ }
+ return nullptr;
+}
+
+// Impl [check Outputting Allocatable]
+
+bool
+RBAResultSet::isOutputting(const RBAAllocatable* const alloc) const
+{
+ return outputtingAllocs_.find(alloc) != outputtingAllocs_.end();
+}
+
+// Impl [check Outputting ContentState]
+
+bool
+RBAResultSet::isOutputting(const RBAContentState* const state) const
+{
+ std::list<const RBAAllocatable*> allocList;
+ getAlloc(state, allocList);
+ for(auto& alloc : allocList) {
+ if(isOutputting(alloc)) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// Impl [check Hidden/Mute Area/Zone]
+
+bool
+RBAResultSet::isHidden(const RBAAllocatable* const alloc) const
+{
+ return hiddenAllocs_.find(alloc) != hiddenAllocs_.end();
+}
+
+// Impl [check Attenuated Zone]
+
+bool
+RBAResultSet::isAttenuated(const RBAZone* const zone) const
+{
+ return std::find(attenuatedZones_.begin(), attenuatedZones_.end(), zone) != attenuatedZones_.end();
+}
+
+// Impl [check Cancel ContentState]
+
+bool
+RBAResultSet::isCancel(const RBAContentState* const state) const
+{
+ return canceledContentStates_.find(state) != canceledContentStates_.end();
+}
+
+// Impl [check Aleady OutPutting]
+
+bool
+RBAResultSet::isAlreadyOutputting(const RBAContentState* const state) const
+{
+ const auto content = dynamic_cast<const RBAContent*>(state->getOwner());
+ for(auto& alloc : content->getAllocatables()) {
+ if((getContentState(alloc) == state) && !alloc->isHidden()) {
+ return true;
+ }
+ }
+ return false;
+}
+
+// Impl [set Active Scene]
+
+/**
+ * @brief Set display request or display withdrawal request, for Scene
+ * @param scene Scene
+ * @param newActive true: display request, false: display withdrawal request
+ */
+void
+RBAResultSet::setActive(const RBAScene* const scene, const bool newActive)
+{
+ const auto it = std::find(activeScenes_.begin(), activeScenes_.end(), scene);
+ if(it == activeScenes_.end()) {
+ if(newActive) {
+ activeScenes_.push_back(scene);
+ }
+ }
+ else {
+ if(!newActive) {
+ static_cast<void>(activeScenes_.erase(it));
+ }
+ }
+}
+
+// Impl [set Active ContentState]
+
+/**
+ * @brief Set display request or display withdrawal request, for Content state
+ * @details If the content has already been registered,
+ delete the registered content.
+ * @param contentState Content state
+ * @param newActive true: display request, false: display withdrawal request
+ */
+void
+RBAResultSet::setActive(const RBAContentState* const state, const bool newActive)
+{
+ updateRequestStatus(dynamic_cast<RBAContent*>(state->getOwner()), newActive);
+
+ // Check if Content is already active
+ const RBAContentState* temp {nullptr};
+ for(auto& cs : activeContentStates_) {
+ if(cs->getOwner() == state->getOwner()) {
+ temp = cs;
+ break;
+ }
+ }
+ // Delete if Content is active
+ if (temp != nullptr) {
+ setOrder(temp, 0);
+ static_cast<void>(activeContentStates_.erase(temp));
+ if (temp->isViewContentState()) {
+ activeViewContentStates_.remove(dynamic_cast<const RBAViewContentState*>(temp));
+ } else {
+ activeSoundContentStates_.remove(dynamic_cast<const RBASoundContentState*>(temp));
+ }
+ }
+
+ // Rgistre active
+ if(newActive) {
+ requestContentStateMap_[dynamic_cast<const RBAContent*>(state->getOwner())] = state;
+ static_cast<void>(activeContentStates_.insert(state));
+ if (state->isViewContentState()) {
+ setOrder(state, requestOrderView_);
+ requestOrderView_++;
+ activeViewContentStates_.push_back(dynamic_cast<const RBAViewContentState*>(state));
+ } else {
+ setOrder(state, requestOrderSound_);
+ requestOrderSound_++;
+ activeSoundContentStates_.push_back(dynamic_cast<const RBASoundContentState*>(state));
+ }
+ }
+ else {
+ setOrder(state, 0);
+ static_cast<void>(requestContentStateMap_.erase(dynamic_cast<const RBAContent*>(state->getOwner())));
+ }
+}
+
+// [cancel ContentState]
+
+void
+RBAResultSet::cancelContentState(const RBAContentState* const state)
+{
+ setOrder(state, 0);
+ if (state->isViewContentState()) {
+ canceledViewContents_.push_back(dynamic_cast<const RBAViewContent*>(state->getOwner()));
+ } else {
+ canceledSoundContents_.push_back(dynamic_cast<const RBASoundContent*>(state->getOwner()));
+ }
+}
+
+// Impl [set Cancel ContentState]
+
+void
+RBAResultSet::setCancel(const RBAContentState* const state, const bool checked)
+{
+ if(checked) {
+ static_cast<void>(canceledContentStates_.insert(state));
+ }
+ else {
+ static_cast<void>(canceledContentStates_.erase(state));
+ }
+}
+
+// Impl [set ContentState]
+
+void
+RBAResultSet::setContentState(const RBAAllocatable* const alloc, const RBAContentState* const state)
+{
+ //alloc
+ allocToContentState_[alloc] = state;
+ const bool isHiddenRes {alloc->isHidden()};
+ const bool existsState {(state != nullptr)};
+ const RBAAreaImpl* area {dynamic_cast<const RBAAreaImpl*>(alloc)};
+ const RBAZoneImpl* zone {dynamic_cast<const RBAZoneImpl*>(alloc)};
+
+ if (isHiddenRes) {
+ static_cast<void>(hiddenAllocs_.insert(alloc));
+ } else {
+ // Currently, there is no case to delete the Allocable stored in
+ // hiddenAllocs_. In the future, since hiding may be forcibly released,
+ // implement it.
+ static_cast<void>(hiddenAllocs_.erase(alloc));
+ }
+
+ if (!isHiddenRes && existsState) {
+ if (alloc->isArea() || alloc->isZone()) {
+ static_cast<void>(outputtingAllocs_.insert(alloc));
+ }
+ if (isOutputting(alloc)) {
+ const RBAContentState* s {state};
+ while ((s != nullptr) && (dynamic_cast<RBAAllocatable*>(s->getOwner()) != nullptr)) {
+ RBAAllocatable* extAlloc {dynamic_cast<RBAAllocatable*>(s->getOwner())};
+ static_cast<void>(outputtingAllocs_.insert(extAlloc));
+ s = extAlloc->getState();
+ }
+ }
+
+ if (alloc->isArea()) {
+ if (std::find(visibleAreas_.begin(), visibleAreas_.end(), area) == visibleAreas_.end()) {
+ visibleAreas_.push_back(area);
+ }
+ invisibleAreas_.remove(area);
+ } else if (alloc->isZone()) {
+ if (std::find(soundingZones_.begin(), soundingZones_.end(), zone) == soundingZones_.end()) {
+ soundingZones_.push_back(zone);
+ }
+ unsoundingZones_.remove(zone);
+ } else {
+ ;
+ }
+ } else {
+ static_cast<void>(outputtingAllocs_.erase(alloc));
+ if (alloc->isArea()) {
+ // Currently, there is no case to delete the Area stored in visibleAreas_.
+ // In the future, it may happen that content allocation is
+ // forcibly released, so implement thes.
+ visibleAreas_.remove(area);
+ if (std::find(invisibleAreas_.begin(), invisibleAreas_.end(), area) == invisibleAreas_.end()) {
+ invisibleAreas_.push_back(area);
+ }
+ } else if (alloc->isZone()) {
+ // Currently, there is no case to delete the Area stored in soundingZones_.
+ // In the future, it may happen that content allocation is
+ // forcibly released, so implement thes.
+ soundingZones_.remove(zone);
+ if (std::find(unsoundingZones_.begin(), unsoundingZones_.end(), zone) == unsoundingZones_.end()) {
+ unsoundingZones_.push_back(zone);
+ }
+ } else {
+ ;
+ }
+ }
+
+ if (isHiddenRes && existsState) {
+ if (alloc->isArea()) {
+ if (std::find(hiddenAreas_.begin(), hiddenAreas_.end(), area) == hiddenAreas_.end()) {
+ hiddenAreas_.push_back(area);
+ }
+ } else if (alloc->isZone()) {
+ if (std::find(muteZones_.begin(), muteZones_.end(), zone) == muteZones_.end()) {
+ muteZones_.push_back(zone);
+ }
+ } else {
+ ;
+ }
+ } else {
+ if (alloc->isArea()) {
+ hiddenAreas_.remove(area);
+ } else if (alloc->isZone()) {
+ muteZones_.remove(zone);
+ } else {
+ ;
+ }
+ }
+
+ if (alloc->isZone()) {
+ if (existsState && !isHiddenRes && zone->isAttenuated()) {
+ if (std::find(attenuatedZones_.begin(), attenuatedZones_.end(), zone) == attenuatedZones_.end()) {
+ attenuatedZones_.push_back(zone);
+ }
+ } else {
+ // Currently, there is no case to delete the Allocatable stored in
+ // attenuatedZones_. In the future, there may be cases in which
+ // "attenuation" is forcibly canceled, so implement this.
+ attenuatedZones_.remove(zone);
+ }
+ }
+}
+
+// Impl [add Visible/Sounding ContentState]
+
+void
+RBAResultSet::addOutputtingContentState(const RBAContentState* const state)
+{
+ if (state->isViewContentState()) {
+ visibleContentStates_.push_back(dynamic_cast<const RBAViewContentState*>(state));
+ }
+ else if (state->isSoundContentState()) {
+ soundingContentStates_.push_back(dynamic_cast<const RBASoundContentState*>(state));
+ }
+ else {
+ ;
+ }
+}
+
+// Impl [add Standby Content]
+
+void
+RBAResultSet::addStandbyContent(const RBAContent* const content)
+{
+ if (content->isViewContent()) {
+ standbyViewContents_.push_back(dynamic_cast<const RBAViewContent*>(content));
+ }
+ else if (content->isSoundContent()) {
+ standbySoundContents_.push_back(dynamic_cast<const RBASoundContent*>(content));
+ }
+ else {
+ ;
+ }
+}
+
+// [activeView]
+
+void
+RBAResultSet::copyActives(const std::unique_ptr<RBAResultSet>& resultSet)
+{
+ activeContentStates_ = resultSet->activeContentStates_;
+ activeViewContentStates_ = resultSet->activeViewContentStates_;
+ activeSoundContentStates_ = resultSet->activeSoundContentStates_;
+ activeScenes_ = resultSet->activeScenes_;
+ contentToStatus_ = resultSet->contentToStatus_;
+ requestContentStateMap_ = resultSet->requestContentStateMap_;
+
+ // Reset order
+ requestOrderView_ = 1;
+ requestOrderSound_ = 1;
+ for(const RBAViewContentState* const viewState : activeViewContentStates_) {
+ setOrder(dynamic_cast<const RBAContentState*>(viewState), requestOrderView_);
+ requestOrderView_++;
+ }
+ for(const RBASoundContentState* const soundState : activeSoundContentStates_) {
+ setOrder(dynamic_cast<const RBAContentState*>(soundState), requestOrderSound_);
+ requestOrderSound_++;
+ }
+}
+
+void
+RBAResultSet::updateActiveContentStates()
+{
+ for (auto& state : canceledContentStates_) {
+ static_cast<void>(activeContentStates_.erase(state));
+ if (state->isViewContentState()) {
+ activeViewContentStates_.remove(dynamic_cast<const RBAViewContentState*>(state));
+ } else {
+ activeSoundContentStates_.remove(dynamic_cast<const RBASoundContentState*>(state));
+ }
+ }
+}
+
+void
+RBAResultSet::copyProperties(const std::unique_ptr<RBAResultSet>& resultSet)
+{
+ propertyMap_ = resultSet->propertyMap_;
+}
+
+void
+RBAResultSet::setSceneProperty(const RBAScene* const scene,
+ const std::string& propertyName,
+ const std::int32_t value)
+{
+ propertyMap_[dynamic_cast<const RBASceneImpl*>(scene)->getProperty(propertyName)] = value;
+}
+
+void
+RBAResultSet::setSceneProperty(const RBAAbstractProperty* const property,
+ const std::int32_t value)
+{
+ propertyMap_[property] = value;
+}
+
+std::int32_t
+RBAResultSet::getSceneProperty(const RBAAbstractProperty* const property) const
+{
+ auto it = propertyMap_.find(property);
+ if(it == propertyMap_.end()) {
+ // Property not registered
+ return -99;
+ }
+
+ return it->second;
+}
+
+void
+RBAResultSet::setContentOfEventProcessing(const RBAEventProcessing* const eventProcessing,
+ const RBAContent* const content)
+{
+ event_content_[eventProcessing] = content;
+}
+
+const RBAContent*
+RBAResultSet::getContentOfEventProcessing(const RBAEventProcessing* const eventProcessing) const
+{
+ if (event_content_.find(eventProcessing) != event_content_.end()) {
+ return event_content_.at(eventProcessing);
+ }
+ return nullptr;
+}
+
+bool
+RBAResultSet::hasDisplayingArea(const RBADisplay* const display) const
+{
+ bool displayed {false};
+ const std::list<const RBAArea*> areas {display->getAreas()};
+ const auto areasBegin = areas.begin();
+ const auto areasEnd = areas.end();
+ for(const RBAArea* const area : visibleAreas_) {
+ if (std::find(areasBegin, areasEnd, area) != areasEnd) {
+ displayed = true;
+ break;
+ }
+ }
+ return displayed;
+}
+
+bool
+RBAResultSet::isLater(const RBAContent* const target,
+ const RBAContent* const comparisonTarget) const
+{
+ bool isLaterRes {false};
+ bool isBreak {false};
+
+ if (target->isViewContent()) {
+ const RBAViewContent* const targetContent {
+ dynamic_cast<const RBAViewContent*>(target)};
+ const RBAViewContent* const comparisonTargetContent {
+ dynamic_cast<const RBAViewContent*>(comparisonTarget)};
+ for (auto it = activeViewContentStates_.rbegin();
+ (it != activeViewContentStates_.rend()) && (!isBreak) ; it++) {
+ if ((*it)->getOwner() == targetContent) {
+ isLaterRes = true;
+ isBreak = true;
+ } else if ((*it)->getOwner() == comparisonTargetContent) {
+ isBreak = true;
+ } else {
+ ;
+ }
+ }
+ } else {
+ const RBASoundContent* const targetContent {
+ dynamic_cast<const RBASoundContent*>(target)};
+ const RBASoundContent* const comparisonTargetContent {
+ dynamic_cast<const RBASoundContent*>(comparisonTarget)};
+ for (auto it = activeSoundContentStates_.rbegin();
+ (it != activeSoundContentStates_.rend()) && (!isBreak); it++) {
+ if ((*it)->getOwner() == targetContent) {
+ isLaterRes = true;
+ isBreak = true;
+ } else if ((*it)->getOwner() == comparisonTargetContent) {
+ isBreak = true;
+ } else {
+ ;
+ }
+ }
+ }
+ return isLaterRes;
+}
+
+std::set<const RBASceneImpl*>&
+RBAResultSet::getDifferentConditionScenes(const RBAResultSet& target)
+{
+ // Detect the difference from the target scene On state
+ const std::list<const RBAScene*> targetScenes {target.getActiveScenes()};
+ for (auto& s : activeScenes_) {
+ if (std::find(targetScenes.begin(), targetScenes.end(), s)
+ == targetScenes.end()) {
+ static_cast<void>(differentConditionScenes_.insert(dynamic_cast<const RBASceneImpl*>(s)));
+ }
+ }
+ for (auto& s : targetScenes) {
+ if (std::find(activeScenes_.begin(), activeScenes_.end(), s)
+ == activeScenes_.end()) {
+ static_cast<void>(differentConditionScenes_.insert(dynamic_cast<const RBASceneImpl*>(s)));
+ }
+ }
+
+ // Detect the difference from the target scene property state
+ for (auto& p : propertyMap_) {
+ if (target.getSceneProperty(p.first) != p.second) {
+ static_cast<void>(differentConditionScenes_.insert(p.first->getScene()));
+ }
+ }
+ for (auto& p : target.getScenePropertyMap()) {
+ if (getSceneProperty(p.first) != p.second) {
+ static_cast<void>(differentConditionScenes_.insert(p.first->getScene()));
+ }
+ }
+ return differentConditionScenes_;
+}
+
+void
+RBAResultSet::updateRequestStatus(const RBAContent* const content, const bool isOnRequest)
+{
+ if (isOnRequest) {
+ contentToStatus_[content].onRequest();
+ } else {
+ // When a content "off request" comes in, turn off the content request
+ // even if the requested state is different from Active state at that time.
+ static_cast<void>(contentToStatus_.erase(content));
+ }
+}
+
+void
+RBAResultSet::setStatusType(const RBAContent* const content, const RBAContentStatusType type)
+{
+ contentToStatus_[content].setStatusType(type);
+}
+
+RBAContentStatusType
+RBAResultSet::getStatusType(const RBAContent* const content) const
+{
+ if (contentToStatus_.find(content) != contentToStatus_.end()) {
+ return contentToStatus_[content].getStatusType();
+ }else {
+ return RBAContentStatusType::NoRequest;
+ }
+}
+
+bool
+RBAResultSet::isOutput(const RBAContent* const content) const
+{
+ if (contentToStatus_.find(content) != contentToStatus_.end()) {
+ return contentToStatus_[content].isDisplayed();
+ } else {
+ return false;
+ }
+}
+
+bool
+RBAResultSet::isStandby(const RBAContent* const content) const
+{
+ if (contentToStatus_.find(content)
+ != contentToStatus_.end()) {
+ return contentToStatus_[content].isStandby();
+ } else {
+ return false;
+ }
+}
+
+bool
+RBAResultSet::hasBeenCanceled(const RBAContent* const content) const
+{
+ if (contentToStatus_.find(content) != contentToStatus_.end()) {
+ return contentToStatus_[content].hasBeenCanceled();
+ } else {
+ return false;
+ }
+}
+
+bool
+RBAResultSet::hasBeenDisplayed(const RBAContent* const content) const
+{
+ if (contentToStatus_.find(content) != contentToStatus_.end()) {
+ return contentToStatus_[content].hasBeenDisplayed();
+ } else {
+ return false;
+ }
+}
+
+std::unordered_map<const RBAContent*, RBAContentStatus>*
+RBAResultSet::getStatus() const
+{
+ return &contentToStatus_;
+}
+
+#ifdef RBA_USE_LOG
+void
+RBAResultSet::addFailedConstraint(const RBAConstraint* constraint)
+{
+ failedConstraints_.push_back(constraint);
+}
+
+const std::list<const RBAConstraint*>&
+RBAResultSet::getFailedConstraints()
+{
+ return failedConstraints_;
+}
+#endif
+
+const std::unordered_map<const RBAAbstractProperty*, std::int32_t>&
+RBAResultSet::getScenePropertyMap() const
+{
+ return propertyMap_;
+}
+
+void
+RBAResultSet::setOrder(const RBAContentState* const state, const std::int32_t newOrder) const
+{
+ const_cast<RBAContentState*>(state)->setOrder(newOrder);
+}
+
+}
diff --git a/src/core/logic/RBAResultSet.hpp b/src/core/logic/RBAResultSet.hpp
new file mode 100644
index 0000000..3aca4e9
--- /dev/null
+++ b/src/core/logic/RBAResultSet.hpp
@@ -0,0 +1,246 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ResultSet (set arbitration result) class header
+ */
+
+#ifndef RBARESULTSET_HPP
+#define RBARESULTSET_HPP
+
+#include <cstdint>
+#include <list>
+#include <memory>
+#include <set>
+#include <unordered_map>
+#include <mutex>
+
+#include "RBAContentStatusType.hpp"
+#include "RBAContentStatus.hpp"
+
+namespace rba
+{
+
+class RBADisplay;
+class RBASize;
+class RBAAllocatable;
+class RBAArea;
+class RBAZone;
+class RBAContent;
+class RBAViewContent;
+class RBASoundContent;
+class RBAContentState;
+class RBAViewContentState;
+class RBASoundContentState;
+class RBAScene;
+class RBASceneImpl;
+class RBAAbstractProperty;
+class RBAEventProcessing;
+class RBAConstraint;
+
+class RBAResultSet
+{
+public:
+ RBAResultSet()=default;
+ RBAResultSet(const RBAResultSet& resultSet);
+ RBAResultSet(const RBAResultSet&&)=delete;
+ RBAResultSet& operator=(const RBAResultSet&)=delete;
+ RBAResultSet& operator=(const RBAResultSet&&)=delete;
+ virtual ~RBAResultSet()=default;
+
+public:
+ // Impl [get VisibleArea/SoundingZone]
+ const std::set<const RBAAllocatable*>& getOutputtingAllocatables() const;
+ const std::list<const RBAArea*>& getVisibleAreas() const;
+ const std::list<const RBAZone*>& getSoundingZones() const;
+
+ // Impl [get Visible/Sounding ContentStates]
+ const std::list<const RBAViewContentState*>& getVisibleContentStates() const;
+ const std::list<const RBASoundContentState*>& getSoundingContentStates() const;
+
+ // Impl [get Active View/Sound ContentStates]
+ const std::set<const RBAContentState*>& getActiveContentStates() const;
+ const std::list<const RBAViewContentState*>& getActiveViewContentStates() const;
+ const std::list<const RBASoundContentState*>& getActiveSoundContentStates() const;
+
+ // Impl [get Active Scenes]
+ const std::list<const RBAScene*>& getActiveScenes() const;
+
+ // Impl [get InvisibleAreas/UnsoundingZone]
+ const std::list<const RBAArea*>& getInvisibleAreas() const;
+ const std::list<const RBAZone*>& getUnsoundingZones() const;
+
+ // Impl [get HiddenAreas/MuteZones]
+ const std::list<const RBAArea*>& getHiddenAreas() const;
+ const std::list<const RBAZone*>& getMuteZones() const;
+
+ // Impl [get Attenuated]
+ const std::list<const RBAZone*>& getAttenuatedZones() const;
+
+ // Impl [get Canceled Contents]
+ const std::list<const RBAViewContent*>& getCanceledViewContents() const;
+ const std::list<const RBASoundContent*>& getCanceledSoundContents() const;
+
+ // Impl [get Standby Contents]
+ const std::list<const RBAViewContent*>& getStandbyViewContents() const;
+ const std::list<const RBASoundContent*>& getStandbySoundContents() const;
+
+ // Impl [get ContentStates]
+ const RBAContentState* getContentState(const RBAAllocatable* const alloc) const;
+ const RBAContentState* getDirectContentState(const RBAAllocatable* const alloc) const;
+
+ // Impl [get Areas/Zones by ConentState]
+ void getAlloc(const RBAContentState* const state,
+ std::list<const RBAAllocatable*>& allocList) const;
+ void getArea(const RBAViewContentState* const state,
+ std::list<const RBAArea*>& areaList) const;
+ void getZone(const RBASoundContentState* const state,
+ std::list<const RBAZone*>& zoneList) const;
+
+ // Impl [get Areas/Zones by Content]
+ void getArea(const RBAViewContent* const content,
+ std::list<const RBAArea*>& areaList) const;
+ void getZone(const RBASoundContent* const content,
+ std::list<const RBAZone*>& zoneList) const;
+
+ // Impl [get Size]
+ const RBASize* getSize(const RBAArea* const area) const;
+
+ // Impl [check Active Scene/Content/ContentState]
+ bool isActive(const RBAScene* const scene) const;
+ bool isActive(const RBAContent* const content) const;
+ bool isActive(const RBAContentState* const state) const;
+ const RBAContentState* getReqestState(const RBAContent* const content) const;
+
+ // Impl [check Outputting Allocatable/ContentState]
+ bool isOutputting(const RBAAllocatable* const alloc) const;
+ bool isOutputting(const RBAContentState* const state) const;
+
+ // Impl [check Hidden]
+ bool isHidden(const RBAAllocatable* const alloc) const;
+
+ // Impl [check Attenuated Zone]
+ bool isAttenuated(const RBAZone* const zone) const;
+
+ // Impl [check Cancel ContentState]
+ bool isCancel(const RBAContentState* const state) const;
+
+ // Impl [check Aleady OutPutting]
+ bool isAlreadyOutputting(const RBAContentState* const state) const;
+
+ // Impl [set Active Scene/ContentState]
+ void setActive(const RBAScene* const scene, const bool newActive);
+ void setActive(const RBAContentState* const state, const bool newActive);
+
+ // [cancel ContentState]
+ void cancelContentState(const RBAContentState* const state);
+
+ // Impl [set Cancel ContentState]
+ void setCancel(const RBAContentState* const state, const bool checked);
+
+ // Impl [set ContentState]
+ void setContentState(const RBAAllocatable* const alloc, const RBAContentState* const state);
+
+ // Impl [add Outputting ContentState]
+ void addOutputtingContentState(const RBAContentState* const state);
+
+ // Impl [add Standby Content]
+ void addStandbyContent(const RBAContent* const content);
+
+ // [activeView]
+ void copyActives(const std::unique_ptr<RBAResultSet>& resultSet);
+ void updateActiveContentStates();
+
+ // [Property]
+ void copyProperties(const std::unique_ptr<RBAResultSet>& resultSet);
+ void setSceneProperty(const RBAScene* const scene,
+ const std::string& propertyName,
+ const std::int32_t value);
+ void setSceneProperty(const RBAAbstractProperty* const property,
+ const std::int32_t value);
+ std::int32_t getSceneProperty(const RBAAbstractProperty* const property) const;
+
+ // [EventProcessing]
+ void setContentOfEventProcessing(const RBAEventProcessing* const eventProcessing,
+ const RBAContent* const content);
+ const RBAContent* getContentOfEventProcessing(const RBAEventProcessing* const eventProcessing) const;
+
+ // [DisplayContents]
+ bool hasDisplayingArea(const RBADisplay* const display) const;
+
+ // common
+ bool isLater(const RBAContent* const target, const RBAContent* const comparisonTarget) const;
+ std::set<const RBASceneImpl*>& getDifferentConditionScenes(const RBAResultSet& target);
+ void updateRequestStatus(const RBAContent* const content, const bool isOnRequest);
+ void setStatusType(const RBAContent* const content, const RBAContentStatusType type);
+ RBAContentStatusType getStatusType(const RBAContent* const content) const;
+ bool isOutput(const RBAContent* const content) const;
+ bool isStandby(const RBAContent* const content) const;
+ bool hasBeenCanceled(const RBAContent* const content) const;
+ bool hasBeenDisplayed(const RBAContent* const content) const;
+ std::unordered_map<const RBAContent*, RBAContentStatus>* getStatus() const;
+#ifdef RBA_USE_LOG
+ void addFailedConstraint(const RBAConstraint* constraint);
+ const std::list<const RBAConstraint*>& getFailedConstraints();
+#endif
+
+private:
+ const std::unordered_map<const RBAAbstractProperty*, std::int32_t>& getScenePropertyMap() const;
+ void setOrder(const RBAContentState* const state, const std::int32_t newOrder) const;
+
+ std::set<const RBAAllocatable*> outputtingAllocs_;
+ std::set<const RBAAllocatable*> hiddenAllocs_;
+ std::set<const RBAContentState*> activeContentStates_;
+ std::set<const RBAContentState*> canceledContentStates_;
+ std::unordered_map<const RBAAllocatable*, const RBAContentState*> allocToContentState_;
+
+ // The lists for getList type acquisition function
+ std::list<const RBAArea*> visibleAreas_;
+ std::list<const RBAZone*> soundingZones_;
+ std::list<const RBAArea*> invisibleAreas_;
+ std::list<const RBAZone*> unsoundingZones_;
+ std::list<const RBAArea*> hiddenAreas_;
+ std::list<const RBAZone*> muteZones_;
+ std::list<const RBAZone*> attenuatedZones_;
+ std::list<const RBAViewContent*> canceledViewContents_;
+ std::list<const RBASoundContent*> canceledSoundContents_;
+ std::list<const RBAViewContent*> standbyViewContents_;
+ std::list<const RBASoundContent*> standbySoundContents_;
+ std::list<const RBAViewContentState*> visibleContentStates_;
+ std::list<const RBASoundContentState*> soundingContentStates_;
+ std::list<const RBAViewContentState*> activeViewContentStates_;
+ std::list<const RBASoundContentState*> activeSoundContentStates_;
+
+ // common
+ std::int32_t requestOrderView_ {1};
+ std::int32_t requestOrderSound_ {1};
+ std::list<const RBAScene*> activeScenes_;
+ std::unordered_map<const RBAAbstractProperty*, std::int32_t> propertyMap_;
+ std::unordered_map<const RBAEventProcessing*, const RBAContent*> event_content_;
+ mutable std::unordered_map<const RBAContent*, RBAContentStatus> contentToStatus_;
+ std::set<const RBASceneImpl*> differentConditionScenes_;
+
+ mutable std::unordered_map<const RBAContent*, const RBAContentState*> requestContentStateMap_;
+
+ mutable std::mutex mutex_;
+#ifdef RBA_USE_LOG
+ std::list<const RBAConstraint*> failedConstraints_;
+#endif
+
+};
+
+}
+#endif
diff --git a/src/core/logic/RBARollbacker.cpp b/src/core/logic/RBARollbacker.cpp
new file mode 100644
index 0000000..9870fa9
--- /dev/null
+++ b/src/core/logic/RBARollbacker.cpp
@@ -0,0 +1,95 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Rollbacker (rollback of arbitration results) class implementation
+ */
+
+#include "RBARollbacker.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBABackUpAllocatable.hpp"
+#include "RBAArbitrator.hpp"
+
+namespace rba
+{
+
+RBARollbacker::~RBARollbacker() noexcept
+{
+ children_.clear();
+}
+
+void
+RBARollbacker::addChild(const std::shared_ptr<RBARollbacker> child)
+{
+ children_.push_back(child);
+}
+
+void
+RBARollbacker::removeChild(const std::shared_ptr<RBARollbacker> child)
+{
+ children_.remove(child);
+}
+
+void
+RBARollbacker::backup(std::list<const RBAAllocatable*>& backuplist)
+{
+ backupMap_.clear();
+ for(const RBAAllocatable* const original : backuplist) {
+ std::unique_ptr<RBAAllocatable> backupObj
+ {std::make_unique<RBABackUpAllocatable>("backup_"
+ + original->getElementName())};
+ copyAllocatable(original, backupObj.get());
+ backupMap_[original] = std::move(backupObj);
+ }
+}
+
+void
+RBARollbacker::rollback()
+{
+ for (auto& Child : children_) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // rollback() is called recursively
+ // [Explanation that there is no problem if you deviate from the rules]
+ // RBARollbacker is created each time the re-arbitration nest becomes
+ // deeper, but since the infinite loop prevention process is implemented
+ // in re-arbitration, stack overflow does not occur.
+ Child->rollback();
+ }
+ for(auto itr = backupMap_.begin(); itr != backupMap_.end(); ++itr) {
+ const RBAAllocatable* const original {itr->first};
+ const RBAAllocatable* const backupVal {itr->second.get()};
+ copyAllocatable(backupVal, const_cast<RBAAllocatable*>(original));
+ }
+}
+
+void
+RBARollbacker::copyAllocatable(const RBAAllocatable* const from,
+ RBAAllocatable* const to)
+{
+ to->setHiddenChecked(from->isHiddenChecked());
+ to->setHidden(from->isHidden());
+ to->setChecked(from->isChecked());
+ to->setState(from->getState());
+ to->clearAllocatablesAffectedByYou();
+ for(const RBAAllocatable* const allocatable : from->getAllocatablesAffectedByYou()) {
+ to->addAllocatableWhichHasBeenAffectedByYou(allocatable);
+ }
+ to->setAttenuateChecked(from->isAttenuateChecked());
+ to->setAttenuated(from->isAttenuated());
+}
+
+}
diff --git a/src/core/logic/RBARollbacker.hpp b/src/core/logic/RBARollbacker.hpp
new file mode 100644
index 0000000..08ee4e9
--- /dev/null
+++ b/src/core/logic/RBARollbacker.hpp
@@ -0,0 +1,84 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Rollbacker (rollback of arbitration results) class header
+ */
+
+#ifndef RBARROLLBACKER_HPP
+#define RBARROLLBACKER_HPP
+
+#include <unordered_map>
+#include <memory>
+#include <list>
+
+namespace rba
+{
+class RBAModel;
+class RBAAllocatable;
+class RBAArbitrator;
+
+class RBARollbacker
+{
+ public:
+ RBARollbacker()=default;
+ RBARollbacker(const RBARollbacker&)=delete;
+ RBARollbacker(const RBARollbacker&&)=delete;
+ RBARollbacker& operator=(const RBARollbacker&)=delete;
+ RBARollbacker& operator=(const RBARollbacker&&)=delete;
+ virtual ~RBARollbacker() noexcept;
+
+ /**
+ * Register a backup for child re-arbitration when execute re-arbitration
+ * during re-arbitration.
+ * Restore child backup when rolling back
+ */
+ void addChild(const std::shared_ptr<RBARollbacker> child);
+
+ void removeChild(const std::shared_ptr<RBARollbacker> child);
+
+ /**
+ * Back up arbitration status and impact information.
+ * (Only "Allocatable" that directly arbitration is backed up)
+ * Child will back up re-arbitraion during execution of re-aribitration.
+ *
+ * Backing up all "Allocatable" on a model is inefficient,
+ * so back up only those that execute re-arbitration
+ */
+ void backup(std::list<const RBAAllocatable*>& backuplist);
+
+ /**
+ * Roll back the arbitration state and impact information to
+ * the state when the instance was created
+ */
+ void rollback();
+
+ private:
+ /**
+ * @brief Copy Allocable arbitration state
+ * @param from source of copy
+ * @param to destination of copy
+ */
+ void copyAllocatable(const RBAAllocatable* const from, RBAAllocatable* const to);
+
+ std::list<std::shared_ptr<RBARollbacker>> children_;
+ // Rollback information when arbitration fails
+ std::unordered_map<const RBAAllocatable*, std::unique_ptr<RBAAllocatable>> backupMap_;
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAViewAction.cpp b/src/core/logic/RBAViewAction.cpp
new file mode 100644
index 0000000..54553dc
--- /dev/null
+++ b/src/core/logic/RBAViewAction.cpp
@@ -0,0 +1,88 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ViewAction Class implementation
+ */
+
+#include "RBAArea.hpp"
+#include "RBAViewContent.hpp"
+#include "RBAViewContentState.hpp"
+#include "RBAViewAction.hpp"
+#include "RBAViewMove.hpp"
+#include "RBAViewTransition.hpp"
+
+namespace rba {
+
+const RBAArea*
+RBAViewAction::getArea() const
+{
+ return nullptr;
+}
+
+const RBAViewContent*
+RBAViewAction::getFromContent() const
+{
+ return nullptr;
+}
+
+const RBAViewContent*
+RBAViewAction::getToContent() const
+{
+ return nullptr;
+}
+
+const RBAViewContentState*
+RBAViewAction::getFromContentState() const
+{
+ return nullptr;
+}
+
+const RBAViewContentState*
+RBAViewAction::getToContentState() const
+{
+ return nullptr;
+}
+
+const RBAArea*
+RBAViewAction::getFromArea() const
+{
+ return nullptr;
+}
+
+const RBAArea*
+RBAViewAction::getToArea() const
+{
+ return nullptr;
+}
+
+const RBAViewContent*
+RBAViewAction::getContent() const
+{
+ // This function is never called because the function of the derived class
+ // is always called
+ return nullptr;
+}
+
+const RBAViewContentState*
+RBAViewAction::getContentState() const
+{
+ // This function is never called because the function of the derived class
+ // is always called
+ return nullptr;
+}
+
+}
diff --git a/src/core/logic/RBAViewMove.cpp b/src/core/logic/RBAViewMove.cpp
new file mode 100644
index 0000000..7e40043
--- /dev/null
+++ b/src/core/logic/RBAViewMove.cpp
@@ -0,0 +1,89 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * RBAViewMove.cpp
+ */
+
+#include "RBAArea.hpp"
+#include "RBAViewContent.hpp"
+#include "RBAViewContentState.hpp"
+#include "RBAViewMove.hpp"
+
+namespace rba {
+
+RBAViewMove::RBAViewMove(const RBAArea* const newFromArea, const RBAArea* const newToArea,
+ const RBAViewContentState* const newContentState)
+ : RBAViewAction{}
+{
+ fromArea_ = newFromArea;
+ toArea_ = newToArea;
+ contentState_ = newContentState;
+}
+
+RBAViewMove::RBAViewMove(const RBAViewMove& viewMove)
+ : RBAViewAction{viewMove}
+{
+ fromArea_ = viewMove.fromArea_;
+ toArea_ = viewMove.toArea_;
+ contentState_ = viewMove.contentState_;
+}
+
+bool
+RBAViewMove::operator==(const RBAViewAction& viewAction)
+{
+ if(getViewActionType() != viewAction.getViewActionType()) {
+ // False if the view action types do not match
+ return false;
+ }
+
+ const RBAViewMove* const viewMove {dynamic_cast<const RBAViewMove*>(&viewAction)};
+ return ((fromArea_ == viewMove->fromArea_) &&
+ (toArea_ == viewMove->toArea_) &&
+ (contentState_ == viewMove->contentState_));
+}
+
+const RBAArea*
+RBAViewMove::getFromArea() const
+{
+ return fromArea_;
+}
+
+const RBAArea*
+RBAViewMove::getToArea() const
+{
+ return toArea_;
+}
+
+const RBAViewContent*
+RBAViewMove::getContent() const
+{
+ return contentState_->getOwner();
+}
+
+const RBAViewContentState*
+RBAViewMove::getContentState() const
+{
+ return contentState_;
+}
+
+RBAViewActionType
+RBAViewMove::getViewActionType() const
+{
+ return RBAViewActionType::MOVE;
+}
+
+}
diff --git a/src/core/logic/RBAViewMove.hpp b/src/core/logic/RBAViewMove.hpp
new file mode 100644
index 0000000..2b8db08
--- /dev/null
+++ b/src/core/logic/RBAViewMove.hpp
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAViewMove.hpp
+ */
+
+#ifndef RBAVIEWMOVE_HPP
+#define RBAVIEWMOVE_HPP
+
+#include "RBAViewActionType.hpp"
+#include "RBAViewAction.hpp"
+
+namespace rba {
+
+class RBAArea;
+class RBAViewContent;
+class RBAViewContentState;
+
+class DLL_EXPORT RBAViewMove : public RBAViewAction
+{
+public:
+ RBAViewMove(const RBAArea* const newFromArea, const RBAArea* const newToArea,
+ const RBAViewContentState* const newContentState);
+ RBAViewMove(const RBAViewMove& viewMove);
+ RBAViewMove(const RBAViewMove&&)=delete;
+ RBAViewMove& operator=(const RBAViewMove&)=delete;
+ RBAViewMove& operator=(const RBAViewMove&&)=delete;
+ virtual ~RBAViewMove()=default;
+
+ bool operator==(const RBAViewAction& viewAction) override;
+
+public:
+ const RBAArea* getFromArea() const override;
+ const RBAArea* getToArea() const override;
+ const RBAViewContent* getContent() const override;
+ const RBAViewContentState* getContentState() const override;
+ RBAViewActionType getViewActionType() const override;
+
+private:
+ const RBAArea* fromArea_ {nullptr};
+ const RBAArea* toArea_ {nullptr};
+ const RBAViewContentState* contentState_ {nullptr};
+
+};
+
+}
+
+#endif
diff --git a/src/core/logic/RBAViewTransition.cpp b/src/core/logic/RBAViewTransition.cpp
new file mode 100644
index 0000000..93b86a7
--- /dev/null
+++ b/src/core/logic/RBAViewTransition.cpp
@@ -0,0 +1,137 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * RBAViewTransition.cpp
+ */
+
+#include "RBAArea.hpp"
+#include "RBAViewContent.hpp"
+#include "RBAViewContentState.hpp"
+#include "RBAViewTransition.hpp"
+
+namespace rba {
+
+RBAViewTransition::RBAViewTransition(
+ const RBAViewActionType newViewActionType, const RBAArea* const newArea,
+ const RBAViewContentState* const newContentState1,
+ const RBAViewContentState* const newContentState2)
+ : RBAViewAction(),
+ viewActionType_{newViewActionType},
+ area_{newArea},
+ contentState1_{newContentState1},
+ contentState2_{newContentState2}
+{
+}
+
+RBAViewTransition::RBAViewTransition(const RBAViewTransition& viewTrans)
+ : RBAViewAction{viewTrans}
+{
+ viewActionType_ = viewTrans.viewActionType_;
+ area_ = viewTrans.area_;
+ contentState1_ = viewTrans.contentState1_;
+ contentState2_ = viewTrans.contentState2_;
+}
+
+bool
+RBAViewTransition::operator==(const RBAViewAction& viewAction)
+{
+ if(getViewActionType() != viewAction.getViewActionType()) {
+ // False if the view action types do not match
+ return false;
+ }
+
+ const RBAViewTransition* const viewTran
+ {dynamic_cast<const RBAViewTransition*>(&viewAction)};
+ return ((area_ == viewTran->area_) &&
+ (contentState1_ == viewTran->contentState1_) &&
+ (contentState2_ == viewTran->contentState2_));
+}
+
+const RBAArea*
+RBAViewTransition::getArea() const
+{
+ return area_;
+}
+
+const RBAViewContent*
+RBAViewTransition::getFromContent() const
+{
+ if((contentState1_ == nullptr) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_ADD) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_REMOVE)) {
+ return nullptr;
+ }
+ return contentState1_->getOwner();
+}
+
+const RBAViewContent*
+RBAViewTransition::getToContent() const
+{
+ if((contentState2_ == nullptr) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_ADD) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_REMOVE)) {
+ return nullptr;
+ }
+ return contentState2_->getOwner();
+}
+
+const RBAViewContentState*
+RBAViewTransition::getFromContentState() const
+{
+ if((viewActionType_ == RBAViewActionType::TRANSITION_ADD) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_REMOVE)) {
+ return nullptr;
+ }
+ return contentState1_;
+}
+
+const RBAViewContentState*
+RBAViewTransition::getToContentState() const
+{
+ if((viewActionType_ == RBAViewActionType::TRANSITION_ADD) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_REMOVE)) {
+ return nullptr;
+ }
+ return contentState2_;
+}
+
+const RBAViewContent*
+RBAViewTransition::getContent() const
+{
+ if((contentState1_ == nullptr) ||
+ (viewActionType_ == RBAViewActionType::TRANSITION_REPLACE)) {
+ return nullptr;
+ }
+ return contentState1_->getOwner();
+}
+
+const RBAViewContentState*
+RBAViewTransition::getContentState() const
+{
+ if(viewActionType_ == RBAViewActionType::TRANSITION_REPLACE) {
+ return nullptr;
+ }
+ return contentState1_;
+}
+
+RBAViewActionType
+RBAViewTransition::getViewActionType() const
+{
+ return viewActionType_;
+}
+
+}
diff --git a/src/core/logic/RBAViewTransition.hpp b/src/core/logic/RBAViewTransition.hpp
new file mode 100644
index 0000000..1b9338f
--- /dev/null
+++ b/src/core/logic/RBAViewTransition.hpp
@@ -0,0 +1,64 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * RBAViewTransition.hpp
+ */
+
+#ifndef RBAVIEWTRANSITION_HPP
+#define RBAVIEWTRANSITION_HPP
+
+#include "RBAViewAction.hpp"
+
+namespace rba {
+
+class RBAArea;
+
+class DLL_EXPORT RBAViewTransition : public RBAViewAction
+{
+public:
+ RBAViewTransition(const RBAViewActionType newViewActionType, const RBAArea* const newArea,
+ const RBAViewContentState* const newContentState1,
+ const RBAViewContentState* const newContentState2 = nullptr);
+ RBAViewTransition(const RBAViewTransition& viewTrans);
+ RBAViewTransition(const RBAViewTransition&&)=delete;
+ RBAViewTransition& operator=(const RBAViewTransition&)=delete;
+ RBAViewTransition& operator=(const RBAViewTransition&&)=delete;
+ virtual ~RBAViewTransition()=default;
+
+ bool operator==(const RBAViewAction& viewAction) override;
+
+public:
+ const RBAArea* getArea() const override;
+
+ const RBAViewContent* getFromContent() const override;
+ const RBAViewContent* getToContent() const override;
+ const RBAViewContentState* getFromContentState() const override;
+ const RBAViewContentState* getToContentState() const override;
+ const RBAViewContent* getContent() const override;
+ const RBAViewContentState* getContentState() const override;
+ RBAViewActionType getViewActionType() const override;
+
+private:
+ RBAViewActionType viewActionType_;
+ const RBAArea* area_;
+ const RBAViewContentState* contentState1_;
+ const RBAViewContentState* contentState2_;
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractAllocatable.cpp b/src/core/model/RBAAbstractAllocatable.cpp
new file mode 100644
index 0000000..c0dfb4f
--- /dev/null
+++ b/src/core/model/RBAAbstractAllocatable.cpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AbstractAllocatable class implementation
+ */
+
+#include "RBAAbstractAllocatable.hpp"
+
+#include "RBAModelElementType.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAViewContentSet.hpp"
+#include "RBASoundContentSet.hpp"
+
+namespace rba
+{
+
+RBAAbstractAllocatable::RBAAbstractAllocatable(const std::string& name)
+ : RBARuleObject{name},
+ contentSet_{std::make_unique<RBAContentSet>()}
+{
+}
+
+const std::list<const RBAContent*>&
+RBAAbstractAllocatable::getInternalContents() const
+{
+ return contentSet_->getLeafContent();
+}
+
+void
+RBAAbstractAllocatable::addContent(const RBAContent* const content)
+{
+ contentSet_->addTarget(content);
+}
+
+const RBAContentSet*
+RBAAbstractAllocatable::getContentSet() const
+{
+ return contentSet_.get();
+}
+
+}
diff --git a/src/core/model/RBAAbstractAllocatable.hpp b/src/core/model/RBAAbstractAllocatable.hpp
new file mode 100644
index 0000000..b8b7acb
--- /dev/null
+++ b/src/core/model/RBAAbstractAllocatable.hpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AbstractAllocatable class header
+ */
+
+#ifndef RBAABSTRACTALLOCATABLE_HPP
+#define RBAABSTRACTALLOCATABLE_HPP
+
+#include <memory>
+#include <list>
+#include "RBARuleObject.hpp"
+#include "RBAContentSet.hpp"
+
+namespace rba
+{
+
+class RBAContent;
+
+class DLL_EXPORT RBAAbstractAllocatable : virtual public RBARuleObject
+{
+protected:
+ explicit RBAAbstractAllocatable(const std::string& name="");
+ RBAAbstractAllocatable(const RBAAbstractAllocatable&)=delete;
+ RBAAbstractAllocatable(const RBAAbstractAllocatable&&)=delete;
+ RBAAbstractAllocatable& operator=(const RBAAbstractAllocatable&)=delete;
+ RBAAbstractAllocatable& operator=(const RBAAbstractAllocatable&&)=delete;
+
+public:
+ virtual ~RBAAbstractAllocatable()=default;
+
+public:
+ const std::list<const RBAContent*>& getInternalContents() const;
+ void addContent(const RBAContent* const content);
+ const RBAContentSet* getContentSet() const;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::unique_ptr<RBAContentSet> contentSet_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractAllocatableMaker.cpp b/src/core/model/RBAAbstractAllocatableMaker.cpp
new file mode 100644
index 0000000..793336a
--- /dev/null
+++ b/src/core/model/RBAAbstractAllocatableMaker.cpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAbstractAllocatableMaker.cpp
+/// @brief AbstractAllocatable generator class implementation
+
+#include "RBAAbstractAllocatableMaker.hpp"
+#include "RBAAbstractAllocatable.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAAbstractAllocatableMaker::RBAAbstractAllocatableMaker(const std::string& label)
+ : RBARuleObjectMaker{label}
+{
+}
+
+RBAModelElement*
+RBAAbstractAllocatableMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBARuleObjectMaker::setProperty(element, jsonElem, model, owner));
+
+ const auto abstAllo = dynamic_cast<RBAAbstractAllocatable*>(element);
+
+ // Currently, there is no member set by RBAAbstractAllocatableMaker
+ // as model information, but this process is implemented
+ // because it may be added in the future.
+
+ return abstAllo;
+}
+
+}
diff --git a/src/core/model/RBAAbstractAllocatableMaker.hpp b/src/core/model/RBAAbstractAllocatableMaker.hpp
new file mode 100644
index 0000000..845acd2
--- /dev/null
+++ b/src/core/model/RBAAbstractAllocatableMaker.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAbstractAllocatableMaker.hpp
+/// @brief AbstractAllocatable generator class header
+
+#ifndef RBAABSTRACTALLOCATABLEMAKER_HPP
+#define RBAABSTRACTALLOCATABLEMAKER_HPP
+
+#include "RBARuleObjectMaker.hpp"
+
+namespace rba
+{
+
+/// @brief AbstractAllocatable generator class
+class DLL_EXPORT RBAAbstractAllocatableMaker : virtual public RBARuleObjectMaker
+{
+public:
+ explicit RBAAbstractAllocatableMaker(const std::string& label="");
+ RBAAbstractAllocatableMaker(const RBAAbstractAllocatableMaker&)=delete;
+ RBAAbstractAllocatableMaker(const RBAAbstractAllocatableMaker&&)=delete;
+ RBAAbstractAllocatableMaker& operator=(const RBAAbstractAllocatableMaker&)=delete;
+ RBAAbstractAllocatableMaker& operator=(const RBAAbstractAllocatableMaker&&)=delete;
+ virtual ~RBAAbstractAllocatableMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractConstraint.cpp b/src/core/model/RBAAbstractConstraint.cpp
new file mode 100644
index 0000000..3c8ba73
--- /dev/null
+++ b/src/core/model/RBAAbstractConstraint.cpp
@@ -0,0 +1,81 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AbstractConstraint class implementation
+ */
+
+#include "RBAAbstractConstraint.hpp"
+
+#include "RBAExpression.hpp"
+#include "RBALogManager.hpp"
+
+namespace rba
+{
+
+RBAAbstractConstraint::RBAAbstractConstraint(const std::string& name)
+ : RBANamedElement{name}
+{
+}
+
+bool
+RBAAbstractConstraint::isConstraint() const
+{
+ return false;
+}
+
+bool
+RBAAbstractConstraint::isRule() const
+{
+ return false;
+}
+
+void
+RBAAbstractConstraint::clearInfo()
+{
+ info_->clear();
+}
+
+void
+RBAAbstractConstraint::setExpression(RBAExpression* newExpr)
+{
+ expression_ = newExpr;
+}
+
+RBAExpression* const
+RBAAbstractConstraint::getExpression() const
+{
+ return expression_;
+}
+
+RBAConstraintInfo*
+RBAAbstractConstraint::getInfo() const
+{
+ return info_.get();
+}
+
+#ifdef RBA_USE_LOG
+void
+RBAAbstractConstraint::createHierarchy()
+{
+ LOG_initConstraintHierarchy();
+ LOG_coverageHierarchyOfConstraintStartLog(this);
+ getExpression()->createHierarchy();
+ LOG_coverageHierarchyOfConstraintEndLog(this);
+}
+#endif
+
+}
diff --git a/src/core/model/RBAAbstractConstraint.hpp b/src/core/model/RBAAbstractConstraint.hpp
new file mode 100644
index 0000000..d19bba5
--- /dev/null
+++ b/src/core/model/RBAAbstractConstraint.hpp
@@ -0,0 +1,71 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AbstractConstraint class header
+ */
+
+#ifndef RBAABSTRACTCONSTRAINT_HPP
+#define RBAABSTRACTCONSTRAINT_HPP
+
+#include <memory>
+#include "RBANamedElement.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+class RBAExpression;
+
+class DLL_EXPORT RBAAbstractConstraint : public RBANamedElement
+{
+protected:
+ explicit RBAAbstractConstraint(const std::string& name);
+ RBAAbstractConstraint(const RBAAbstractConstraint&)=delete;
+ RBAAbstractConstraint(const RBAAbstractConstraint&&)=delete;
+ RBAAbstractConstraint& operator=(const RBAAbstractConstraint&)=delete;
+ RBAAbstractConstraint& operator=(const RBAAbstractConstraint&&)=delete;
+ void clearInfo();
+
+public:
+ virtual ~RBAAbstractConstraint()=default;
+ virtual bool isConstraint() const;
+ virtual bool isRule() const;
+ virtual void setExpression(RBAExpression*);
+ virtual RBAExpression* const getExpression() const;
+ RBAConstraintInfo* getInfo() const;
+
+ // Log
+#ifdef RBA_USE_LOG
+ virtual void createHierarchy();
+#endif
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::unique_ptr<RBAConstraintInfo> info_ {std::make_unique<RBAConstraintInfo>()};
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+ RBAExpression* expression_ {nullptr};
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractConstraintMaker.cpp b/src/core/model/RBAAbstractConstraintMaker.cpp
new file mode 100644
index 0000000..5de0ae3
--- /dev/null
+++ b/src/core/model/RBAAbstractConstraintMaker.cpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAbstractConstraintMaker.cpp
+/// @brief Abstract Constraint expresion generator class
+
+#include "RBAAbstractConstraintMaker.hpp"
+#include "RBAAbstractConstraint.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAAbstractConstraintMaker::RBAAbstractConstraintMaker(const std::string& label)
+ : RBAModelElementMaker{label}
+{
+}
+
+RBAModelElement*
+RBAAbstractConstraintMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ const auto abstConstraint = dynamic_cast<RBAAbstractConstraint*>(element);
+
+ // Set expression
+ const RBAJsonElement* const childElem {jsonElem->findChildren("expression")};
+ RBAModelElement* const expr {getFactory()->createElement(childElem->getClassName(),
+ childElem)};
+ abstConstraint->setExpression(dynamic_cast<RBAExpression*>(expr));
+
+ return abstConstraint;
+}
+
+}
diff --git a/src/core/model/RBAAbstractConstraintMaker.hpp b/src/core/model/RBAAbstractConstraintMaker.hpp
new file mode 100644
index 0000000..916408e
--- /dev/null
+++ b/src/core/model/RBAAbstractConstraintMaker.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAbstractConstraintMaker.hpp
+/// @brief Abstract Constraint expresion generator class header
+
+#ifndef RBAABSTRACTCONSTRAINTMAKER_HPP
+#define RBAABSTRACTCONSTRAINTMAKER_HPP
+
+#include "RBAModelElementMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Abstract Constraint expresion generator class
+class DLL_EXPORT RBAAbstractConstraintMaker
+ : public RBAModelElementMaker
+{
+public:
+ explicit RBAAbstractConstraintMaker(const std::string& label);
+ RBAAbstractConstraintMaker(const RBAAbstractConstraintMaker&)=delete;
+ RBAAbstractConstraintMaker(const RBAAbstractConstraintMaker&&)=delete;
+ RBAAbstractConstraintMaker& operator=(const RBAAbstractConstraintMaker&)=delete;
+ RBAAbstractConstraintMaker& operator=(const RBAAbstractConstraintMaker&&)=delete;
+ virtual ~RBAAbstractConstraintMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractContent.cpp b/src/core/model/RBAAbstractContent.cpp
new file mode 100644
index 0000000..d8f025f
--- /dev/null
+++ b/src/core/model/RBAAbstractContent.cpp
@@ -0,0 +1,31 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Abstract Content class implementation
+ */
+
+#include "RBAAbstractContent.hpp"
+
+namespace rba
+{
+
+RBAAbstractContent::RBAAbstractContent(const std::string& name)
+ : RBARuleObject{name}
+{
+}
+
+}
diff --git a/src/core/model/RBAAbstractContent.hpp b/src/core/model/RBAAbstractContent.hpp
new file mode 100644
index 0000000..c2d72b1
--- /dev/null
+++ b/src/core/model/RBAAbstractContent.hpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Abstract Content class header
+ */
+
+#ifndef RBAABSTRACTCONTENT_HPP
+#define RBAABSTRACTCONTENT_HPP
+
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAAbstractContent : virtual public RBARuleObject
+{
+protected:
+ explicit RBAAbstractContent(const std::string& name="");
+ RBAAbstractContent(const RBAAbstractContent&)=delete;
+ RBAAbstractContent(const RBAAbstractContent&&)=delete;
+ RBAAbstractContent& operator=(const RBAAbstractContent&)=delete;
+ RBAAbstractContent& operator=(const RBAAbstractContent&&)=delete;
+
+public:
+ virtual ~RBAAbstractContent()=default;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractContentMaker.cpp b/src/core/model/RBAAbstractContentMaker.cpp
new file mode 100644
index 0000000..b0ff0be
--- /dev/null
+++ b/src/core/model/RBAAbstractContentMaker.cpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAbstractContentMaker.cpp
+/// @brief Abstract Content generator class implementation
+
+#include "RBAAbstractContentMaker.hpp"
+#include "RBAAbstractContent.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAAbstractContentMaker::RBAAbstractContentMaker(const std::string& label)
+ : RBARuleObjectMaker{label}
+{
+}
+
+RBAModelElement*
+RBAAbstractContentMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBARuleObjectMaker::setProperty( element, jsonElem,
+ model, owner));
+
+ const auto abstContent = dynamic_cast<RBAAbstractContent*>(element);
+
+ // Currently, there is no member set by RBAAbstractContentMaker
+ // as model information, but this process is implemented
+ // because it may be added in the future.
+
+ return abstContent;
+}
+
+}
diff --git a/src/core/model/RBAAbstractContentMaker.hpp b/src/core/model/RBAAbstractContentMaker.hpp
new file mode 100644
index 0000000..df311a8
--- /dev/null
+++ b/src/core/model/RBAAbstractContentMaker.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAbstractContentMaker.cpp
+/// @brief Abstract Content generator class header
+
+#ifndef RBAABSTRACTCONTENTMAKER_HPP
+#define RBAABSTRACTCONTENTMAKER_HPP
+
+#include "RBARuleObjectMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Abstract Content generator class
+class DLL_EXPORT RBAAbstractContentMaker : virtual public RBARuleObjectMaker
+{
+public:
+ explicit RBAAbstractContentMaker(const std::string& label="");
+ RBAAbstractContentMaker(const RBAAbstractContentMaker&)=delete;
+ RBAAbstractContentMaker(const RBAAbstractContentMaker&&)=delete;
+ RBAAbstractContentMaker& operator=(const RBAAbstractContentMaker&)=delete;
+ RBAAbstractContentMaker& operator=(const RBAAbstractContentMaker&&)=delete;
+ virtual ~RBAAbstractContentMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAbstractProperty.cpp b/src/core/model/RBAAbstractProperty.cpp
new file mode 100644
index 0000000..a90fa4d
--- /dev/null
+++ b/src/core/model/RBAAbstractProperty.cpp
@@ -0,0 +1,46 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Abstract property class implementation
+ */
+
+#include "RBAAbstractProperty.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+RBAAbstractProperty::RBAAbstractProperty(const RBASceneImpl* const scene, const std::string& name)
+ : RBARuleObject{name},
+ scene_{scene}
+{
+}
+
+RBAModelElementType
+RBAAbstractProperty::getModelElementType() const
+{
+ return RBAModelElementType::Property;
+}
+
+const RBASceneImpl*
+RBAAbstractProperty::getScene() const
+{
+ return scene_;
+}
+
+}
diff --git a/src/core/model/RBAAbstractProperty.hpp b/src/core/model/RBAAbstractProperty.hpp
new file mode 100644
index 0000000..15ecc2d
--- /dev/null
+++ b/src/core/model/RBAAbstractProperty.hpp
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Abstract property class header
+ */
+
+#ifndef RBAABSTRACTPROPERTY_HPP
+#define RBAABSTRACTPROPERTY_HPP
+
+#include <cstdint>
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+class RBASceneImpl;
+
+class RBAAbstractProperty : public RBARuleObject
+{
+protected:
+ RBAAbstractProperty(const RBASceneImpl* const scene, const std::string& name);
+ RBAAbstractProperty(const RBAAbstractProperty&)=delete;
+ RBAAbstractProperty(const RBAAbstractProperty&&)=delete;
+ RBAAbstractProperty& operator=(const RBAAbstractProperty&)=delete;
+ RBAAbstractProperty& operator=(const RBAAbstractProperty&&)=delete;
+
+public:
+ virtual ~RBAAbstractProperty()=default;
+
+public:
+ RBAModelElementType getModelElementType() const override;
+ virtual std::int32_t getValue() const=0;
+ virtual const RBASceneImpl* getScene() const;
+
+ // Log
+#ifdef RBA_USE_LOG
+ virtual const std::string getExpressionText() const=0;
+#endif
+
+private:
+ const RBASceneImpl* scene_;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAllocatable.cpp b/src/core/model/RBAAllocatable.cpp
new file mode 100644
index 0000000..aac639b
--- /dev/null
+++ b/src/core/model/RBAAllocatable.cpp
@@ -0,0 +1,387 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Allocatable class implementation
+ */
+
+#include <algorithm>
+
+#include "RBAAllocatable.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAViewContent.hpp"
+#include "RBAAreaImpl.hpp"
+#include "RBAConstraintImpl.hpp"
+#include "RBAConstraintInfo.hpp"
+#include "RBAConstraintMap.hpp"
+
+namespace rba
+{
+
+RBAAllocatable::RBAAllocatable(const std::string& name)
+ : RBARuleObject{name},
+ RBAAbstractAllocatable{name}
+{
+}
+
+void RBAAllocatable::clearStatus()
+{
+ allocatablesAffectedByThisAllocatable_.clear();
+ state_ = nullptr;
+ hiddenChecked_ = false;
+ checked_ = false;
+ attenuateChecked_ = false;
+ hidden_ = false;
+ attenuated_ = false;
+}
+
+bool
+RBAAllocatable::isArea() const
+{
+ return isModelElementType(RBAModelElementType::Area);
+}
+
+bool
+RBAAllocatable::isZone() const
+{
+ return isModelElementType(RBAModelElementType::Zone);
+}
+
+RBAArbitrationPolicy
+RBAAllocatable::getAllocatableArbitrationPolicy() const
+{
+ return arbitrationPolicy_;
+}
+
+void
+RBAAllocatable::setArbitrationPolicy(const RBAArbitrationPolicy newPolicy)
+{
+ arbitrationPolicy_ = newPolicy;
+}
+
+std::int32_t
+RBAAllocatable::getVisibility() const
+{
+ return visibility_;
+}
+
+void
+RBAAllocatable::setVisibility(const std::int32_t newVisibility)
+{
+ visibility_ = newVisibility;
+}
+
+const std::list<const RBAAllocatable*>&
+RBAAllocatable::getAllocatablesAffectedByYou() const
+{
+ return allocatablesAffectedByThisAllocatable_;
+}
+
+void
+RBAAllocatable::clearAllocatablesAffectedByYou()
+{
+ return allocatablesAffectedByThisAllocatable_.clear();
+}
+
+void
+RBAAllocatable::addAllocatableWhichHasBeenAffectedByYou(const RBAAllocatable* const allocatable)
+{
+ allocatablesAffectedByThisAllocatable_.push_back(allocatable);
+}
+
+void
+RBAAllocatable::removeAffectAllocatable(const RBAAllocatable* const allocatable)
+{
+ const auto it = std::find(allocatablesAffectedByThisAllocatable_.begin(),
+ allocatablesAffectedByThisAllocatable_.end(), allocatable);
+ if(it != allocatablesAffectedByThisAllocatable_.end()) {
+ static_cast<void>(allocatablesAffectedByThisAllocatable_.erase(it));
+ }
+}
+
+void
+RBAAllocatable::clearAffectAllocatable()
+{
+ allocatablesAffectedByThisAllocatable_.clear();
+}
+
+void
+RBAAllocatable::clearChecked()
+{
+ hiddenChecked_ = false;
+ checked_ = false;
+ attenuateChecked_ =false;
+ hidden_ = false;
+ attenuated_ = false;
+}
+
+std::int32_t
+RBAAllocatable::getIndex() const
+{
+ return index_;
+}
+
+void
+RBAAllocatable::setIndex(const std::int32_t newIndex)
+{
+ index_ = newIndex;
+}
+
+bool
+RBAAllocatable::compare(const RBAAllocatable* const arg0,
+ const RBAAllocatable* const arg1)
+{
+ const std::int32_t visibility0 {arg0->getVisibility()};
+ const std::int32_t visibility1 {arg1->getVisibility()};
+ // Do not swap because the front element is more visible than the rear element
+ if(visibility0 > visibility1) {
+ return true;
+ }
+ // Compare the Z orders because the front element and the rear element
+ // have the same visibility.
+ else if(visibility0 == visibility1) {
+ std::int32_t zorder0{0};
+ std::int32_t zorder1{0};
+ if(arg0->isModelElementType(RBAModelElementType::Area)) {
+ zorder0 = (dynamic_cast<const RBAAreaImpl*>(arg0))->getZorder();
+ zorder1 = (dynamic_cast<const RBAAreaImpl*>(arg1))->getZorder();
+ }
+ else {
+ zorder0 = ZONE_ZORDER;
+ zorder1 = ZONE_ZORDER;
+ }
+ // Do not swap because the front element has a larger Z order than
+ // the rear element.
+ if(zorder0 > zorder1) {
+ return true;
+ }
+ // Do not swap because the Z order of the front element and the rear element
+ // is the same
+ else if(zorder0 == zorder1) {
+ return false;
+ }
+ // Swap because the front element has a smaller Z order than
+ // the rear element.
+ else {
+ return false;
+ }
+ }
+ // Replace because the front element is less visible than
+ // the rear element.
+ else {
+ return false;
+ }
+}
+
+bool
+RBAAllocatable::compareIndex(const RBAAllocatable* const arg0,
+ const RBAAllocatable* const arg1)
+{
+ return arg0->getIndex() < arg1->getIndex();
+}
+
+void
+RBAAllocatable::addConstraint(RBAConstraintImpl* const constraint,
+ const RBAConstraintMap& kind)
+{
+ if (kind == RBAConstraintMap::CONTENT_ALLOCATE_CONSTRAINTS) {
+ addConstraintImpl(constraint, constraints_);
+ } else if (kind == RBAConstraintMap::HIDDEN_TRUE_CHECK_CONSTRAINTS) {
+ addConstraintImpl(constraint, hiddenTrueCheckConstraints_);
+ } else if (kind == RBAConstraintMap::HIDDEN_FALSE_CHECK_CONSTRAINTS) {
+ addConstraintImpl(constraint, hiddenFalseCheckConstraints_);
+ } else if (kind == RBAConstraintMap::ATTENUATE_TRUE_CHECK_CONSTRAINTS) {
+ addConstraintImpl(constraint, attenuateTrueCheckConstraints_);
+ } else {
+ addConstraintImpl(constraint, attenuateFalseCheckConstraints_);
+ }
+}
+
+std::list<RBAConstraintImpl*>&
+RBAAllocatable::getConstraints()
+{
+ return constraints_;
+}
+std::list<RBAConstraintImpl*>& RBAAllocatable::getHiddenTrueCheckConstraints()
+{
+ return hiddenTrueCheckConstraints_;
+}
+std::list<RBAConstraintImpl*>& RBAAllocatable::getHiddenFalseCheckConstraints()
+{
+ return hiddenFalseCheckConstraints_;
+}
+std::list<RBAConstraintImpl*>& RBAAllocatable::getAttenuateTrueCheckConstraints()
+{
+ return attenuateTrueCheckConstraints_;
+}
+std::list<RBAConstraintImpl*>& RBAAllocatable::getAttenuateFalseCheckConstraints()
+{
+ return attenuateFalseCheckConstraints_;
+}
+
+bool RBAAllocatable::hasConstraint(const RBAConstraintImpl* const constraint) const
+{
+ if ((std::find(constraints_.begin(), constraints_.end(), constraint)
+ != constraints_.end())
+ || (std::find(hiddenTrueCheckConstraints_.begin(),
+ hiddenTrueCheckConstraints_.end(), constraint)
+ != hiddenTrueCheckConstraints_.end())
+ || (std::find(hiddenFalseCheckConstraints_.begin(),
+ hiddenFalseCheckConstraints_.end(), constraint)
+ != hiddenFalseCheckConstraints_.end())
+ || (std::find(attenuateTrueCheckConstraints_.begin(),
+ attenuateTrueCheckConstraints_.end(), constraint)
+ != attenuateTrueCheckConstraints_.end())
+ || (std::find(attenuateFalseCheckConstraints_.begin(),
+ attenuateFalseCheckConstraints_.end(), constraint)
+ != attenuateFalseCheckConstraints_.end())) {
+ return true;
+ }
+ return false;
+}
+
+bool
+RBAAllocatable::isChecked() const
+{
+ return checked_;
+}
+
+void
+RBAAllocatable::setChecked(const bool checked)
+{
+ checked_ = checked;
+}
+
+bool
+RBAAllocatable::isHiddenChecked() const
+{
+ return hiddenChecked_;
+}
+
+void
+RBAAllocatable::setHiddenChecked(const bool hiddenChecked)
+{
+ hiddenChecked_ = hiddenChecked;
+}
+
+bool
+RBAAllocatable::isAttenuateChecked() const
+{
+ return attenuateChecked_;
+}
+
+void
+RBAAllocatable::setAttenuateChecked(const bool attenuateChecked)
+{
+ this->attenuateChecked_ = attenuateChecked;
+}
+
+bool
+RBAAllocatable::isAttenuated() const
+{
+ return attenuated_;
+}
+
+void
+RBAAllocatable::setAttenuated(const bool attenuated)
+{
+ this->attenuated_ = attenuated;
+}
+
+bool
+RBAAllocatable::isHidden() const
+{
+ return hidden_;
+}
+
+void
+RBAAllocatable::setHidden(const bool hidden)
+{
+ hidden_ = hidden;
+}
+
+const RBAContentState*
+RBAAllocatable::getState() const
+{
+ return state_;
+}
+
+void
+RBAAllocatable::setState(const RBAContentState* const state)
+{
+ state_ = state;
+}
+
+#ifdef RBA_USE_LOG
+std::string
+RBAAllocatable::getSymbol() const
+{
+ // This function is never called because the function of the derived class
+ // is called.
+ return "Allocatable";
+}
+
+std::string
+RBAAllocatable::getHiddenSymbol() const
+{
+ // This function is never called because the function of the derived class
+ // is called.
+ return "Allocatable: Unsuppored operation exception";
+}
+
+std::string
+RBAAllocatable::getArbitrationPolicyString() const
+{
+ std::string res;
+ switch(arbitrationPolicy_) {
+ case RBAArbitrationPolicy::FIRST_COME_FIRST:
+ res = "FIRST_COME_FIRST";
+ break;
+ case RBAArbitrationPolicy::LAST_COME_FIRST:
+ res = "LAST_COME_FIRST";
+ break;
+ case RBAArbitrationPolicy::PRIORITY_FIRST_COME_FIRST:
+ res = "PRIORITY_FIRST_COME_FIRST";
+ break;
+ case RBAArbitrationPolicy::PRIORITY_LAST_COME_FIRST:
+ res = "PRIORITY_LAST_COME_FIRST";
+ break;
+ default:
+ res = "DEFAULT";
+ break;
+ }
+
+ return res;
+}
+
+std::string
+RBAAllocatable::getVisibilityString() const
+{
+ return std::to_string(visibility_);
+}
+#endif
+
+void
+RBAAllocatable::addConstraintImpl(RBAConstraintImpl* const constraint,
+ std::list<RBAConstraintImpl*>& constraints)
+{
+ if (std::find(constraints.begin(), constraints.end(), constraint)
+ == constraints.end()) {
+ constraints.push_back(constraint);
+ }
+}
+
+}
diff --git a/src/core/model/RBAAllocatable.hpp b/src/core/model/RBAAllocatable.hpp
new file mode 100644
index 0000000..c44d643
--- /dev/null
+++ b/src/core/model/RBAAllocatable.hpp
@@ -0,0 +1,131 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Allocatable class header
+ */
+
+#ifndef RBAALLOCATABLE_HPP
+#define RBAALLOCATABLE_HPP
+
+#include "RBAAbstractAllocatable.hpp"
+#include "RBAArbitrationPolicy.hpp"
+
+namespace rba
+{
+
+class RBAViewContent;
+class RBANotificationChain;
+class RBAContentState;
+class RBAConstraintImpl;
+enum class RBAConstraintMap : std::uint8_t;
+
+class DLL_EXPORT RBAAllocatable : public RBAAbstractAllocatable
+{
+public:
+ explicit RBAAllocatable(const std::string& name="");
+ RBAAllocatable(const RBAAllocatable&)=delete;
+ RBAAllocatable(const RBAAllocatable&&)=delete;
+ RBAAllocatable& operator=(const RBAAllocatable&)=delete;
+ RBAAllocatable& operator=(const RBAAllocatable&&)=delete;
+ virtual ~RBAAllocatable()=default;
+
+public:
+ void clearStatus() override;
+ virtual bool isArea() const;
+ virtual bool isZone() const;
+ RBAArbitrationPolicy getAllocatableArbitrationPolicy() const;
+ void setArbitrationPolicy(const RBAArbitrationPolicy newPolicy);
+ std::int32_t getVisibility() const;
+ void setVisibility(const std::int32_t newVisibility);
+ const std::list<const RBAAllocatable*>& getAllocatablesAffectedByYou() const;
+ void clearAllocatablesAffectedByYou();
+ void addAllocatableWhichHasBeenAffectedByYou(const RBAAllocatable* const allocatable);
+ void removeAffectAllocatable(const RBAAllocatable* const allocatable);
+ void clearAffectAllocatable();
+ virtual void clearChecked();
+ std::int32_t getIndex() const;
+ void setIndex(const std::int32_t newIndex);
+
+ static bool compare(const RBAAllocatable* const arg0, const RBAAllocatable* const arg1);
+ static bool compareIndex(const RBAAllocatable* const arg0, const RBAAllocatable* const arg1);
+ const static RBAArbitrationPolicy ARBITRATION_POLICY_EDEFAULT =
+ RBAArbitrationPolicy::DEFAULT;
+ void addConstraint(RBAConstraintImpl* const constraint, const RBAConstraintMap& kind);
+ std::list<RBAConstraintImpl*>& getConstraints();
+ std::list<RBAConstraintImpl*>& getHiddenTrueCheckConstraints();
+ std::list<RBAConstraintImpl*>& getHiddenFalseCheckConstraints();
+ std::list<RBAConstraintImpl*>& getAttenuateTrueCheckConstraints();
+ std::list<RBAConstraintImpl*>& getAttenuateFalseCheckConstraints();
+ bool hasConstraint(const RBAConstraintImpl* const constraint) const;
+
+ bool isChecked() const;
+ void setChecked(const bool checked);
+ bool isHiddenChecked() const;
+ void setHiddenChecked(const bool hiddenChecked);
+ bool isAttenuateChecked() const;
+ void setAttenuateChecked(const bool attenuateChecked=false);
+ bool isAttenuated() const;
+ void setAttenuated(const bool attenuated=false);
+ bool isHidden() const;
+ void setHidden(const bool hidden=false);
+ const RBAContentState* getState() const;
+ void setState(const RBAContentState* const state);
+
+ // Log
+#ifdef RBA_USE_LOG
+ virtual std::string getSymbol() const;
+ virtual std::string getHiddenSymbol() const;
+ std::string getArbitrationPolicyString() const;
+ std::string getVisibilityString() const;
+#endif
+
+ private:
+ void addConstraintImpl(RBAConstraintImpl* const constraint,
+ std::list<RBAConstraintImpl*>& constraints);
+
+protected:
+ // Zone should be a Z-order below the minimum Area
+ const static std::int32_t ZONE_ZORDER = -2;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::list<const RBAAllocatable*> allocatablesAffectedByThisAllocatable_;
+ std::list<RBAConstraintImpl*> constraints_;
+ std::list<RBAConstraintImpl*> hiddenTrueCheckConstraints_;
+ std::list<RBAConstraintImpl*> hiddenFalseCheckConstraints_;
+ std::list<RBAConstraintImpl*> attenuateTrueCheckConstraints_;
+ std::list<RBAConstraintImpl*> attenuateFalseCheckConstraints_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+ RBAArbitrationPolicy arbitrationPolicy_{ARBITRATION_POLICY_EDEFAULT};
+ std::int32_t visibility_ {0};
+ std::int32_t index_ {0};
+ const RBAContentState * state_ {nullptr};
+ bool hiddenChecked_ {false};
+ bool checked_ {false};
+ bool attenuateChecked_ {false};
+ bool hidden_ {false};
+ bool attenuated_ {false};
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAllocatableMaker.cpp b/src/core/model/RBAAllocatableMaker.cpp
new file mode 100644
index 0000000..f59813b
--- /dev/null
+++ b/src/core/model/RBAAllocatableMaker.cpp
@@ -0,0 +1,82 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAllocatableMaker.cpp
+/// @brief Allocatable object generator abstract class implementation
+
+#include <iostream>
+#include "RBAAllocatableMaker.hpp"
+#include "RBAAllocatable.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAAllocatableMaker::RBAAllocatableMaker(const std::string& label)
+ : RBARuleObjectMaker{label},
+ RBAAbstractAllocatableMaker{label}
+{
+}
+
+RBAModelElement*
+RBAAllocatableMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBAAbstractAllocatableMaker::setProperty(element, jsonElem, model, owner));
+
+ const auto alloc = dynamic_cast<RBAAllocatable*>(element);
+
+ // Set policy
+ const RBAJsonElement* const policy {jsonElem->findChildren("arbitrationPolicy")};
+ if(policy == nullptr) {
+ std::cerr << alloc->getElementName()
+ << ": arbitrationPolicy not found" << &std::endl;
+ return nullptr;
+ }
+ alloc->setArbitrationPolicy(policy->getArbitrationPolicy());
+
+ // Set visibility or priority
+ if (alloc->isArea()) {
+ const RBAJsonElement* const visibility {jsonElem->findChildren("visibility")};
+ if(visibility == nullptr) {
+ std::cerr << alloc->getElementName()
+ << ": visibility not found" << &std::endl;
+ return nullptr;
+ }
+ alloc->setVisibility(visibility->getInt());
+ } else if (alloc->isZone()) {
+ const RBAJsonElement* const priority {jsonElem->findChildren("priority")};
+ if(priority == nullptr) {
+ std::cerr << alloc->getElementName()
+ << ": priority not found" << &std::endl;
+ return nullptr;
+ }
+ alloc->setVisibility(priority->getInt());
+ } else {
+ ;
+ }
+
+ model->addAllocatable(alloc);
+
+ return alloc;
+}
+
+}
diff --git a/src/core/model/RBAAllocatableMaker.hpp b/src/core/model/RBAAllocatableMaker.hpp
new file mode 100644
index 0000000..f4393cb
--- /dev/null
+++ b/src/core/model/RBAAllocatableMaker.hpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAllocatableMaker.cpp
+/// @brief Allocatable object generator abstract class header
+
+#ifndef RBAALLOCATABLEMAKER_HPP
+#define RBAALLOCATABLEMAKER_HPP
+
+#include "RBAAbstractAllocatableMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Allocatable object generator abstract class
+class DLL_EXPORT RBAAllocatableMaker
+ : public RBAAbstractAllocatableMaker
+{
+public:
+ explicit RBAAllocatableMaker(const std::string& label="");
+ RBAAllocatableMaker(const RBAAllocatableMaker&)=delete;
+ RBAAllocatableMaker(const RBAAllocatableMaker&&)=delete;
+ RBAAllocatableMaker& operator=(const RBAAllocatableMaker&)=delete;
+ RBAAllocatableMaker& operator=(const RBAAllocatableMaker&&)=delete;
+ virtual ~RBAAllocatableMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAAllocatableSet.cpp b/src/core/model/RBAAllocatableSet.cpp
new file mode 100644
index 0000000..c545417
--- /dev/null
+++ b/src/core/model/RBAAllocatableSet.cpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AllocatableSet class implementation
+ */
+
+#include "RBAAllocatableSet.hpp"
+#include "RBAAllocatable.hpp"
+
+namespace rba
+{
+
+RBAAllocatableSet::RBAAllocatableSet(const std::string& name)
+ : RBARuleObject{name},
+ RBAAbstractAllocatable{name}
+{
+}
+
+void
+RBAAllocatableSet::addTarget(const RBAAllocatable* alloc)
+{
+ leafAllocatable_.push_back(alloc);
+#ifdef RBA_USE_LOG
+ std::string newName = "[";
+ for (auto& a : leafAllocatable_) {
+ newName += a->getElementName() + ",";
+ }
+ if (newName.size() != 1U) {
+ newName.erase(newName.end() - 1); // Remove the trailing ",".
+ }
+ newName += "]";
+ setDynamicName(newName);
+#endif
+}
+
+void
+RBAAllocatableSet::clear()
+{
+ leafAllocatable_.clear();
+#ifdef RBA_USE_LOG
+ setDynamicName("[]");
+#endif
+}
+
+const std::list<const RBAAllocatable*>&
+RBAAllocatableSet::getLeafAllocatable() const
+{
+ return leafAllocatable_;
+}
+
+}
diff --git a/src/core/model/RBAAllocatableSet.hpp b/src/core/model/RBAAllocatableSet.hpp
new file mode 100644
index 0000000..1c02155
--- /dev/null
+++ b/src/core/model/RBAAllocatableSet.hpp
@@ -0,0 +1,59 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * AllocatableSet class header
+ */
+
+#ifndef RBAALLOCATABLESET_HPP
+#define RBAALLOCATABLESET_HPP
+
+#include "RBAAbstractAllocatable.hpp"
+
+namespace rba
+{
+
+class RBAAllocatable;
+
+class DLL_EXPORT RBAAllocatableSet : public RBAAbstractAllocatable
+{
+public:
+ explicit RBAAllocatableSet(const std::string& name="");
+ RBAAllocatableSet(const RBAAllocatableSet&)=delete;
+ RBAAllocatableSet(const RBAAllocatableSet&&)=delete;
+ RBAAllocatableSet& operator=(const RBAAllocatableSet&)=delete;
+ RBAAllocatableSet& operator=(const RBAAllocatableSet&&)=delete;
+ virtual ~RBAAllocatableSet()=default;
+
+public:
+ virtual void addTarget(const RBAAllocatable* alloc);
+ virtual void clear();
+ const std::list<const RBAAllocatable*>& getLeafAllocatable() const;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::list<const RBAAllocatable*> leafAllocatable_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+#endif
diff --git a/src/core/model/RBAAllocatableSetMaker.cpp b/src/core/model/RBAAllocatableSetMaker.cpp
new file mode 100644
index 0000000..9b9922a
--- /dev/null
+++ b/src/core/model/RBAAllocatableSetMaker.cpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAllocatableSetMaker.cpp
+/// @brief AllocatableSet object genartor abstract class implementation
+
+#include <iostream>
+#include "RBAAllocatableSetMaker.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAAllocatableSetMaker::RBAAllocatableSetMaker(const std::string& label)
+ : RBARuleObjectMaker{label},
+ RBAAbstractAllocatableMaker{label}
+{
+}
+
+RBAModelElement*
+RBAAllocatableSetMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBAAbstractAllocatableMaker::setProperty(element, jsonElem, model, owner));
+
+ const auto allocSet = dynamic_cast<RBAAllocatableSet*>(element);
+
+ // Set target
+ const RBAJsonElement* const target {jsonElem->findChildren("target")};
+ for(const auto& targetElem : target->getChildren()) {
+ const auto alloc = model->findAllocatable(targetElem->getName());
+ allocSet->addTarget(alloc);
+ }
+
+ return allocSet;
+}
+
+}
diff --git a/src/core/model/RBAAllocatableSetMaker.hpp b/src/core/model/RBAAllocatableSetMaker.hpp
new file mode 100644
index 0000000..619d220
--- /dev/null
+++ b/src/core/model/RBAAllocatableSetMaker.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAAllocatableSetMaker.cpp
+/// @brief AllocatableSet object genartor abstract class header
+
+#ifndef RBAALLOCATABLESETMAKER_HPP
+#define RBAALLOCATABLESETMAKER_HPP
+
+#include "RBAAbstractAllocatableMaker.hpp"
+
+namespace rba
+{
+
+/// @brief AllocatableSet object genartor abstract class
+class RBAAllocatableSetMaker : public RBAAbstractAllocatableMaker
+{
+public:
+ explicit RBAAllocatableSetMaker(const std::string& label="");
+ RBAAllocatableSetMaker(const RBAAllocatableSetMaker&)=delete;
+ RBAAllocatableSetMaker(const RBAAllocatableSetMaker&&)=delete;
+ RBAAllocatableSetMaker& operator=(const RBAAllocatableSetMaker&)=delete;
+ RBAAllocatableSetMaker& operator=(const RBAAllocatableSetMaker&&)=delete;
+ virtual ~RBAAllocatableSetMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAConstraint.hpp b/src/core/model/RBAConstraint.hpp
new file mode 100644
index 0000000..312bedc
--- /dev/null
+++ b/src/core/model/RBAConstraint.hpp
@@ -0,0 +1,45 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Constraint class
+ */
+
+#ifndef RBACONSTRAINT_HPP
+#define RBACONSTRAINT_HPP
+
+#include <string>
+#include "RBADllExport.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAConstraint
+{
+ public:
+ RBAConstraint()=default;
+ RBAConstraint(const RBAConstraint&)=delete;
+ RBAConstraint(const RBAConstraint&&)=delete;
+ RBAConstraint& operator=(const RBAConstraint&)=delete;
+ RBAConstraint& operator=(const RBAConstraint&&)=delete;
+ virtual ~RBAConstraint() = default;
+ virtual std::string getName() const =0;
+ const static bool RUNTIME_EDEFAULT = true;
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAConstraintImpl.cpp b/src/core/model/RBAConstraintImpl.cpp
new file mode 100644
index 0000000..a634621
--- /dev/null
+++ b/src/core/model/RBAConstraintImpl.cpp
@@ -0,0 +1,96 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Constraint Implementation class
+ */
+
+#include "RBAConstraintImpl.hpp"
+
+#include "RBAExpression.hpp"
+#include "RBALogManager.hpp"
+
+namespace rba
+{
+
+RBAConstraintImpl::RBAConstraintImpl(const std::string& name)
+ : RBAConstraint(),
+ RBAAbstractConstraint{name}
+{
+}
+
+void
+RBAConstraintImpl::setRuntime(const bool newRuntime)
+{
+ runtime_ = newRuntime;
+}
+
+std::string
+RBAConstraintImpl::getName() const
+{
+ return RBANamedElement::getElementName();
+}
+
+bool
+RBAConstraintImpl::isConstraint() const
+{
+ return true;
+}
+
+bool
+RBAConstraintImpl::isRuntime() const
+{
+ return runtime_;
+}
+
+bool
+RBAConstraintImpl::execute(RBAArbitrator* const arb)
+{
+ LOG_arbitrateConstraintLogicLogLine(" constraint expression["
+ + getExpression()->LOG_getExpressionText()
+ + "] check start");
+ LOG_initConstraintHierarchy();
+ LOG_coverageConstraintStartLog(this);
+
+ clearInfo();
+
+ bool res {getExpression()->execute(getInfo(), arb)};
+#ifdef RBA_USE_LOG
+ std::string log = " constraint expression[" + getExpression()->getExpressionText();
+
+ if (res == true) {
+ log += "] true";
+ } else {
+#endif
+ if (getInfo()->isExceptionBeforeArbitrate() == true) {
+#ifdef RBA_USE_LOG
+ log += "] before arbitrate skip";
+#endif
+ res = true;
+#ifdef RBA_USE_LOG
+ } else {
+ log += "] false";
+ }
+#endif
+ }
+ LOG_arbitrateConstraintLogicLogLine(log + "\n");
+
+ LOG_coverageConstraintEndLog(this);
+
+ return res;
+}
+
+}
diff --git a/src/core/model/RBAConstraintImpl.hpp b/src/core/model/RBAConstraintImpl.hpp
new file mode 100644
index 0000000..eb4d6ab
--- /dev/null
+++ b/src/core/model/RBAConstraintImpl.hpp
@@ -0,0 +1,56 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Constraint Implementation class header
+ */
+
+#ifndef RBACONSTRAINTIMPL_HPP
+#define RBACONSTRAINTIMPL_HPP
+
+#include "RBAConstraint.hpp"
+#include "RBAAbstractConstraint.hpp"
+
+namespace rba
+{
+
+class RBAArbitrator;
+
+class DLL_EXPORT RBAConstraintImpl : public RBAConstraint,
+ public RBAAbstractConstraint
+{
+public:
+ explicit RBAConstraintImpl(const std::string& name="");
+ RBAConstraintImpl(const RBAConstraintImpl&)=delete;
+ RBAConstraintImpl(const RBAConstraintImpl&&)=delete;
+ RBAConstraintImpl& operator=(const RBAConstraintImpl&)=delete;
+ RBAConstraintImpl& operator=(const RBAConstraintImpl&&)=delete;
+ virtual ~RBAConstraintImpl()=default;
+
+public:
+ void setRuntime(const bool newRuntime);
+ std::string getName() const override;
+ bool isConstraint() const override;
+ bool isRuntime() const;
+ bool execute(RBAArbitrator* const arb);
+
+private:
+ bool runtime_ {RUNTIME_EDEFAULT};
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAConstraintMaker.cpp b/src/core/model/RBAConstraintMaker.cpp
new file mode 100644
index 0000000..7363c16
--- /dev/null
+++ b/src/core/model/RBAConstraintMaker.cpp
@@ -0,0 +1,63 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAConstraintMaker.cpp
+/// @brief Constraint object genartor class implementation
+
+#include "RBAConstraintMaker.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAConstraintImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAConstraintMaker::RBAConstraintMaker()
+ : RBAAbstractConstraintMaker{"constraints"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBAConstraintMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBAConstraintImpl>(name);
+}
+
+RBAModelElement*
+RBAConstraintMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBAAbstractConstraintMaker::setProperty(element, jsonElem, model, owner));
+
+ const auto constraint = dynamic_cast<RBAConstraintImpl*>(element);
+
+ // Set runtime
+ bool runtime {false};
+ if(jsonElem->findChildren("runtime")->getString() == "true") {
+ runtime = true;
+ }
+ constraint->setRuntime(runtime);
+
+ model->addConstraint(constraint);
+
+ return constraint;
+}
+
+}
diff --git a/src/core/model/RBAConstraintMaker.hpp b/src/core/model/RBAConstraintMaker.hpp
new file mode 100644
index 0000000..4bcb250
--- /dev/null
+++ b/src/core/model/RBAConstraintMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAConstraintMaker.jhp
+/// @brief Constraint object generator class header
+
+#ifndef RBACONSTRAINTMAKER_HPP
+#define RBACONSTRAINTMAKER_HPP
+
+#include "RBAAbstractConstraintMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Constraint object generator class
+class RBAConstraintMaker : public RBAAbstractConstraintMaker
+{
+public:
+ RBAConstraintMaker();
+ RBAConstraintMaker(const RBAConstraintMaker&)=delete;
+ RBAConstraintMaker(const RBAConstraintMaker&&)=delete;
+ RBAConstraintMaker& operator=(const RBAConstraintMaker&)=delete;
+ RBAConstraintMaker& operator=(const RBAConstraintMaker&&)=delete;
+ virtual ~RBAConstraintMaker()=default;
+
+protected:
+ /// @brief Create an empty instance
+ /// @details Create an empty class of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContent.cpp b/src/core/model/RBAContent.cpp
new file mode 100644
index 0000000..e2e3c9f
--- /dev/null
+++ b/src/core/model/RBAContent.cpp
@@ -0,0 +1,107 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Content class
+ */
+
+#include "RBAContent.hpp"
+#include "RBAResultImpl.hpp"
+#include "RBAResultSet.hpp"
+#include "RBAExpression.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+RBAContent::RBAContent(const std::string& name)
+ : RBARuleObject{name},
+ RBAAbstractContent{name}
+{
+}
+
+bool
+RBAContent::isViewContent() const
+{
+ return false;
+}
+
+bool
+RBAContent::isSoundContent() const
+{
+ return false;
+}
+
+const std::list<const RBAContentState*>&
+RBAContent::getStates() const
+{
+ return states_;
+}
+
+void
+RBAContent::addState(const RBAContentState* const state)
+{
+ states_.push_back(state);
+}
+
+const std::list<const RBAAllocatable*>&
+RBAContent::getAllocatables() const
+{
+ return allocatableSet_->getLeafAllocatable();
+}
+
+void
+RBAContent::addAllocatable(const RBAAllocatable* const alloc)
+{
+ allocatableSet_->addTarget(alloc);
+}
+
+RBAContentLoserType
+RBAContent::getContentLoserType() const
+{
+ return loserType_;
+}
+
+void
+RBAContent::setLoserType(const RBAContentLoserType newLoserType)
+{
+ loserType_ = newLoserType;
+}
+
+const RBAAllocatableSet*
+RBAContent::getAllocatableSet() const
+{
+ return allocatableSet_.get();
+}
+
+void RBAContent::updateRequestStatus(RBAResultSet* const resultset, const bool isOnRequest)
+{
+ resultset->updateRequestStatus(this, isOnRequest);
+}
+
+void RBAContent::updateStatus(RBAResultImpl* const result)
+{
+ result->updateStatus(this);
+}
+
+const std::list<const RBASize*>&
+RBAContent::getSizes() const
+{
+ static const std::list<const RBASize*> sizes;
+ return sizes;
+}
+
+}
diff --git a/src/core/model/RBAContent.hpp b/src/core/model/RBAContent.hpp
new file mode 100644
index 0000000..17e912c
--- /dev/null
+++ b/src/core/model/RBAContent.hpp
@@ -0,0 +1,87 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Content class header
+ */
+
+#ifndef RBACONTENT_HPP
+#define RBACONTENT_HPP
+
+#include <memory>
+#include <set>
+#include "RBAAbstractContent.hpp"
+#include "RBAAllocatableSet.hpp"
+#include "RBAContentLoserType.hpp"
+
+namespace rba
+{
+
+class RBAArbitrator;
+class RBAAllocatable;
+class RBAContentState;
+class RBAResultImpl;
+class RBAResultSet;
+class RBAExpression;
+class RBASize;
+
+class DLL_EXPORT RBAContent : public RBAAbstractContent
+{
+public:
+ explicit RBAContent(const std::string& name="");
+ RBAContent(const RBAContent&)=delete;
+ RBAContent(const RBAContent&&)=delete;
+ RBAContent& operator=(const RBAContent&)=delete;
+ RBAContent& operator=(const RBAContent&&)=delete;
+ virtual ~RBAContent()=default;
+
+public:
+ virtual bool isViewContent() const;
+ virtual bool isSoundContent() const;
+
+ const std::list<const RBAContentState*>& getStates() const;
+ void addState(const RBAContentState* const state);
+ const std::list<const RBAAllocatable*>& getAllocatables() const;
+ void addAllocatable(const RBAAllocatable* const alloc);
+ RBAContentLoserType getContentLoserType() const;
+ void setLoserType(const RBAContentLoserType newLoserType);
+ const RBAAllocatableSet* getAllocatableSet() const;
+ void updateRequestStatus(RBAResultSet* const resultset, const bool isOnRequest);
+ void updateStatus(RBAResultImpl* const result);
+ virtual const std::list<const RBASize*>& getSizes() const;
+
+#ifdef RBA_USE_LOG
+ virtual std::string getSymbol() const = 0;
+ virtual std::string getVisibleSymbol() const = 0;
+#endif
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::list<const RBAContentState*> states_;
+ std::unique_ptr<RBAAllocatableSet> allocatableSet_ {std::make_unique<RBAAllocatableSet>()};
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+ RBAContentLoserType loserType_ {RBAContentLoserType::DO_NOT_GIVEUP_UNTIL_WIN};
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContentMaker.cpp b/src/core/model/RBAContentMaker.cpp
new file mode 100644
index 0000000..a9828ba
--- /dev/null
+++ b/src/core/model/RBAContentMaker.cpp
@@ -0,0 +1,126 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAContentMaker.cpp
+/// @brief Content obecjt generator abstract class
+
+#include <iostream>
+#include "RBAContentMaker.hpp"
+#include "RBAContent.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAViewContentStateMaker.hpp"
+#include "RBASoundContentStateMaker.hpp"
+
+namespace rba
+{
+
+RBAContentMaker::RBAContentMaker(const std::string& label)
+ : RBARuleObjectMaker{label},
+ RBAAbstractContentMaker{label}
+{
+}
+
+RBAModelElement*
+RBAContentMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBAAbstractContentMaker::setProperty(element, jsonElem, model, owner));
+
+ RBAContent* const content {dynamic_cast<RBAContent*>(element)};
+
+ // loserType
+ const RBAJsonElement* const loserTypeElem {jsonElem->findChildren("loserType")};
+ if(loserTypeElem == nullptr) {
+ std::cerr << content->getElementName()
+ << ": loserType not found" << &std::endl;
+ return nullptr;
+ }
+ content->setLoserType(loserTypeElem->getLoserType());
+
+ // allocatable
+ for(auto& allocElem : jsonElem->findChildren("allocatable")->getChildren()) {
+ const auto str = allocElem->getName();
+ std::string allocName {""};
+ std::string className {""};
+ if (str.find(':') != std::string::npos) {
+ allocName = str.substr(0U, str.find(':'));
+ className = str.substr(str.find(':') + 1U);
+ } else {
+ allocName = str;
+ }
+
+ auto alloc = model->findAllocatable(allocName);
+ if (alloc == nullptr) {
+ alloc = dynamic_cast<RBAAllocatable*>(getMaker(className)->getInstance(model, allocName));
+ }
+ const_cast<RBAAllocatable*>(alloc)->addContent(content);
+ content->addAllocatable(alloc);
+ }
+
+ // state
+ if (content->isViewContent()) {
+ RBAViewContentStateMaker csMaker;
+ for(const auto& state : jsonElem->findChildren("states")->getChildren()) {
+ RBAModelElement* const s {csMaker.create(state.get(), model, content)};
+ content->addMember(dynamic_cast<RBARuleObject*>(s));
+ content->addState(dynamic_cast<RBAContentState*>(s));
+ }
+ }
+ else if (content->isSoundContent()) {
+ RBASoundContentStateMaker csMaker;
+ for(const auto& state : jsonElem->findChildren("states")->getChildren()) {
+ RBAModelElement* const s {csMaker.create(state.get(), model, content)};
+ content->addMember(dynamic_cast<RBARuleObject*>(s));
+ content->addState(dynamic_cast<RBAContentState*>(s));
+ }
+ }
+ // Expand Content
+ else {
+ auto alloc = content->getAllocatables().front();
+ // Seek until it becomes an Area or Zone
+ while (!alloc->isArea() && !alloc->isZone()) {
+ alloc = dynamic_cast<const RBAContent*>(alloc)->getAllocatables().front();
+ }
+ if (alloc->isArea()) {
+ RBAViewContentStateMaker csMaker;
+ for(const auto& state : jsonElem->findChildren("states")->getChildren()) {
+ RBAModelElement* const s {csMaker.create(state.get(), model, content)};
+ content->addMember(dynamic_cast<RBARuleObject*>(s));
+ content->addState(dynamic_cast<RBAContentState*>(s));
+ }
+ } else if (alloc->isZone()) {
+ RBASoundContentStateMaker csMaker;
+ for(const auto& state : jsonElem->findChildren("states")->getChildren()) {
+ RBAModelElement* const s {csMaker.create(state.get(), model, content)};
+ content->addMember(dynamic_cast<RBARuleObject*>(s));
+ content->addState(dynamic_cast<RBAContentState*>(s));
+ }
+ } else {
+ ;
+ }
+ }
+
+ model->addContent(content);
+
+ return content;
+}
+
+}
diff --git a/src/core/model/RBAContentMaker.hpp b/src/core/model/RBAContentMaker.hpp
new file mode 100644
index 0000000..5564fc1
--- /dev/null
+++ b/src/core/model/RBAContentMaker.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAContentMaker.hpp
+/// @brief Content obecjt generator class header
+
+#ifndef RBACONTENTMAKER_HPP
+#define RBACONTENTMAKER_HPP
+
+#include "RBAAbstractContentMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Content obecjt generator class
+class DLL_EXPORT RBAContentMaker : public RBAAbstractContentMaker
+{
+public:
+ explicit RBAContentMaker(const std::string& label="");
+ RBAContentMaker(const RBAContentMaker&)=delete;
+ RBAContentMaker(const RBAContentMaker&&)=delete;
+ RBAContentMaker& operator=(const RBAContentMaker&)=delete;
+ RBAContentMaker& operator=(const RBAContentMaker&&)=delete;
+ virtual ~RBAContentMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContentSet.cpp b/src/core/model/RBAContentSet.cpp
new file mode 100644
index 0000000..00da62e
--- /dev/null
+++ b/src/core/model/RBAContentSet.cpp
@@ -0,0 +1,66 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ /**
+ * ContentSet class
+ */
+
+#include <string>
+#include "RBAContentSet.hpp"
+#include "RBAContent.hpp"
+
+namespace rba
+{
+
+RBAContentSet::RBAContentSet(const std::string& name)
+ : RBARuleObject{name},
+ RBAAbstractContent{name}
+{
+}
+
+void
+RBAContentSet::addTarget(const RBAContent* content)
+{
+ leafContent_.push_back(content);
+#ifdef RBA_USE_LOG
+ std::string newName = "[";
+ for (auto& c : leafContent_) {
+ newName += c->getElementName() + ",";
+ }
+ if (newName.size() != 1U) {
+ newName.erase(newName.end() - 1); // Remove the trailing ","
+ }
+ newName += "]";
+ setDynamicName(newName);
+#endif
+}
+
+void
+RBAContentSet::clear()
+{
+ leafContent_.clear();
+#ifdef RBA_USE_LOG
+ setDynamicName("[]");
+#endif
+}
+
+const std::list<const RBAContent*>&
+RBAContentSet::getLeafContent() const
+{
+ return leafContent_;
+}
+
+}
diff --git a/src/core/model/RBAContentSet.hpp b/src/core/model/RBAContentSet.hpp
new file mode 100644
index 0000000..3997f07
--- /dev/null
+++ b/src/core/model/RBAContentSet.hpp
@@ -0,0 +1,61 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ContentSet class header
+ */
+
+#ifndef RBACONTENTSET_HPP
+#define RBACONTENTSET_HPP
+
+#include <list>
+#include "RBAAbstractContent.hpp"
+
+namespace rba
+{
+
+class RBAContent;
+
+class DLL_EXPORT RBAContentSet : public RBAAbstractContent
+{
+public:
+ explicit RBAContentSet(const std::string& name="");
+ RBAContentSet(const RBAContentSet&)=delete;
+ RBAContentSet(const RBAContentSet&&)=delete;
+ RBAContentSet& operator=(const RBAContentSet&)=delete;
+ RBAContentSet& operator=(const RBAContentSet&&)=delete;
+ virtual ~RBAContentSet()=default;
+
+public:
+ virtual void addTarget(const RBAContent* content);
+ virtual void clear();
+ const std::list<const RBAContent*>& getLeafContent() const;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::list<const RBAContent*> leafContent_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContentSetMaker.cpp b/src/core/model/RBAContentSetMaker.cpp
new file mode 100644
index 0000000..cbc8db9
--- /dev/null
+++ b/src/core/model/RBAContentSetMaker.cpp
@@ -0,0 +1,55 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/// @file RBAContentSetMaker.cpp
+/// @brief ContentSet object generator class
+
+#include "RBAContentSetMaker.hpp"
+#include "RBAContentSet.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBAContentSetMaker::RBAContentSetMaker(const std::string& label)
+ : RBARuleObjectMaker{label},
+ RBAAbstractContentMaker{label}
+{
+}
+
+RBAModelElement*
+RBAContentSetMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBAAbstractContentMaker::setProperty(element, jsonElem, model, owner));
+
+ const auto contentSet = dynamic_cast<RBAContentSet*>(element);
+
+ // content
+ for(const auto& content : jsonElem->findChildren("target")->getChildren()) {
+ const auto cont = model->findContent(content->getName());
+ contentSet->addTarget(cont);
+ }
+
+ return contentSet;
+}
+
+}
diff --git a/src/core/model/RBAContentSetMaker.hpp b/src/core/model/RBAContentSetMaker.hpp
new file mode 100644
index 0000000..182764c
--- /dev/null
+++ b/src/core/model/RBAContentSetMaker.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAContentSetMaker.hpp
+/// @brief ContentSet object generator class header
+
+#ifndef RBACONTENTSETMAKER_HPP
+#define RBACONTENTSETMAKER_HPP
+
+#include "RBAAbstractContentMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ContentSet object generator class
+class RBAContentSetMaker : public RBAAbstractContentMaker
+{
+public:
+ explicit RBAContentSetMaker(const std::string& label="");
+ RBAContentSetMaker(const RBAContentSetMaker&)=delete;
+ RBAContentSetMaker(const RBAContentSetMaker&&)=delete;
+ RBAContentSetMaker& operator=(const RBAContentSetMaker&)=delete;
+ RBAContentSetMaker& operator=(const RBAContentSetMaker&&)=delete;
+ virtual ~RBAContentSetMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContentState.cpp b/src/core/model/RBAContentState.cpp
new file mode 100644
index 0000000..f149129
--- /dev/null
+++ b/src/core/model/RBAContentState.cpp
@@ -0,0 +1,133 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+]
+/**
+ * ContentState class
+ */
+
+#include <string>
+
+#include "RBAViewContentState.hpp"
+#include "RBAContent.hpp"
+#include "RBAContentState.hpp"
+
+namespace rba
+{
+
+RBAContentState::RBAContentState(const std::string& name)
+ : RBARuleObject{name}
+{
+}
+
+void
+RBAContentState::clearStatus()
+{
+ order_ = 0;
+}
+
+bool
+RBAContentState::isViewContentState() const
+{
+ return false;
+}
+
+bool
+RBAContentState::isSoundContentState() const
+{
+ return false;
+}
+
+std::string
+RBAContentState::getUniqueName() const
+{
+ return getOwner()->getElementName() + RBAViewContentState::CONTEXT_SEPARATER + getElementName();
+}
+
+std::int32_t
+RBAContentState::getContentStatePriority() const
+{
+ return priority_;
+}
+
+void
+RBAContentState::setPriority(const std::int32_t newPriority)
+{
+ priority_ = newPriority;
+}
+
+std::int32_t
+RBAContentState::getContentStateOrder() const
+{
+ return order_;
+}
+
+void
+RBAContentState::setOrder(const std::int32_t newOrder)
+{
+ order_ = newOrder;
+}
+
+bool
+RBAContentState::compareFirstComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs)
+{
+ return lhs->getContentStateOrder() < rhs->getContentStateOrder();
+}
+
+bool
+RBAContentState::compareLastComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs)
+{
+ return lhs->getContentStateOrder() > rhs->getContentStateOrder();
+}
+
+bool
+RBAContentState::comparePriorityFirstComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs)
+{
+ if(lhs->getContentStatePriority() == rhs->getContentStatePriority()) {
+ return compareFirstComeFirst(lhs, rhs);
+ }
+ else {
+ return lhs->getContentStatePriority() > rhs->getContentStatePriority();
+ }
+}
+
+bool
+RBAContentState::comparePriorityLastComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs)
+{
+ if(lhs->getContentStatePriority() == rhs->getContentStatePriority()) {
+ return compareLastComeFirst(lhs, rhs);
+ }
+ else {
+ return lhs->getContentStatePriority() > rhs->getContentStatePriority();
+ }
+}
+
+const std::string
+RBAContentState::getPriorityString() const
+{
+ return std::to_string(priority_);
+}
+
+const std::string
+RBAContentState::getOrderString() const
+{
+ return std::to_string(order_);
+}
+
+}
diff --git a/src/core/model/RBAContentState.hpp b/src/core/model/RBAContentState.hpp
new file mode 100644
index 0000000..7d4a81f
--- /dev/null
+++ b/src/core/model/RBAContentState.hpp
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * ContentState class header
+ */
+
+#ifndef RBACONTENTSTATE_HPP
+#define RBACONTENTSTATE_HPP
+
+#include <cstdint>
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAContentState : public RBARuleObject
+{
+protected:
+ explicit RBAContentState(const std::string& name);
+ RBAContentState(const RBAContentState&)=delete;
+ RBAContentState(const RBAContentState&&)=delete;
+ RBAContentState& operator=(const RBAContentState&)=delete;
+ RBAContentState& operator=(const RBAContentState&&)=delete;
+
+public:
+ virtual ~RBAContentState()=default;
+
+public:
+ void clearStatus() final;
+ virtual bool isViewContentState() const;
+ virtual bool isSoundContentState() const;
+
+ std::string getUniqueName() const override;
+ std::int32_t getContentStatePriority() const;
+ void setPriority(const std::int32_t newPriority);
+ std::int32_t getContentStateOrder() const;
+ void setOrder(const std::int32_t newOrder);
+
+ static bool compareFirstComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs);
+ static bool compareLastComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs);
+ static bool comparePriorityFirstComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs);
+ static bool comparePriorityLastComeFirst(const RBAContentState* const lhs,
+ const RBAContentState* const rhs);
+
+ // Log
+ const std::string getPriorityString() const;
+ const std::string getOrderString() const;
+
+private:
+ std::int32_t priority_ {0};
+ std::int32_t order_ {0};
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContentStateMaker.cpp b/src/core/model/RBAContentStateMaker.cpp
new file mode 100644
index 0000000..92129ef
--- /dev/null
+++ b/src/core/model/RBAContentStateMaker.cpp
@@ -0,0 +1,79 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAContentStateMaker.cpp
+/// @brief ContentState object generator abstract class
+
+#include "RBAContentStateMaker.hpp"
+#include "RBAContentState.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAConstraintInfo.hpp"
+
+namespace rba
+{
+
+RBAContentStateMaker::RBAContentStateMaker(const std::string& label)
+ : RBARuleObjectMaker{label}
+{
+}
+
+RBAModelElement*
+RBAContentStateMaker::getInstance(RBAModelImpl* model,
+ const std::string& name,
+ RBAModelElement* owner)
+{
+ RBAModelElement* ret {nullptr};
+
+ const auto content = dynamic_cast<RBAContent*>(owner);
+ const auto uniqueName = content->getUniqueName() + "/" + name;
+
+ const auto element = model->findModelElement(uniqueName);
+ // exists in model
+ if(element != nullptr) {
+ ret = const_cast<RBAModelElement*>(element);
+ }
+ // not exists in modelmodel
+ else {
+ std::unique_ptr<RBAModelElement> inst {createInstance(name)};
+ const auto contentState = dynamic_cast<RBAContentState*>(inst.get());
+ contentState->setOwner(content);
+ ret = model->addNamedElement(std::move(inst));
+ }
+
+ return ret;
+}
+
+RBAModelElement*
+RBAContentStateMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBARuleObjectMaker::setProperty(element, jsonElem, model, owner));
+
+ RBAContentState* const state {dynamic_cast<RBAContentState*>(element)};
+
+ // Set priority
+ state->setPriority(jsonElem->findChildren("priority")->getInt());
+
+ model->addContentState(state);
+
+ return state;
+}
+
+}
diff --git a/src/core/model/RBAContentStateMaker.hpp b/src/core/model/RBAContentStateMaker.hpp
new file mode 100644
index 0000000..4082739
--- /dev/null
+++ b/src/core/model/RBAContentStateMaker.hpp
@@ -0,0 +1,58 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAContentStateMaker.hpp
+/// @brief ContentState object generator abstract class header
+
+#ifndef RBACONTENTSTATEMAKER_HPP
+#define RBACONTENTSTATEMAKER_HPP
+
+#include "RBARuleObjectMaker.hpp"
+
+namespace rba
+{
+
+/// @brief ContentState object generator abstract class
+class RBAContentStateMaker : public RBARuleObjectMaker
+{
+public:
+ explicit RBAContentStateMaker(const std::string& label);
+ RBAContentStateMaker(const RBAContentStateMaker&)=delete;
+ RBAContentStateMaker(const RBAContentStateMaker&&)=delete;
+ RBAContentStateMaker& operator=(const RBAContentStateMaker&)=delete;
+ RBAContentStateMaker& operator=(const RBAContentStateMaker&&)=delete;
+ virtual ~RBAContentStateMaker()=default;
+
+public:
+
+ RBAModelElement* getInstance(RBAModelImpl* model,
+ const std::string& name="",
+ RBAModelElement* owner=nullptr) override;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAContentStatusType.hpp b/src/core/model/RBAContentStatusType.hpp
new file mode 100644
index 0000000..d6cd161
--- /dev/null
+++ b/src/core/model/RBAContentStatusType.hpp
@@ -0,0 +1,36 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+// State transition type of content
+//
+
+#ifndef RBACONTENTSTATUSTYPE_HPP
+#define RBACONTENTSTATUSTYPE_HPP
+
+namespace rba
+{
+
+enum class RBAContentStatusType : std::uint8_t
+{
+ NoRequest,
+ Undisplayed,
+ Displayed,
+ StandBy,
+ Canceled
+};
+}
+
+#endif /* RBACONTENTSTATUSTYPE_HPP */
diff --git a/src/core/model/RBAIntegerProperty.cpp b/src/core/model/RBAIntegerProperty.cpp
new file mode 100644
index 0000000..aeee3b0
--- /dev/null
+++ b/src/core/model/RBAIntegerProperty.cpp
@@ -0,0 +1,48 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ /**
+ * Integer property class
+ */
+
+#include "RBAIntegerProperty.hpp"
+#include "RBASceneImpl.hpp"
+
+namespace rba
+{
+
+RBAIntegerProperty::RBAIntegerProperty(const RBASceneImpl* const scene,
+ const std::string& newName,
+ const std::int32_t newValue)
+ : RBAAbstractProperty{scene, newName},
+ value_{newValue}
+{
+}
+
+std::int32_t
+RBAIntegerProperty::getValue() const
+{
+ return value_;
+}
+
+#ifdef RBA_USE_LOG
+const std::string
+RBAIntegerProperty::getExpressionText() const
+{
+ return getScene()->getElementName() + "." + getElementName();
+}
+#endif
+
+}
diff --git a/src/core/model/RBAIntegerProperty.hpp b/src/core/model/RBAIntegerProperty.hpp
new file mode 100644
index 0000000..f174f0a
--- /dev/null
+++ b/src/core/model/RBAIntegerProperty.hpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ /**
+ * Integer property class header
+ */
+
+#ifndef RBAINTEGERPROPERTY_HPP
+#define RBAINTEGERPROPERTY_HPP
+
+#include "RBAAbstractProperty.hpp"
+
+namespace rba
+{
+
+class RBAIntegerProperty : public RBAAbstractProperty
+{
+public:
+ RBAIntegerProperty(const RBASceneImpl* const scene,
+ const std::string& newName, const std::int32_t newValue);
+ RBAIntegerProperty(const RBAIntegerProperty&)=delete;
+ RBAIntegerProperty(const RBAIntegerProperty&&)=delete;
+ RBAIntegerProperty& operator=(const RBAIntegerProperty&)=delete;
+ RBAIntegerProperty& operator=(const RBAIntegerProperty&&)=delete;
+
+public:
+ std::int32_t getValue() const override;
+
+ // Log
+#ifdef RBA_USE_LOG
+ const std::string getExpressionText() const override;
+#endif
+
+private:
+ std::int32_t value_;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAModelElement.cpp b/src/core/model/RBAModelElement.cpp
new file mode 100644
index 0000000..b4308e5
--- /dev/null
+++ b/src/core/model/RBAModelElement.cpp
@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * ModelElment class
+ */
+
+#include "RBAModelElement.hpp"
+#include "RBAModelElementType.hpp"
+
+namespace rba
+{
+
+void RBAModelElement::clearStatus()
+{
+ // This function is called from a ModelElement that has no internal state
+ // to clear.
+ // The overridden function is called from the ModelElement
+ // that has the internal state to clear.
+}
+RBAModelElementType
+RBAModelElement::getModelElementType() const
+{
+ // This function is never called because the function of
+ // the derived class is called.
+ return RBAModelElementType::None;
+}
+
+bool
+RBAModelElement::isModelElementType(const RBAModelElementType elemType) const
+{
+ return (elemType == getModelElementType());
+}
+
+}
diff --git a/src/core/model/RBAModelElement.hpp b/src/core/model/RBAModelElement.hpp
new file mode 100644
index 0000000..7ee7557
--- /dev/null
+++ b/src/core/model/RBAModelElement.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * ModelElment class header
+ */
+
+#ifndef RBAMODELELEMENT_HPP
+#define RBAMODELELEMENT_HPP
+
+#include <cstdint>
+#include "RBADllExport.hpp"
+
+namespace rba
+{
+
+enum class RBAModelElementType : std::uint8_t;
+
+class DLL_EXPORT RBAModelElement
+{
+protected:
+ RBAModelElement()=default;
+ RBAModelElement(const RBAModelElement&)=delete;
+ RBAModelElement(const RBAModelElement&&)=delete;
+ RBAModelElement& operator=(const RBAModelElement&)=delete;
+ RBAModelElement& operator=(const RBAModelElement&&)=delete;
+
+public:
+ virtual ~RBAModelElement()=default;
+
+public:
+ virtual void clearStatus();
+ virtual RBAModelElementType getModelElementType() const;
+ bool isModelElementType(const RBAModelElementType elemType) const;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAModelElementMaker.cpp b/src/core/model/RBAModelElementMaker.cpp
new file mode 100644
index 0000000..9d750c0
--- /dev/null
+++ b/src/core/model/RBAModelElementMaker.cpp
@@ -0,0 +1,122 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAModelElementMaker.cpp
+/// @brief ModelElement object genartor abstract class
+
+#include "RBAModelElementMaker.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelFactory.hpp"
+#include "RBAModelImpl.hpp"
+
+namespace rba
+{
+
+std::unordered_map<std::string, std::unique_ptr<RBAModelElementMaker>> RBAModelElementMaker::makerMap_;
+
+RBAModelElementMaker::RBAModelElementMaker(const std::string& label)
+ : factory_{nullptr},
+ label_{label}
+{
+}
+
+void
+RBAModelElementMaker::setFactory(RBAModelFactory* const factory)
+{
+ factory_ = factory;
+}
+
+RBAModelFactory* RBAModelElementMaker::getFactory() const
+{
+ return factory_;
+}
+
+const std::string&
+RBAModelElementMaker::getLabel() const
+{
+ return label_;
+}
+
+RBAModelElement*
+RBAModelElementMaker::create(const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ const auto nameElement = jsonElem->findChildren("name");
+
+ RBAModelElement* element {nullptr};
+ if (nameElement != nullptr) {
+ element = getInstance(model, nameElement->getString(), owner);
+ } else {
+ element = getInstance(model, "", owner);
+ }
+
+ return setProperty(element, jsonElem, model, owner);
+}
+
+RBAModelElement*
+RBAModelElementMaker::getInstance(RBAModelImpl* model,
+ const std::string& name,
+ RBAModelElement* owner)
+{
+ RBAModelElement* ret {nullptr};
+
+ // If there is a class name, delete the class name
+ std::string fullName {name};
+ while (fullName.find(':') != std::string::npos) {
+ const auto start = fullName.find(':');
+ const auto end = fullName.find('/', start);
+ static_cast<void>(fullName.erase(start, end - start));
+ }
+
+ // In case of Elemetn with name
+   if(fullName != "") {
+ const auto elem = model->findModelElement(fullName);
+ // exists in model
+ if(elem != nullptr) {
+ ret = const_cast<RBAModelElement*>(elem);
+ }
+ // not exists in model
+ else {
+ std::unique_ptr<RBAModelElement> inst {createInstance(fullName)};
+ ret = model->addNamedElement(std::move(inst));
+ }
+ }
+ // In case of Elemetn without name
+ else {
+ std::unique_ptr<RBAModelElement> inst {createInstance()};
+ ret = model->addModelElement(std::move(inst));
+ }
+
+ return ret;
+}
+
+void
+RBAModelElementMaker::addMaker(const std::string& typeName, std::unique_ptr<RBAModelElementMaker> maker)
+{
+ makerMap_[typeName] = std::move(maker);
+}
+
+RBAModelElementMaker*
+RBAModelElementMaker::getMaker(const std::string& typeName)
+{
+ if (makerMap_.find(typeName) == makerMap_.end()) {
+ return nullptr;
+ }
+ return makerMap_[typeName].get();
+}
+
+}
diff --git a/src/core/model/RBAModelElementMaker.hpp b/src/core/model/RBAModelElementMaker.hpp
new file mode 100644
index 0000000..c038f5a
--- /dev/null
+++ b/src/core/model/RBAModelElementMaker.hpp
@@ -0,0 +1,135 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAModelElementMaker.hpp
+/// @brief ModelElement object genartor abstract class header
+
+#ifndef RBAMODELELEMENTMAKER_HPP
+#define RBAMODELELEMENTMAKER_HPP
+
+#include <memory>
+#include <string>
+#include "RBADllExport.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+class RBAModelElement;
+class RBAJsonElement;
+class RBAModelImpl;
+
+/// @brief ModelElement object genartor abstract class
+class DLL_EXPORT RBAModelElementMaker
+{
+public:
+ /// @brief Constructor that specifies the label
+ /// @details Set label and generate
+ /// @param[in] label labe to set
+ RBAModelElementMaker()=default;
+ explicit RBAModelElementMaker(const std::string& label);
+ virtual ~RBAModelElementMaker()=default;
+
+protected:
+ RBAModelElementMaker(const RBAModelElementMaker& maker)=delete;
+ RBAModelElementMaker& operator=(const RBAModelElementMaker& maker)=delete;
+ // Use "move" in RBAAbstractModelTable::addMaker()
+ RBAModelElementMaker(RBAModelElementMaker&&)=default;
+ RBAModelElementMaker& operator=(RBAModelElementMaker&&)=default;
+
+public:
+ /// @brief Set model factory
+ /// @param[in] factory model factory
+ void setFactory(RBAModelFactory* const factory);
+
+ /// @brief Get label
+ /// @details Returns the label of the corresponding JSON element
+ /// @return Label string
+ const std::string& getLabel() const;
+
+ /// @brief Create ModelElement object
+ /// @details create ModelElement object and register unique_ptr to model
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The moder to store created object
+ /// @param[in,out] owner Parent object (Not in use)
+ /// @return ModelElement object
+ virtual RBAModelElement* create(const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr);
+
+ /// @brief Get instance
+ /// @details Get the element corresponding to name from model.
+ /// If there is no name or it is not in model,
+ /// create an instance and register it in model.
+ /// @return ModelElement object
+ virtual RBAModelElement* getInstance(RBAModelImpl* model,
+ const std::string& name="",
+ RBAModelElement* owner=nullptr);
+
+ /// @brief Register Maker
+ /// @details Register the Maker corresponding to the class name
+ /// used in JSON in the map
+ /// @return void
+ static void addMaker(const std::string& typeName,
+ std::unique_ptr<RBAModelElementMaker> maker);
+
+ /// @brief Get Maker
+ /// @details Get the Maker corresponding to the class name from the map
+ /// @return Corresponding Maker. If it doesn't exist, return null.
+ static RBAModelElementMaker* getMaker(const std::string& typeName);
+
+protected:
+ /// @brief Create an empty instance
+ /// @details Create an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for instance
+ virtual std::unique_ptr<RBAModelElement> createInstance(const std::string& name="")=0;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ virtual RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr)=0;
+
+ /// @brief Get model factory
+ /// @details Get model factory
+ /// @return model factory
+ RBAModelFactory* getFactory() const;
+
+private:
+ /// @brief Factory for recursively generating objects
+ RBAModelFactory* factory_;
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ /// @brief Label of corresponding JSON element
+ const std::string label_;
+
+ /// @brief Correspondence map of each Maker and the character string that
+ /// represents the class used in JSON
+ static std::unordered_map<std::string, std::unique_ptr<RBAModelElementMaker>> makerMap_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAModelElementType.hpp b/src/core/model/RBAModelElementType.hpp
new file mode 100644
index 0000000..756f22b
--- /dev/null
+++ b/src/core/model/RBAModelElementType.hpp
@@ -0,0 +1,116 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * ModelElementType class header
+ */
+
+#ifndef RBAMODELELEMENTTYPE_HPP
+#define RBAMODELELEMENTTYPE_HPP
+
+namespace rba
+{
+
+enum class RBAModelElementType : std::uint8_t
+{
+ AllInstanceOfArea,
+ AllInstanceOfViewContent,
+ AllInstanceOfZone,
+ AllInstanceOfSoundContent,
+ Allocatable,
+ AllocatedContent,
+ AndOperator,
+ Area,
+ AreaSet,
+ ArithmeticOperator,
+ Constraint,
+ ViewContent,
+ ViewContentSet,
+ ViewContentState,
+ ContentValue,
+ DisplayingContent,
+ ExistsOperator,
+ ForAllOperator,
+ GetAllocatables,
+ ActiveState,
+ ActiveContents,
+ GetContentsList,
+ IfStatement,
+ IfActionOperator,
+ ImpliesOperator,
+ IntegerValue,
+ IsActive,
+ IsDisplayed,
+ IsEqualToOperator,
+ IsGreaterThanEqualOperator,
+ IsGreaterThanOperator,
+ IsHidden,
+ IsLowerThanEqualOperator,
+ IsLowerThanOperator,
+ IsVisible,
+ LambdaContext,
+ LambdaExpression,
+ LetStatement,
+ NotOperator,
+ ObjectCompare,
+ ObjectReference,
+ MemberFeatureReference,
+ OrOperator,
+ PlusOperator,
+ PreviousModifier,
+ RuleObject,
+ Scene,
+ Property,
+ SetExpression,
+ SetOfOperator,
+ SetOperator,
+ ValueExpression,
+ Variable,
+ IsOn,
+ Zone,
+ ZoneSet,
+ SoundContent,
+ SoundContentSet,
+ SoundContentState,
+ IsAttenuated,
+ IsOutputted,
+ IsMuted,
+ IsSounding,
+ Rule,
+ OnScene,
+ OffScene,
+ GetProperty,
+ SetProperty,
+ IntegerProperty,
+ OutputtingSound,
+ StateValue,
+ HasBeenCanceled,
+ HasBeenDisplayed,
+ HasComeEarlier,
+ HasComeLater,
+ EventProcessing,
+ MaxOperator,
+ MinOperator,
+ SelectOperator,
+ SizeOperator,
+ Undisplayed,
+ IsTypeOfOperator,
+ Displayed,
+ None
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBAModelImpl.cpp b/src/core/model/RBAModelImpl.cpp
new file mode 100644
index 0000000..081607c
--- /dev/null
+++ b/src/core/model/RBAModelImpl.cpp
@@ -0,0 +1,823 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAModelmpl.cpp
+/// @brief Model implementation class
+
+#include "RBAModelImpl.hpp"
+#include "RBAConstraintImpl.hpp"
+
+namespace rba
+{
+
+const RBAContentState*
+RBAModelImpl::findContentState(const std::string& stateName)
+{
+ const auto elem = findModelElementImpl(stateName);
+ auto contentState = dynamic_cast<const RBAContentState*>(elem);
+ if (contentState == nullptr) {
+ const auto content = dynamic_cast<const RBAContent*>(elem);
+ if (content != nullptr) {
+ contentState = content->getStates().front();
+ }
+ }
+ return contentState;
+}
+
+const RBAArea*
+RBAModelImpl::findArea(const std::string& areaName) const
+{
+ return findAreaImpl(areaName);
+}
+
+const RBAViewContent*
+RBAModelImpl::findViewContent(const std::string& contName) const
+{
+ return findViewContentImpl(contName);
+}
+
+const RBAViewContentState*
+RBAModelImpl::findViewContentState(const std::string& stateName) const
+{
+ return findViewContentStateImpl(stateName);
+}
+
+const RBASize*
+RBAModelImpl::findSize(const std::string& sizeName) const
+{
+ return findSizeImpl(sizeName);
+}
+
+const RBAZone*
+RBAModelImpl::findZone(const std::string& zoneName) const
+{
+ return findZoneImpl(zoneName);
+}
+
+const RBASoundContent*
+RBAModelImpl::findSoundContent(const std::string& contName) const
+{
+ return findSoundContentImpl(contName);
+}
+
+const RBASoundContentState*
+RBAModelImpl::findSoundContentState(const std::string& stateName) const
+{
+ return findSoundContentStateImpl(stateName);
+}
+
+const RBAScene*
+RBAModelImpl::findScene(const std::string& sceneName) const
+{
+ return findSceneImpl(sceneName);
+}
+
+const RBADisplay*
+RBAModelImpl::findDisplay(const std::string& displayName) const
+{
+ return findDisplayImpl(displayName);
+}
+
+const RBAModelElement*
+RBAModelImpl::findModelElement(const std::string& elementName) const
+{
+ return findModelElementImpl(elementName);
+}
+
+const std::list<const RBAArea*>&
+RBAModelImpl::getAreas() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAArea is the base class of RBAAreaImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBAArea*>&>(getAreaImpls());
+}
+
+const std::list<const RBAViewContent*>&
+RBAModelImpl::getViewContents() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAViewContent is the base class of
+ // RBAViewContentImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBAViewContent*>&>(getViewContentImpls());
+}
+
+const std::list<const RBAViewContentState*>&
+RBAModelImpl::getViewContentStates() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAViewContentState is the base class of
+ // RBAViewContentStateImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBAViewContentState*>&>(getViewContentStateImpls());
+}
+
+const std::list<const RBASize*>&
+RBAModelImpl::getSizes() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBASize is the base class of RBASizeImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBASize*>&>(getSizeImpls());
+}
+
+const std::list<const RBAZone*>&
+RBAModelImpl::getZones() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAZone is the base class of RBAZoneImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBAZone*>&>(getZoneImpls());
+}
+
+const std::list<const RBASoundContent*>&
+RBAModelImpl::getSoundContents() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBASoundContent is the base class of
+ // RBASoundContentImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBASoundContent*>&>(getSoundContentImpls());
+}
+
+const std::list<const RBASoundContentState*>&
+RBAModelImpl::getSoundContentStates() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBASoundContentState is the base class of
+ // RBASoundContentStateImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBASoundContentState*>&>(getSoundContentStateImpls());
+}
+
+const std::list<const RBAScene*>&
+RBAModelImpl::getScenes() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAScene is the base class of
+ // RBASceneImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBAScene*>&>(getSceneImpls());
+}
+
+const std::list<const RBAAreaSet*>&
+RBAModelImpl::getAreaSets() const
+{
+ return getAreaSetImpls();
+}
+
+const std::list<const RBAViewContentSet*>&
+RBAModelImpl::getViewContentSets() const
+{
+ return getViewContentSetImpls();
+}
+
+const std::list<const RBAZoneSet*>&
+RBAModelImpl::getZoneSets() const
+{
+ return getZoneSetImpls();
+}
+
+const std::list<const RBASoundContentSet*>&
+RBAModelImpl::getSoundContentSets() const
+{
+ return getSoundContentSetImpls();
+}
+
+const std::list<const RBAPositionContainer*>&
+RBAModelImpl::getPositionContainers() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAPositionContainer is the base class of
+ // RBAPositionContainerImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBAPositionContainer*>&>(getPositionContainerImpls());
+}
+
+const std::list<const RBADisplay*>&
+RBAModelImpl::getDisplays() const
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBADisplay is the base class of RBADisplayImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<const std::list<const RBADisplay*>&>(getDisplayImpls());
+}
+
+std::list<RBAConstraint*>&
+RBAModelImpl::getConstraints()
+{
+ // @Deviation (A5-2-4)
+ // [Contents that deviate from the rules]
+ // reinterpret_cast shall not be used.
+ // [Reason that there is no problem if the rule is deviated]
+ // There is no problem because RBAConstraint is the base class of
+ // RBAConstraintImpl.
+ // Since the conversion process is costly, it deviates because it hides
+ // the internal structure.
+ return reinterpret_cast<std::list<RBAConstraint*>&>(getConstraintImpls());
+}
+
+void RBAModelImpl::clearElementsStatus()
+{
+ for (auto& o : unnamedObjects_) {
+ o->clearStatus();
+ }
+ for (auto& o : nameToObject_) {
+ o.second->clearStatus();
+ }
+}
+
+const RBAAllocatable*
+RBAModelImpl::findAllocatable(const std::string& allocatableName) const
+{
+ auto it = nameToObject_.find(allocatableName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAAllocatable*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAContent*
+RBAModelImpl::findContent(const std::string& contentName) const
+{
+ auto it = nameToObject_.find(contentName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAContent*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAAreaImpl*
+RBAModelImpl::findAreaImpl(const std::string& areaName) const
+{
+ auto it = nameToObject_.find(areaName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAAreaImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAViewContentImpl*
+RBAModelImpl::findViewContentImpl(const std::string& contName) const
+{
+ auto it = nameToObject_.find(contName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAViewContentImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAViewContentStateImpl*
+RBAModelImpl::findViewContentStateImpl(const std::string& stateName) const
+{
+ const RBAViewContentStateImpl* ret {nullptr};
+ if(RBAViewContentState::isUniqueName(stateName)) {
+ auto it = nameToObject_.find(stateName);
+ if(it != nameToObject_.end()) {
+ ret = dynamic_cast<const RBAViewContentStateImpl*>(it->second.get());
+ }
+ }
+ else {
+ const RBAViewContentImpl* const content {findViewContentImpl(stateName)};
+ if(content != nullptr) {
+ const RBAContentState* const state {content->getStates().front()};
+ ret = dynamic_cast<const RBAViewContentStateImpl*>(state);
+ }
+ }
+
+ return ret;
+}
+
+const RBASizeImpl*
+RBAModelImpl::findSizeImpl(const std::string& sizeName) const
+{
+ auto it = nameToObject_.find(sizeName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBASizeImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAZoneImpl*
+RBAModelImpl::findZoneImpl(const std::string& zoneName) const
+{
+ auto it = nameToObject_.find(zoneName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAZoneImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBASoundContentImpl*
+RBAModelImpl::findSoundContentImpl(const std::string& contName) const
+{
+ auto it = nameToObject_.find(contName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBASoundContentImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBASoundContentStateImpl*
+RBAModelImpl::findSoundContentStateImpl(const std::string& stateName) const
+{
+ const RBASoundContentStateImpl* ret {nullptr};
+ if(RBASoundContentState::isUniqueName(stateName)) {
+ auto it = nameToObject_.find(stateName);
+ if(it != nameToObject_.end()) {
+ ret = dynamic_cast<const RBASoundContentStateImpl*>(it->second.get());
+ }
+ }
+ else {
+ const RBASoundContentImpl* const content {findSoundContentImpl(stateName)};
+ if(content != nullptr) {
+ const RBAContentState* const state {content->getStates().front()};
+ ret = dynamic_cast<const RBASoundContentStateImpl*>(state);
+ }
+ }
+
+ return ret;
+}
+
+const RBASceneImpl*
+RBAModelImpl::findSceneImpl(const std::string& sceneName) const
+{
+ auto it = nameToObject_.find(sceneName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBASceneImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBADisplayImpl*
+RBAModelImpl::findDisplayImpl(const std::string& displayName) const
+{
+ auto it = nameToObject_.find(displayName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBADisplayImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAModelElement*
+RBAModelImpl::findModelElementImpl(const std::string& elementName) const
+{
+ auto it = nameToObject_.find(elementName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAModelElement*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const std::list<const RBAAllocatable*>&
+RBAModelImpl::getAllocatables() const
+{
+ return allocatables_;
+}
+
+const std::list<const RBAContent*>&
+RBAModelImpl::getContents() const
+{
+ return contents_;
+}
+
+const std::list<const RBAContentState*>&
+RBAModelImpl::getContentStates() const
+{
+ return contentStates_;
+}
+
+const std::list<const RBAAreaImpl*>&
+RBAModelImpl::getAreaImpls() const
+{
+ return areas_;
+}
+
+const std::list<const RBAViewContentImpl*>&
+RBAModelImpl::getViewContentImpls() const
+{
+ return viewContents_;
+}
+
+const std::list<const RBAViewContentStateImpl*>&
+RBAModelImpl::getViewContentStateImpls() const
+{
+ return viewContentStates_;
+}
+
+const std::list<const RBASizeImpl*>&
+RBAModelImpl::getSizeImpls() const
+{
+ return sizes_;
+}
+
+const std::list<const RBAZoneImpl*>&
+RBAModelImpl::getZoneImpls() const
+{
+ return zones_;
+}
+
+const std::list<const RBASoundContentImpl*>&
+RBAModelImpl::getSoundContentImpls() const
+{
+ return soundContents_;
+}
+
+const std::list<const RBASoundContentStateImpl*>&
+RBAModelImpl::getSoundContentStateImpls() const
+{
+ return soundContentStates_;
+}
+
+const std::list<const RBASceneImpl*>&
+RBAModelImpl::getSceneImpls() const
+{
+ return scenes_;
+}
+
+const std::list<const RBAPositionContainerImpl*>&
+RBAModelImpl::getPositionContainerImpls() const
+{
+ return positionContainers_;
+}
+
+const std::list<const RBADisplayImpl*>&
+RBAModelImpl::getDisplayImpls() const
+{
+ return displays_;
+}
+
+void
+RBAModelImpl::createSortedAllocatables()
+{
+ if(!(sortedAllocatables_.empty())) {
+ sortedAllocatables_.clear();
+ }
+
+ for(auto& alloc : allocatables_) {
+ sortedAllocatables_.push_back(const_cast<RBAAllocatable*>(alloc));
+ }
+ sortedAllocatables_.sort(&RBAAllocatable::compare);
+
+ std::int32_t index{0};
+ for(RBAAllocatable* const allocatable : sortedAllocatables_) {
+ allocatable->setIndex(index);
+ index++;
+ }
+}
+
+std::list<RBAAllocatable*>&
+RBAModelImpl::getSortedAllocatables()
+{
+ return sortedAllocatables_;
+}
+
+RBAConstraintImpl*
+RBAModelImpl::findConstraintImpl(const std::string& consName) const
+{
+ auto it = nameToObject_.find(consName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<RBAConstraintImpl*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAAreaSet*
+RBAModelImpl::findAreaSetImpl(const std::string& areaSetName) const
+{
+ auto it = nameToObject_.find(areaSetName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAAreaSet*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAZoneSet*
+RBAModelImpl::findZoneSetImpl(const std::string& zoneSetName) const
+{
+ auto it = nameToObject_.find(zoneSetName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAZoneSet*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAViewContentSet*
+RBAModelImpl::findViewContentSetImpl(const std::string& contSetName) const
+{
+ auto it = nameToObject_.find(contSetName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBAViewContentSet*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBASoundContentSet*
+RBAModelImpl::findSoundContentSetImpl(const std::string& contSetName) const
+{
+ auto it = nameToObject_.find(contSetName);
+ if(it != nameToObject_.end()) {
+ return dynamic_cast<const RBASoundContentSet*>(it->second.get());
+ }
+
+ return nullptr;
+}
+
+const RBAPositionContainerImpl*
+RBAModelImpl::findPositionContainerImpl(const std::string& areaName) const
+{
+ auto it = areaNameToPositionContainer_.find(areaName);
+ if(it != areaNameToPositionContainer_.end()) {
+ return dynamic_cast<const RBAPositionContainerImpl*>(it->second);
+ }
+
+ return nullptr;
+}
+
+/*
+ * get list functions
+ */
+
+std::list<const RBAConstraintImpl*>&
+RBAModelImpl::getConstraintImpls()
+{
+ return constraints_;
+}
+
+const std::list<const RBAAreaSet*>&
+RBAModelImpl::getAreaSetImpls() const
+{
+ return areaSets_;
+}
+
+const std::list<const RBAZoneSet*>&
+RBAModelImpl::getZoneSetImpls() const
+{
+ return zoneSets_;
+}
+
+const std::list<const RBAViewContentSet*>&
+RBAModelImpl::getViewContentSetImpls() const
+{
+ return viewContentSets_;
+}
+
+const std::list<const RBASoundContentSet*>&
+RBAModelImpl::getSoundContentSetImpls() const
+{
+ return soundContentSets_;
+}
+
+RBAModelElement*
+RBAModelImpl::addModelElement(std::unique_ptr<RBAModelElement> newElement)
+{
+ RBAModelElement* const element {newElement.get()};
+ unnamedObjects_.push_back(std::move(newElement));
+ return element;
+}
+
+RBANamedElement*
+RBAModelImpl::addNamedElement(std::unique_ptr<RBAModelElement> newElement)
+{
+ RBANamedElement* const element {dynamic_cast<RBANamedElement*>(newElement.get())};
+ nameToObject_[element->getUniqueName()] = std::move(newElement);
+ return element;
+}
+
+void
+RBAModelImpl::addAllocatable(const RBAAllocatable* newAlloc)
+{
+ allocatables_.push_back(newAlloc);
+ if(newAlloc->isArea()) {
+ areas_.push_back(dynamic_cast<const RBAAreaImpl*>(newAlloc));
+ }
+ else if (newAlloc->isZone()) {
+ zones_.push_back(dynamic_cast<const RBAZoneImpl*>(newAlloc));
+ } else {
+ ;
+ }
+}
+
+void
+RBAModelImpl::addContent(const RBAContent* newContent)
+{
+ contents_.push_back(newContent);
+ if(newContent->isViewContent()) {
+ viewContents_.push_back(dynamic_cast<const RBAViewContentImpl*>(newContent));
+ }
+ else if (newContent->isSoundContent()) {
+ soundContents_.push_back(dynamic_cast<const RBASoundContentImpl*>(newContent));
+ } else {
+ ;
+ }
+}
+
+void
+RBAModelImpl::addContentState(const RBAContentState* newState)
+{
+ contentStates_.push_back(newState);
+ if(newState->isViewContentState()) {
+ viewContentStates_.push_back(dynamic_cast<const RBAViewContentStateImpl*>(newState));
+ }
+ else {
+ soundContentStates_.push_back(dynamic_cast<const RBASoundContentStateImpl*>(newState));
+ }
+}
+
+void
+RBAModelImpl::addAreaSet(const RBAAreaSet* newAreaSet)
+{
+ areaSets_.push_back(newAreaSet);
+}
+
+void
+RBAModelImpl::addZoneSet(const RBAZoneSet* newZoneSet)
+{
+ zoneSets_.push_back(newZoneSet);
+}
+
+void
+RBAModelImpl::addConstraint(const RBAConstraintImpl* newConstraint)
+{
+ constraints_.push_back(newConstraint);
+}
+
+void
+RBAModelImpl::addViewContentSet(const RBAViewContentSet* newContentSet)
+{
+ viewContentSets_.push_back(newContentSet);
+}
+
+void
+RBAModelImpl::addSoundContentSet(const RBASoundContentSet* newContentSet)
+{
+ soundContentSets_.push_back(newContentSet);
+}
+
+void
+RBAModelImpl::addScene(const RBASceneImpl* newScene)
+{
+ scenes_.push_back(newScene);
+}
+
+RBASizeImpl*
+RBAModelImpl::addSizeInstance(const std::string& ownerName,
+ std::unique_ptr<RBAModelElement> newSize)
+{
+ RBASizeImpl* sizeImpl {dynamic_cast<RBASizeImpl*>(newSize.get())};
+ sizes_.push_back(sizeImpl);
+ nameToObject_[ownerName+std::string("/")+sizeImpl->getName()]
+ = std::move(newSize);
+ return sizeImpl;
+}
+
+void
+RBAModelImpl::addPositionContainer(const RBAPositionContainerImpl* newPositionContainer)
+{
+ positionContainers_.push_back(newPositionContainer);
+ areaNameToPositionContainer_[newPositionContainer->getArea()->getName()]
+ = newPositionContainer;
+}
+
+void
+RBAModelImpl::addDisplay(const RBADisplayImpl* newDisplay)
+{
+ displays_.push_back(newDisplay);
+}
+
+void
+RBAModelImpl::addLabeledElement(const std::string& label,
+ RBAModelElement* element)
+{
+ labelToElements_[label].push_back(element);
+}
+
+void
+RBAModelImpl::addLabeledConstraint(const std::string& label,
+ RBAAbstractConstraint* constraint)
+{
+ labelToConstraints_[label].push_back(constraint);
+}
+
+const std::list<const RBAModelElement*>
+RBAModelImpl::getLabeledElements(const std::string& label) const
+{
+ auto it = labelToElements_.find(label);
+ if(it != labelToElements_.end()) {
+ return it->second;
+ }
+
+ const std::list<const RBAModelElement*> emp;
+ return emp;
+}
+
+const std::list<RBAAbstractConstraint*>
+RBAModelImpl::getLabeledConstraints(const std::string& label) const
+{
+ auto it = labelToConstraints_.find(label);
+ if(it != labelToConstraints_.end()) {
+ return it->second;
+ }
+
+ const std::list<RBAAbstractConstraint*> emp;
+ return emp;
+}
+
+const RBAModelElement*
+RBAModelImpl::findLabeledElement(const std::string& label,
+ const std::string& name) const
+{
+ const std::list<const RBAModelElement*> elems {getLabeledElements(label)};
+ for(const RBAModelElement* const elem : elems) {
+ if(dynamic_cast<const RBANamedElement*>(elem)->getElementName() == name) {
+ return elem;
+ }
+ }
+
+ return nullptr;
+}
+
+void
+RBAModelImpl::addAffectedAllocsMap(const RBAModelElement* const owner, RBAAllocatable* const alloc)
+{
+ affectedAllocsMap_[owner].push_back(alloc);
+}
+
+const std::list<RBAAllocatable*>*
+RBAModelImpl::getAffectedAllocs(const RBAModelElement* const owner)
+{
+ auto itr = affectedAllocsMap_.find(owner);
+ if (itr != affectedAllocsMap_.end()) {
+ return &itr->second;
+ }
+ return nullptr;
+}
+
+}
diff --git a/src/core/model/RBAModelImpl.hpp b/src/core/model/RBAModelImpl.hpp
new file mode 100644
index 0000000..5773506
--- /dev/null
+++ b/src/core/model/RBAModelImpl.hpp
@@ -0,0 +1,221 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBAModelImplhpp
+/// @brief Model implementaion class header
+
+#ifndef RBAMODELIMPL_HPP
+#define RBAMODELIMPL_HPP
+
+#include <memory>
+#include <string>
+#include <unordered_map>
+
+#include "RBAAreaImpl.hpp"
+#include "RBAConstraintImpl.hpp"
+#include "RBADisplayImpl.hpp"
+#include "RBAExpression.hpp"
+#include "RBAModel.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAPositionContainerImpl.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBASizeImpl.hpp"
+#include "RBASoundContentImpl.hpp"
+#include "RBASoundContentStateImpl.hpp"
+#include "RBAVariable.hpp"
+#include "RBAViewContentImpl.hpp"
+#include "RBAViewContentStateImpl.hpp"
+#include "RBAZoneImpl.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBAModelImpl : public RBAModel
+{
+public:
+ RBAModelImpl()=default;
+ RBAModelImpl(const RBAModelImpl&)=delete;
+ RBAModelImpl(const RBAModelImpl&&)=delete;
+ RBAModelImpl& operator=(const RBAModelImpl&)=delete;
+ RBAModelImpl& operator=(const RBAModelImpl&&)=delete;
+ virtual ~RBAModelImpl()=default;
+
+public:
+ const RBAArea* findArea(const std::string& areaName) const override;
+ const RBAViewContent* findViewContent(const std::string& contName) const override;
+ const RBAViewContentState* findViewContentState(const std::string& stateName) const override;
+ const RBASize* findSize(const std::string& sizeName) const override;
+ const RBAZone* findZone(const std::string& zoneName) const override;
+ const RBASoundContent* findSoundContent(const std::string& contName) const override;
+ const RBASoundContentState* findSoundContentState(const std::string& stateName) const override;
+ const RBAScene* findScene(const std::string& sceneName) const override;
+ const RBADisplay* findDisplay(const std::string& displayName) const override;
+ const RBAModelElement* findModelElement(const std::string& elementName) const override;
+
+ const std::list<const RBAArea*>& getAreas() const override;
+ const std::list<const RBAViewContent*>& getViewContents() const override;
+ const std::list<const RBAViewContentState*>& getViewContentStates() const override;
+ const std::list<const RBASize*>& getSizes() const override;
+ const std::list<const RBAZone*>& getZones() const override;
+ const std::list<const RBASoundContent*>& getSoundContents() const override;
+ const std::list<const RBASoundContentState*>& getSoundContentStates() const override;
+ const std::list<const RBAScene*>& getScenes() const override;
+ const std::list<const RBAAreaSet*>& getAreaSets() const override;
+ const std::list<const RBAViewContentSet*>& getViewContentSets() const override;
+ virtual const std::list<const RBAZoneSet*>& getZoneSets() const;
+ virtual const std::list<const RBASoundContentSet*>& getSoundContentSets() const;
+ const std::list<const RBAPositionContainer*>& getPositionContainers() const override;
+ const std::list<const RBADisplay*>& getDisplays() const override;
+ std::list<RBAConstraint*>& getConstraints() override;
+
+ virtual void clearElementsStatus();
+ virtual const RBAContentState* findContentState(const std::string& stateName);
+ const RBAAllocatable* findAllocatable(const std::string& allocatableName) const;
+ const RBAContent* findContent(const std::string& contentName) const;
+ virtual const RBAAreaImpl* findAreaImpl(const std::string& areaName) const;
+ virtual const RBAViewContentImpl* findViewContentImpl(const std::string& contName) const;
+ virtual const RBAViewContentStateImpl* findViewContentStateImpl(const std::string& stateName) const;
+ virtual const RBASizeImpl* findSizeImpl(const std::string& sizeName) const;
+ virtual const RBAZoneImpl* findZoneImpl(const std::string& zoneName) const;
+ virtual const RBASoundContentImpl* findSoundContentImpl(const std::string& contName) const;
+ virtual const RBASoundContentStateImpl* findSoundContentStateImpl(const std::string& stateName) const;
+ virtual const RBASceneImpl* findSceneImpl(const std::string& sceneName) const;
+ virtual const RBADisplayImpl* findDisplayImpl(const std::string& displayName) const;
+ virtual const RBAModelElement* findModelElementImpl(const std::string& elementName) const;
+
+ virtual const std::list<const RBAAllocatable*>& getAllocatables() const;
+ virtual const std::list<const RBAContent*>& getContents() const;
+ virtual const std::list<const RBAContentState*>& getContentStates() const;
+
+ virtual const std::list<const RBAAreaImpl*>& getAreaImpls() const;
+ virtual const std::list<const RBAViewContentImpl*>& getViewContentImpls() const;
+ virtual const std::list<const RBAViewContentStateImpl*>& getViewContentStateImpls() const;
+ virtual const std::list<const RBASizeImpl*>& getSizeImpls() const;
+ virtual const std::list<const RBAZoneImpl*>& getZoneImpls() const;
+ virtual const std::list<const RBASoundContentImpl*>& getSoundContentImpls() const;
+ virtual const std::list<const RBASoundContentStateImpl*>& getSoundContentStateImpls() const;
+ virtual const std::list<const RBASceneImpl*>& getSceneImpls() const;
+ virtual const std::list<const RBAPositionContainerImpl*>& getPositionContainerImpls() const;
+ virtual const std::list<const RBADisplayImpl*>& getDisplayImpls() const;
+
+ virtual void createSortedAllocatables();
+
+ virtual RBAConstraintImpl* findConstraintImpl(const std::string& consName) const;
+ virtual const RBAAreaSet* findAreaSetImpl(const std::string& areaSetName) const;
+ virtual const RBAZoneSet* findZoneSetImpl(const std::string& zoneSetName) const;
+ virtual const RBAViewContentSet* findViewContentSetImpl(const std::string& contSetName) const;
+ virtual const RBASoundContentSet* findSoundContentSetImpl(const std::string& contSetName) const;
+ virtual const RBAPositionContainerImpl* findPositionContainerImpl(const std::string& areaName) const;
+
+ virtual std::list<const RBAConstraintImpl*>& getConstraintImpls();
+ virtual const std::list<const RBAAreaSet*>& getAreaSetImpls() const;
+ virtual const std::list<const RBAZoneSet*>& getZoneSetImpls() const;
+ virtual const std::list<const RBAViewContentSet*>& getViewContentSetImpls() const;
+ virtual const std::list<const RBASoundContentSet*>& getSoundContentSetImpls() const;
+ // Do not set to const because the internal state is changed by arbitration
+ // processing
+ virtual std::list<RBAAllocatable*>& getSortedAllocatables();
+
+ virtual RBAModelElement* addModelElement(std::unique_ptr<RBAModelElement> newElement);
+ virtual RBANamedElement* addNamedElement(std::unique_ptr<RBAModelElement> newElement);
+ virtual RBASizeImpl* addSizeInstance(const std::string& ownerName,
+ std::unique_ptr<RBAModelElement> newSize);
+
+ virtual void addAllocatable(const RBAAllocatable* newAlloc);
+ virtual void addContent(const RBAContent* newContent);
+ virtual void addContentState(const RBAContentState* newState);
+ virtual void addAreaSet(const RBAAreaSet* newAreaSet);
+ virtual void addZoneSet(const RBAZoneSet* newZoneSet);
+ virtual void addConstraint(const RBAConstraintImpl* newConstraint);
+ virtual void addViewContentSet(const RBAViewContentSet* newContentSet);
+ virtual void addSoundContentSet(const RBASoundContentSet* newContentSet);
+ virtual void addScene(const RBASceneImpl* newScene);
+ virtual void addPositionContainer(const RBAPositionContainerImpl* newPositionContainer);
+ virtual void addDisplay(const RBADisplayImpl* newDisplay);
+ /// Add element with label
+ virtual void addLabeledElement(const std::string& label,
+ RBAModelElement* element);
+ /// Add constraint expression with label
+ virtual void addLabeledConstraint(const std::string& label,
+ RBAAbstractConstraint* constraint);
+
+ /// Add element list with label
+ virtual const std::list<const RBAModelElement*> getLabeledElements(const std::string& label) const;
+ /// Add constraint expression list with label
+ virtual const std::list<RBAAbstractConstraint*> getLabeledConstraints(const std::string& label) const;
+ /// Search element with label
+ virtual const RBAModelElement* findLabeledElement(const std::string& label,
+ const std::string& name) const;
+
+ // Add to Allcatable map
+ void addAffectedAllocsMap(const RBAModelElement* const owner, RBAAllocatable* const alloc);
+ // Get affected Allocatable list
+ const std::list<RBAAllocatable*>* getAffectedAllocs(const RBAModelElement* const owner);
+
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::list<const RBAAllocatable*> allocatables_;
+ std::list<const RBAContent*> contents_;
+ std::list<const RBAContentState*> contentStates_;
+ std::list<const RBAAreaImpl*> areas_;
+ std::list<const RBAViewContentImpl*> viewContents_;
+ std::list<const RBAViewContentStateImpl*> viewContentStates_;
+ std::list<const RBASizeImpl*> sizes_;
+ std::list<const RBAZoneImpl*> zones_;
+ std::list<const RBASoundContentImpl*> soundContents_;
+ std::list<const RBASoundContentStateImpl*> soundContentStates_;
+ std::list<const RBAConstraintImpl*> constraints_;
+ std::list<const RBAAreaSet*> areaSets_;
+ std::list<const RBAZoneSet*> zoneSets_;
+ std::list<const RBASceneImpl*> scenes_;
+ std::list<const RBAViewContentSet*> viewContentSets_;
+ std::list<const RBASoundContentSet*> soundContentSets_;
+ std::list<const RBAPositionContainerImpl*> positionContainers_;
+ std::list<const RBADisplayImpl*> displays_;
+
+ // Do not set to const because the internal state is changed by arbitration
+ // processing
+ std::list<RBAAllocatable*> sortedAllocatables_;
+
+ // For storing objects not managed by name
+ // expression, variable are applicable.
+ std::list<std::unique_ptr<RBAModelElement>> unnamedObjects_;
+
+ // Managing RBARuleObject and RBASize
+ std::unordered_map<std::string, std::unique_ptr<RBAModelElement>> nameToObject_;
+ // Position container is managed by map paired with Area name
+ std::unordered_map<std::string, const RBAPositionContainerImpl*> areaNameToPositionContainer_;
+
+ // Managing Labeled element model for extensions
+ std::unordered_map<std::string, std::list<const RBAModelElement*>> labelToElements_;
+ // Managing Labeled Constraint Expressions for extensions
+ std::unordered_map<std::string, std::list<RBAAbstractConstraint*>> labelToConstraints_;
+
+ // Allocatable map
+ std::unordered_map<const RBAModelElement*, std::list<RBAAllocatable*>> affectedAllocsMap_;
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBANamedElement.cpp b/src/core/model/RBANamedElement.cpp
new file mode 100644
index 0000000..9bfd1c0
--- /dev/null
+++ b/src/core/model/RBANamedElement.cpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * NamedElement clsass
+ */
+
+#include "RBANamedElement.hpp"
+
+namespace rba
+{
+
+RBANamedElement::RBANamedElement(const std::string& newName)
+ : RBAModelElement(),
+ name_(newName)
+{
+}
+
+std::string
+RBANamedElement::getUniqueName() const
+{
+ return getElementName();
+}
+
+const std::string&
+RBANamedElement::getElementName() const
+{
+ return name_;
+}
+
+const std::string&
+RBANamedElement::getDynamicName() const
+{
+ return dynamic_name_;
+}
+
+void
+RBANamedElement::setDynamicName(const std::string& newName)
+{
+ dynamic_name_ = newName;
+}
+}
diff --git a/src/core/model/RBANamedElement.hpp b/src/core/model/RBANamedElement.hpp
new file mode 100644
index 0000000..81db36d
--- /dev/null
+++ b/src/core/model/RBANamedElement.hpp
@@ -0,0 +1,60 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * NamedElement clsass header
+ */
+
+#ifndef RBANAMEDELEMENT_HPP
+#define RBANAMEDELEMENT_HPP
+
+#include <string>
+#include "RBAModelElement.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBANamedElement : public RBAModelElement
+{
+protected:
+ explicit RBANamedElement(const std::string& newName = "");
+ RBANamedElement(const RBANamedElement&)=delete;
+ RBANamedElement(const RBANamedElement&&)=delete;
+ RBANamedElement& operator=(const RBANamedElement&)=delete;
+ RBANamedElement& operator=(const RBANamedElement&&)=delete;
+
+public:
+ virtual ~RBANamedElement()=default;
+ virtual std::string getUniqueName() const;
+ const std::string& getElementName() const;
+ const std::string& getDynamicName() const;
+ void setDynamicName(const std::string& newName);
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ const std::string name_;
+ std::string dynamic_name_;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBARuleObject.cpp b/src/core/model/RBARuleObject.cpp
new file mode 100644
index 0000000..62aa1a5
--- /dev/null
+++ b/src/core/model/RBARuleObject.cpp
@@ -0,0 +1,105 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * RuleObject class
+ */
+
+#include <string>
+#include <unordered_map>
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+RBARuleObject::RBARuleObject(const std::string& name)
+ : RBANamedElement{name}
+{
+}
+
+bool
+RBARuleObject::isPrevious() const
+{
+ return false;
+}
+
+const RBARuleObject*
+RBARuleObject::getRawObject() const
+{
+ return this;
+}
+
+void RBARuleObject::addTag(const std::string& tag)
+{
+ static_cast<void>(tags_.insert(tag));
+}
+
+bool RBARuleObject::containsTag(const std::string& tag) const
+{
+ return (tags_.find(tag) != tags_.end());
+}
+
+void RBARuleObject::addMember(RBARuleObject* member)
+{
+ members_[member->getElementName()] = member;
+}
+
+const RBARuleObject* RBARuleObject::getMember(const std::string& memberName) const
+{
+ if (members_.find(memberName) != members_.end()) {
+ return (members_.at(memberName));
+ } else {
+ return nullptr;
+ }
+}
+
+void RBARuleObject::addMember(const std::string& memberName, RBARuleObject* const val)
+{
+ members_[memberName] = val;
+}
+
+RBARuleObject*
+RBARuleObject::getOwner() const
+{
+ return owner_;
+}
+
+void
+RBARuleObject::setOwner(RBARuleObject* owner)
+{
+ owner_ = owner;
+}
+
+std::string
+RBARuleObject::getUniqueName() const
+{
+ if (owner_ != nullptr) {
+ // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2)
+ // [Contents that deviate from the rules]
+ // Calling getUniqueName() recursively.
+ // [Reason that there is no problem if the rule is deviated]
+ //  Since the number of elements in the rule model is finite and
+ // there is no cyclic relationship, stack overflow does not occur.
+ return owner_->getUniqueName() + "/" + getElementName();
+ }
+ return getElementName();
+}
+
+const std::unordered_map<std::string, RBARuleObject*>& RBARuleObject::getMembers() const
+{
+ return members_;
+}
+
+}
diff --git a/src/core/model/RBARuleObject.hpp b/src/core/model/RBARuleObject.hpp
new file mode 100644
index 0000000..3f03ddc
--- /dev/null
+++ b/src/core/model/RBARuleObject.hpp
@@ -0,0 +1,73 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * RuleObject class header
+ */
+
+#ifndef RBARULEOBJECT_HPP
+#define RBARULEOBJECT_HPP
+
+#include <unordered_map>
+#include <unordered_set>
+#include <string>
+
+#include "RBANamedElement.hpp"
+
+namespace rba
+{
+
+class DLL_EXPORT RBARuleObject : public RBANamedElement
+{
+protected:
+ explicit RBARuleObject(const std::string& name="");
+ RBARuleObject(const RBARuleObject&)=delete;
+ RBARuleObject(const RBARuleObject&&)=delete;
+ RBARuleObject& operator=(const RBARuleObject&)=delete;
+ RBARuleObject& operator=(const RBARuleObject&&)=delete;
+
+public:
+ virtual ~RBARuleObject()=default;
+ virtual bool isPrevious() const;
+ virtual const RBARuleObject* getRawObject() const;
+ bool containsTag(const std::string& tag) const;
+ void addTag(const std::string& tag);
+ virtual void addMember(RBARuleObject* member);
+ virtual const RBARuleObject* getMember(const std::string& memberName) const;
+ RBARuleObject* getOwner() const;
+ virtual void setOwner(RBARuleObject* owner);
+ std::string getUniqueName() const override;
+
+protected:
+ void addMember(const std::string& memberName, RBARuleObject* const val);
+ const std::unordered_map<std::string, RBARuleObject*>& getMembers() const;
+
+private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4251)
+#endif
+ std::unordered_set<std::string> tags_;
+ std::unordered_map<std::string, RBARuleObject*> members_;
+ RBARuleObject* owner_ {nullptr};
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBARuleObjectMaker.cpp b/src/core/model/RBARuleObjectMaker.cpp
new file mode 100644
index 0000000..7b384e1
--- /dev/null
+++ b/src/core/model/RBARuleObjectMaker.cpp
@@ -0,0 +1,62 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBARuleObjectMaker.cpp
+/// @brief RuleObject generator class
+
+#include "RBARuleObjectMaker.hpp"
+#include "RBARuleObject.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAModelFactory.hpp"
+
+namespace rba
+{
+
+RBARuleObjectMaker::RBARuleObjectMaker(const std::string& label)
+ : RBAModelElementMaker{label}
+{
+}
+
+RBAModelElement*
+RBARuleObjectMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ const auto ruleObj = dynamic_cast<RBARuleObject*>(element);
+
+ // Tag
+ const RBAJsonElement* const tags {jsonElem->findChildren("tags")};
+ if (tags != nullptr) {
+ for (const auto& tag : tags->getChildren()) {
+ const RBAJsonElement* const tagName {tag->findChildren("name")};
+ if (tagName != nullptr) {
+ ruleObj->addTag(tagName->getString());
+ }
+ }
+ }
+
+ // owner
+ const auto ownerRuleObj = dynamic_cast<RBARuleObject*>(owner);
+ if (ownerRuleObj != nullptr) {
+ ruleObj->setOwner(ownerRuleObj);
+ }
+
+ return ruleObj;
+}
+
+}
diff --git a/src/core/model/RBARuleObjectMaker.hpp b/src/core/model/RBARuleObjectMaker.hpp
new file mode 100644
index 0000000..661b0b7
--- /dev/null
+++ b/src/core/model/RBARuleObjectMaker.hpp
@@ -0,0 +1,52 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBARuleObjectMaker.cpp
+/// @brief RuleObject generator class header
+
+#ifndef RBARULEOBJECTMAKER_HPP
+#define RBARULEOBJECTMAKER_HPP
+
+#include "RBAModelElementMaker.hpp"
+
+namespace rba
+{
+
+/// @brief RuleObject generator class header
+class DLL_EXPORT RBARuleObjectMaker : public RBAModelElementMaker
+{
+public:
+ explicit RBARuleObjectMaker(const std::string& label="");
+ RBARuleObjectMaker(const RBARuleObjectMaker&)=delete;
+ RBARuleObjectMaker(const RBARuleObjectMaker&&)=delete;
+ RBARuleObjectMaker& operator=(const RBARuleObjectMaker&)=delete;
+ RBARuleObjectMaker& operator=(const RBARuleObjectMaker&&)=delete;
+ virtual ~RBARuleObjectMaker()=default;
+
+protected:
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBASceneImpl.cpp b/src/core/model/RBASceneImpl.cpp
new file mode 100644
index 0000000..82ecab2
--- /dev/null
+++ b/src/core/model/RBASceneImpl.cpp
@@ -0,0 +1,113 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Scene implementation class
+ */
+
+#include "RBASceneImpl.hpp"
+#include "RBAModelElementType.hpp"
+#include "RBAAbstractProperty.hpp"
+#include "RBAIntegerProperty.hpp"
+
+namespace rba
+{
+
+RBASceneImpl::RBASceneImpl(const std::string& name)
+ : RBAScene(),
+ RBARuleObject{name}
+{
+}
+
+std::string
+RBASceneImpl::getName() const
+{
+ return RBARuleObject::getElementName();
+}
+
+RBAModelElementType
+RBASceneImpl::getModelElementType() const
+{
+ return RBAModelElementType::Scene;
+}
+
+bool
+RBASceneImpl::isGlobal() const
+{
+ return global_;
+}
+
+const std::list<std::string>&
+RBASceneImpl::getPropertyNames() const
+{
+ return propertyNames_;
+}
+
+std::int32_t
+RBASceneImpl::getPropertyValue(const std::string& propertyName) const
+{
+ const RBAAbstractProperty* const prop {getProperty(propertyName)};
+ if(prop == nullptr) {
+ // Returns "-1" if the property is not registered
+ return -1;
+ }
+
+ // Returns default value
+ return prop->getValue();
+}
+
+const RBARuleObject* RBASceneImpl::getMember(const std::string& memberName) const
+{
+ return getProperty(memberName);
+}
+
+const RBAAbstractProperty*
+RBASceneImpl::getProperty(const std::string& propertyName) const
+{
+ auto p = nameToProperty_.find(propertyName);
+ if(p == nameToProperty_.end()) {
+ // Returns nullptr if the property is not registered
+ return nullptr;
+ }
+
+ return p->second;
+}
+
+void
+RBASceneImpl::setGlobal(const bool newGlobal)
+{
+ global_ = newGlobal;
+}
+
+const RBAAbstractProperty*
+RBASceneImpl::addProperty(const std::string& newName, std::int32_t newValue)
+{
+ auto p = nameToProperty_.find(newName);
+ if(p != nameToProperty_.end()) {
+ // No operation if the property is registered
+ return p->second;
+ }
+
+ // Registration
+ properties_.push_back(std::make_unique<RBAIntegerProperty>(this,
+ newName,
+ newValue));
+ propertyNames_.push_back(newName);
+ nameToProperty_[newName] = properties_.back().get();
+
+ return properties_.back().get();
+}
+
+}
diff --git a/src/core/model/RBASceneImpl.hpp b/src/core/model/RBASceneImpl.hpp
new file mode 100644
index 0000000..dd1fe3a
--- /dev/null
+++ b/src/core/model/RBASceneImpl.hpp
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Scene implementation class header
+ */
+
+#ifndef RBASCENEIMPL_HPP
+#define RBASCENEIMPL_HPP
+
+#include <memory>
+#include "RBAScene.hpp"
+#include "RBARuleObject.hpp"
+
+namespace rba
+{
+
+class RBAAbstractProperty;
+
+class RBASceneImpl : public RBAScene, public RBARuleObject
+{
+public:
+ explicit RBASceneImpl(const std::string& name="");
+ RBASceneImpl(const RBASceneImpl&)=delete;
+ RBASceneImpl(const RBASceneImpl&&)=delete;
+ RBASceneImpl& operator=(const RBASceneImpl&)=delete;
+ RBASceneImpl& operator=(const RBASceneImpl&&)=delete;
+ virtual ~RBASceneImpl()=default;
+
+public:
+ std::string getName() const override;
+ RBAModelElementType getModelElementType() const override;
+ bool isGlobal() const override;
+ const std::list<std::string>& getPropertyNames() const override;
+ std::int32_t getPropertyValue(const std::string& propertyName) const override;
+ const RBARuleObject* getMember(const std::string& memberName) const override;
+ const RBAAbstractProperty* getProperty(const std::string& propertyName) const;
+
+ void setGlobal(const bool newGlobal);
+ const RBAAbstractProperty* addProperty(const std::string& newName,
+ std::int32_t newValue);
+
+private:
+ bool global_ {false};
+ // Used to get property name in RBAScene
+ std::list<std::string> propertyNames_;
+ std::list<std::unique_ptr<RBAAbstractProperty>> properties_;
+ std::unordered_map<std::string, RBAAbstractProperty*> nameToProperty_;
+};
+
+}
+
+#endif
diff --git a/src/core/model/RBASceneMaker.cpp b/src/core/model/RBASceneMaker.cpp
new file mode 100644
index 0000000..9c55f84
--- /dev/null
+++ b/src/core/model/RBASceneMaker.cpp
@@ -0,0 +1,74 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBASceneMaker.cpp
+/// @brief Scene object generator class
+
+#include "RBASceneMaker.hpp"
+#include "RBASceneImpl.hpp"
+#include "RBAJsonElement.hpp"
+#include "RBAModelElement.hpp"
+#include "RBAModelImpl.hpp"
+#include "RBAAbstractProperty.hpp"
+
+namespace rba
+{
+
+RBASceneMaker::RBASceneMaker()
+ : RBARuleObjectMaker{"scenes"}
+{
+}
+
+std::unique_ptr<RBAModelElement>
+RBASceneMaker::createInstance(const std::string& name)
+{
+ return std::make_unique<RBASceneImpl>(name);
+}
+
+RBAModelElement*
+RBASceneMaker::setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner)
+{
+ static_cast<void>(RBARuleObjectMaker::setProperty(element, jsonElem, model, owner));
+
+ RBASceneImpl* const scene {dynamic_cast<RBASceneImpl*>(element)};
+
+ // Set global
+ const std::string global {jsonElem->findChildren("global")->getString()};
+ if(global == "true") {
+ scene->setGlobal(true);
+ }
+ else {
+ scene->setGlobal(false);
+ }
+
+ // Set property
+ const RBAJsonElement* const properties {jsonElem->findChildren("property")};
+ if(properties != nullptr) {
+ for(const auto& property : properties->getChildren()) {
+ const std::string propertyName {property->findChildren("name")->getString()};
+ const std::int32_t value {property->findChildren("value")->getInt()};
+ static_cast<void>(scene->addProperty(propertyName, value));
+ }
+ }
+
+ model->addScene(scene);
+
+ return scene;
+}
+
+}
diff --git a/src/core/model/RBASceneMaker.hpp b/src/core/model/RBASceneMaker.hpp
new file mode 100644
index 0000000..6d2ea5e
--- /dev/null
+++ b/src/core/model/RBASceneMaker.hpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (c) 2019 DENSO CORPORATION.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/// @file RBASceneMaker.hpp
+/// @brief Scene object generator class header
+
+#ifndef RBASCENEMAKER_HPP
+#define RBASCENEMAKER_HPP
+
+#include "RBARuleObjectMaker.hpp"
+
+namespace rba
+{
+
+/// @brief Scene object generator class
+class RBASceneMaker : public RBARuleObjectMaker
+{
+public:
+ RBASceneMaker();
+ RBASceneMaker(const RBASceneMaker&)=delete;
+ RBASceneMaker(const RBASceneMaker&&)=delete;
+ RBASceneMaker& operator=(const RBASceneMaker&)=delete;
+ RBASceneMaker& operator=(const RBASceneMaker&&)=delete;
+ virtual ~RBASceneMaker()=default;
+
+protected:
+ /// @brief Create an empty instance
+ /// @details Create an empty instance of unique_ptr in derived class
+ /// @return unique_ptr for insitance
+ std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override;
+
+ /// @brief Set model element attributes for each derived class
+ /// @param[in] jsonElem JSON element of ModelElement
+ /// @param[in] model The model to store generated RBARuleObjectMaker
+ /// @param[in,out] owner Parent object (Not in use)
+ RBAModelElement* setProperty(RBAModelElement* element,
+ const RBAJsonElement* jsonElem,
+ RBAModelImpl* model,
+ RBAModelElement* owner=nullptr) override;
+
+};
+
+}
+
+#endif