diff options
Diffstat (limited to 'src/sound')
56 files changed, 3570 insertions, 0 deletions
diff --git a/src/sound/RBAAllInstanceOfSoundContent.cpp b/src/sound/RBAAllInstanceOfSoundContent.cpp new file mode 100644 index 0000000..181fb7b --- /dev/null +++ b/src/sound/RBAAllInstanceOfSoundContent.cpp @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * AllInstanceOfSoundContent class + */ + +#include "RBAAllInstanceOfSoundContent.hpp" +#include "RBASoundContentImpl.hpp" +#include "RBAArbitrator.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +void +RBAAllInstanceOfSoundContent::accept(RBAExpressionVisitor& visitor) +{ + // RBASceneAllocatableCollector, the only existing visitor at this time, + // does not accept this set of "For-All", "Exists", so it does not pass + // this path. + // It is implemented because another visitor may accept it in the future. + visitor.visit(*this); +} + +RBAModelElementType +RBAAllInstanceOfSoundContent::getModelElementType() const +{ + return RBAModelElementType::AllInstanceOfSoundContent; +} + +const RBARuleObject* +RBAAllInstanceOfSoundContent::getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const +{ + return &allSoundContentSet_; +} + +void +RBAAllInstanceOfSoundContent::setContents(const std::list<const RBASoundContentImpl*>& contents) +{ + for(auto& cont : contents) { + allSoundContentSet_.addTarget(cont); + } +} + +#ifdef RBA_USE_LOG +const std::string +RBAAllInstanceOfSoundContent::getExpressionText() const +{ + return "ALL_SOUNDCONTENTS"; +} + +const std::string +RBAAllInstanceOfSoundContent::getCoverageExpressionText() const +{ + return getExpressionText(); +} +#endif + +} diff --git a/src/sound/RBAAllInstanceOfSoundContent.hpp b/src/sound/RBAAllInstanceOfSoundContent.hpp new file mode 100644 index 0000000..08ea67f --- /dev/null +++ b/src/sound/RBAAllInstanceOfSoundContent.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. + */ + +/** + * AllInstanceOfSoundContent class header + */ + +#ifndef RBAALLINSRTANCEOFSOUNDCONTENTIMPL_HPP +#define RBAALLINSRTANCEOFSOUNDCONTENTIMPL_HPP + +#include "RBASetExpression.hpp" +#include "RBASoundContentSet.hpp" + +namespace rba { + +class DLL_EXPORT RBAAllInstanceOfSoundContent : public RBASetExpression +{ +public: + RBAAllInstanceOfSoundContent()=default; + RBAAllInstanceOfSoundContent(const RBAAllInstanceOfSoundContent&)=delete; + RBAAllInstanceOfSoundContent(const RBAAllInstanceOfSoundContent&&)=delete; + RBAAllInstanceOfSoundContent& operator=(const RBAAllInstanceOfSoundContent&)=delete; + RBAAllInstanceOfSoundContent& operator=(const RBAAllInstanceOfSoundContent&&)=delete; + virtual ~RBAAllInstanceOfSoundContent()=default; + +public: + void accept(RBAExpressionVisitor& visitor) override; + RBAModelElementType getModelElementType() const override; + const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const override; + void setContents(const std::list<const RBASoundContentImpl*>& contents); + + // Log +#ifdef RBA_USE_LOG + const std::string getExpressionText() const override; + const std::string getCoverageExpressionText() const override; +#endif + +private: + RBASoundContentSet allSoundContentSet_; + +}; + +} + +#endif diff --git a/src/sound/RBAAllInstanceOfSoundContentMaker.cpp b/src/sound/RBAAllInstanceOfSoundContentMaker.cpp new file mode 100644 index 0000000..b08f6b2 --- /dev/null +++ b/src/sound/RBAAllInstanceOfSoundContentMaker.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. + */ +/// @file RBAAllInstanceOfSoundContentMaker.cpp +/// @brief AllInstanceOfSoundContent object generator class + +#include <iostream> +#include "RBAAllInstanceOfSoundContentMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAAllInstanceOfSoundContent.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAAllInstanceOfSoundContentMaker::RBAAllInstanceOfSoundContentMaker() + : RBAExpressionMaker{"AllInstanceOfSoundContent"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAAllInstanceOfSoundContentMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAAllInstanceOfSoundContent>(); +} + +RBAModelElement* +RBAAllInstanceOfSoundContentMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBAAllInstanceOfSoundContent* const allSoundCont + {dynamic_cast<RBAAllInstanceOfSoundContent*>(element)}; + + // Set sound content + allSoundCont->setContents(model->getSoundContentImpls()); + + return allSoundCont; +} + +} diff --git a/src/sound/RBAAllInstanceOfSoundContentMaker.hpp b/src/sound/RBAAllInstanceOfSoundContentMaker.hpp new file mode 100644 index 0000000..ff03da6 --- /dev/null +++ b/src/sound/RBAAllInstanceOfSoundContentMaker.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 RBAAllInstanceOfSoundContentMaker.hpp +/// @brief AllInstanceOfSoundContent object generator class header + +#ifndef RBAALLINSTANCEOFSOUNDCONTENTMAKER_HPP +#define RBAALLINSTANCEOFSOUNDCONTENTMAKER_HPP + +#include "RBAExpressionMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +class RBAAllInstanceOfSoundContentMaker : public RBAExpressionMaker +{ +public: + RBAAllInstanceOfSoundContentMaker(); + RBAAllInstanceOfSoundContentMaker(const RBAAllInstanceOfSoundContentMaker&)=delete; + RBAAllInstanceOfSoundContentMaker(const RBAAllInstanceOfSoundContentMaker&&)=delete; + RBAAllInstanceOfSoundContentMaker& operator=(const RBAAllInstanceOfSoundContentMaker&)=delete; + RBAAllInstanceOfSoundContentMaker& operator=(const RBAAllInstanceOfSoundContentMaker&&)=delete; + virtual ~RBAAllInstanceOfSoundContentMaker()=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; + + /// @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/sound/RBAAllInstanceOfZone.cpp b/src/sound/RBAAllInstanceOfZone.cpp new file mode 100644 index 0000000..e50768c --- /dev/null +++ b/src/sound/RBAAllInstanceOfZone.cpp @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * AllInstanceOfZone class + */ + +#include "RBAAllInstanceOfZone.hpp" +#include "RBAZoneImpl.hpp" +#include "RBAArbitrator.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +void +RBAAllInstanceOfZone::accept(RBAExpressionVisitor& visitor) +{ + // RBASceneAllocatableCollector, the only existing visitor at this time, + // does not accept this set of "For-All", "Exists", so it does not pass + // this path. + // It is implemented because another visitor may accept it in the future. + visitor.visit(*this); +} + +RBAModelElementType +RBAAllInstanceOfZone::getModelElementType() const +{ + return RBAModelElementType::AllInstanceOfZone; +} + +const RBARuleObject* +RBAAllInstanceOfZone::getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const +{ + return &allZoneSet_; +} + +void +RBAAllInstanceOfZone::setZones(const std::list<const RBAZoneImpl*> zones) +{ + for (auto& content : zones) { + allZoneSet_.addTarget(content); + } +} + +#ifdef RBA_USE_LOG +const std::string +RBAAllInstanceOfZone::getExpressionText() const +{ + return "ALL_ZONES"; +} + +const std::string +RBAAllInstanceOfZone::getCoverageExpressionText() const +{ + return getExpressionText(); +} +#endif + +} diff --git a/src/sound/RBAAllInstanceOfZone.hpp b/src/sound/RBAAllInstanceOfZone.hpp new file mode 100644 index 0000000..73f15a4 --- /dev/null +++ b/src/sound/RBAAllInstanceOfZone.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. + */ + +/** + * AllInstanceOfZone class header + */ + +#ifndef RBAALLINSTANCEOFZONE_HPP +#define RBAALLINSTANCEOFZONE_HPP + +#include "RBASetExpression.hpp" +#include "RBAZoneSet.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAAllInstanceOfZone : public RBASetExpression +{ +public: + RBAAllInstanceOfZone()=default; + RBAAllInstanceOfZone(const RBAAllInstanceOfZone&)=delete; + RBAAllInstanceOfZone(const RBAAllInstanceOfZone&&)=delete; + RBAAllInstanceOfZone& operator=(const RBAAllInstanceOfZone&)=delete; + RBAAllInstanceOfZone& operator=(const RBAAllInstanceOfZone&&)=delete; + virtual ~RBAAllInstanceOfZone()=default; + +public: + void accept(RBAExpressionVisitor& visitor) override; + RBAModelElementType getModelElementType() const override; + const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const override; + void setZones(const std::list<const RBAZoneImpl*> zones); + + // Log +#ifdef RBA_USE_LOG + const std::string getExpressionText() const override; + const std::string getCoverageExpressionText() const override; +#endif + +private: + RBAZoneSet allZoneSet_; + +}; + +} + +#endif diff --git a/src/sound/RBAAllInstanceOfZoneMaker.cpp b/src/sound/RBAAllInstanceOfZoneMaker.cpp new file mode 100644 index 0000000..7283a7a --- /dev/null +++ b/src/sound/RBAAllInstanceOfZoneMaker.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. + */ +/// @file RBAAllInstanceOfZoneMaker.cpp +/// @brief AllInstanceOfZone object generator class + +#include <iostream> +#include "RBAAllInstanceOfZoneMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAAllInstanceOfZone.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAAllInstanceOfZoneMaker::RBAAllInstanceOfZoneMaker() + : RBAExpressionMaker{"AllInstanceOfZone"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAAllInstanceOfZoneMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAAllInstanceOfZone>(); +} + +RBAModelElement* +RBAAllInstanceOfZoneMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBAAllInstanceOfZone* const allInstZone + {dynamic_cast<RBAAllInstanceOfZone*>(element)}; + + // Set zone + allInstZone->setZones(model->getZoneImpls()); + + return allInstZone; +} + +} diff --git a/src/sound/RBAAllInstanceOfZoneMaker.hpp b/src/sound/RBAAllInstanceOfZoneMaker.hpp new file mode 100644 index 0000000..738a95e --- /dev/null +++ b/src/sound/RBAAllInstanceOfZoneMaker.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. + */ +/// @file RBAAllInstanceOfZoneMaker.hpp +/// @brief AllInstanceOfZone object generator class header + +#ifndef RBAALLINSTANCEOFZONEMAKER_HPP +#define RBAALLINSTANCEOFZONEMAKER_HPP + +#include "RBAExpressionMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief AllInstanceOfZone object generator class +class RBAAllInstanceOfZoneMaker : public RBAExpressionMaker +{ +public: + RBAAllInstanceOfZoneMaker(); + RBAAllInstanceOfZoneMaker(const RBAAllInstanceOfZoneMaker&)=delete; + RBAAllInstanceOfZoneMaker(const RBAAllInstanceOfZoneMaker&&)=delete; + RBAAllInstanceOfZoneMaker& operator=(const RBAAllInstanceOfZoneMaker&)=delete; + RBAAllInstanceOfZoneMaker& operator=(const RBAAllInstanceOfZoneMaker&&)=delete; + virtual ~RBAAllInstanceOfZoneMaker()=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; + + /// @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/sound/RBAIsAttenuated.cpp b/src/sound/RBAIsAttenuated.cpp new file mode 100644 index 0000000..cf55890 --- /dev/null +++ b/src/sound/RBAIsAttenuated.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. + */ +/// IsAttenuated class + +#include "RBAIsAttenuated.hpp" + +#include "RBAExpression.hpp" +#include "RBAZoneImpl.hpp" +#include "RBAArbitrator.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAResultImpl.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAExpressionType.hpp" +#include "RBAConstraintInfo.hpp" + +namespace rba +{ + +void +RBAIsAttenuated::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsAttenuated::getModelElementType() const +{ + return RBAModelElementType::IsAttenuated; +} + +bool +RBAIsAttenuated::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() ) || (ruleObj == nullptr)) { + info->setExceptionBeforeArbitrate(true); + } else { + const RBAZoneImpl* const zone {dynamic_cast<const RBAZoneImpl*>(ruleObj->getRawObject())}; + info->addOperandAllocatable(zone); + if (ruleObj->isPrevious() == true) { + isPassed = arb->getResult()->isPreAttenuated(zone); + } else { + if (zone->isAttenuateChecked() == true) { + isPassed = zone->isAttenuated(); + if (isPassed == true) { + info->addTrueAllocatable(zone); + } else { + info->addFalseAllocatable(zone); + } + } else { + info->setExceptionBeforeArbitrate(true); + } + } + } +#ifdef RBA_USE_LOG + if (ruleObj != nullptr) { + const RBAZoneImpl* zone = dynamic_cast<const RBAZoneImpl*>(ruleObj + ->getRawObject()); + if (info->isExceptionBeforeArbitrate() == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + zone->getName() + + getSymbol() + "] before arbitrate skip"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::SKIP); + } else if (isPassed == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + zone->getName() + + getSymbol() + "] true"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + zone->getName() + + getSymbol() + "] false"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::FALSE); + } + } else { + // At the moment, there is no expression that returns null as an Allocable, + // so it will not go through this path. + // This is implmented because we may add an expression that returns null, + // in the future. + if (info->isExceptionBeforeArbitrate() == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + "NULL" + getSymbol() + + "] before arbitrate skip"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::SKIP); + } else { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + "NULL" + getSymbol() + + "] false"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::FALSE); + } + } +#endif + LOG_removeHierarchy(); + return isPassed; +} + +#ifdef RBA_USE_LOG +const std::string +RBAIsAttenuated::getSymbol() const +{ + return ".isAttenuated()"; +} + +RBAExpressionType +RBAIsAttenuated::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/sound/RBAIsAttenuated.hpp b/src/sound/RBAIsAttenuated.hpp new file mode 100644 index 0000000..2ed62b2 --- /dev/null +++ b/src/sound/RBAIsAttenuated.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. + */ +/** + * IsAttenuated class header + */ + +#ifndef RBAISATTENUATED_HPP +#define RBAISATTENUATED_HPP + +#include "RBAZoneOperator.hpp" + +namespace rba +{ + +class RBAExpression; + +class DLL_EXPORT RBAIsAttenuated : public RBAZoneOperator +{ +public: + RBAIsAttenuated()=default; + RBAIsAttenuated(const RBAIsAttenuated&)=delete; + RBAIsAttenuated(const RBAIsAttenuated&&)=delete; + RBAIsAttenuated& operator=(const RBAIsAttenuated&)=delete; + RBAIsAttenuated& operator=(const RBAIsAttenuated&&)=delete; + virtual ~RBAIsAttenuated()=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/sound/RBAIsAttenuatedMaker.cpp b/src/sound/RBAIsAttenuatedMaker.cpp new file mode 100644 index 0000000..625d4f2 --- /dev/null +++ b/src/sound/RBAIsAttenuatedMaker.cpp @@ -0,0 +1,41 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 RBAIsAttenuatedMaker.cpp +/// @brief IsAttenuated object generator class + +#include <iostream> +#include "RBAIsAttenuatedMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsAttenuated.hpp" + +namespace rba +{ + +RBAIsAttenuatedMaker::RBAIsAttenuatedMaker() + : RBAOperatorMaker{"IsAttenuated"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsAttenuatedMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsAttenuated>(); +} + +} diff --git a/src/sound/RBAIsAttenuatedMaker.hpp b/src/sound/RBAIsAttenuatedMaker.hpp new file mode 100644 index 0000000..30b9132 --- /dev/null +++ b/src/sound/RBAIsAttenuatedMaker.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 RBAIsAttenuatedMaker.hpp +/// @brief IsAttenuated object generator class header + +#ifndef RBAISATTENUATEDMAKER_HPP +#define RBAISATTENUATEDMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsAttenuated object generator class +class RBAIsAttenuatedMaker : public RBAOperatorMaker +{ +public: + RBAIsAttenuatedMaker(); + RBAIsAttenuatedMaker(const RBAIsAttenuatedMaker&)=delete; + RBAIsAttenuatedMaker(const RBAIsAttenuatedMaker&&)=delete; + RBAIsAttenuatedMaker& operator=(const RBAIsAttenuatedMaker&)=delete; + RBAIsAttenuatedMaker& operator=(const RBAIsAttenuatedMaker&&)=delete; + virtual ~RBAIsAttenuatedMaker()=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/sound/RBAIsMuted.cpp b/src/sound/RBAIsMuted.cpp new file mode 100644 index 0000000..1555137 --- /dev/null +++ b/src/sound/RBAIsMuted.cpp @@ -0,0 +1,124 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsMuted class + +#include "RBAIsMuted.hpp" +#include "RBAArbitrator.hpp" +#include "RBAResultImpl.hpp" +#include "RBAAllocatable.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAExpressionType.hpp" +#include "RBAConstraintInfo.hpp" + +namespace rba +{ + +void +RBAIsMuted::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsMuted::getModelElementType() const +{ + return RBAModelElementType::IsMuted; +} + +bool +RBAIsMuted::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()) || (ruleObj == nullptr)) { + info->setExceptionBeforeArbitrate(true); + } else { + const RBAAllocatable* const zone {dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())}; + info->addOperandAllocatable(zone); + if (ruleObj->isPrevious() == false) { + if (zone->isHiddenChecked() == false) { + info->setExceptionBeforeArbitrate(true); + } else if (zone->isHidden() == true) { + isPassed = true; + info->addTrueAllocatable(zone); + } else { + info->addFalseAllocatable(zone); + } + } else { + isPassed = arb->getResult()->isPreHidden(zone); + } + } +#ifdef RBA_USE_LOG + if (ruleObj != nullptr) { + const RBAAllocatable* zone = dynamic_cast<const RBAAllocatable*>(ruleObj + ->getRawObject()); + if (info->isExceptionBeforeArbitrate() == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + zone->getElementName() + getSymbol() + + "] before arbitrate skip"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::SKIP); + } else if (isPassed == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + zone->getElementName() + + getSymbol() + "] true"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + zone->getElementName() + + getSymbol() + "] false"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::FALSE); + } + } else { + // At the moment, there is no expression that returns null as an Allocable, + // so it will not go through this path. + // This is implmented because we may add an expression that returns null, + // in the future. + LOG_arbitrateConstraintLogicLogLine( + " [NULL" + getSymbol() + "] 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 +RBAIsMuted::getSymbol() const +{ + return ".isMuted()"; +} + +RBAExpressionType +RBAIsMuted::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/sound/RBAIsMuted.hpp b/src/sound/RBAIsMuted.hpp new file mode 100644 index 0000000..71b9d94 --- /dev/null +++ b/src/sound/RBAIsMuted.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. + */ +/** + * IsMuted class header + */ + +#ifndef RBAISMUTED_HPP +#define RBAISMUTED_HPP + +#include <string> +#include "RBAZoneOperator.hpp" + +namespace rba +{ + +class RBAExpression; + +class DLL_EXPORT RBAIsMuted : public RBAZoneOperator +{ +public: + RBAIsMuted()=default; + RBAIsMuted(const RBAIsMuted&)=delete; + RBAIsMuted(const RBAIsMuted&&)=delete; + RBAIsMuted& operator=(const RBAIsMuted&)=delete; + RBAIsMuted& operator=(const RBAIsMuted&&)=delete; + virtual ~RBAIsMuted()=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/sound/RBAIsMutedMaker.cpp b/src/sound/RBAIsMutedMaker.cpp new file mode 100644 index 0000000..8165635 --- /dev/null +++ b/src/sound/RBAIsMutedMaker.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. + */ +/// @file RBAIsMutedMaker.cpp +/// @brief IsMuted object generator class + +#include "RBAIsMutedMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsMuted.hpp" + +namespace rba +{ + +RBAIsMutedMaker::RBAIsMutedMaker() + : RBAOperatorMaker{"IsMuted"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsMutedMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsMuted>(); +} + +} diff --git a/src/sound/RBAIsMutedMaker.hpp b/src/sound/RBAIsMutedMaker.hpp new file mode 100644 index 0000000..3f954c5 --- /dev/null +++ b/src/sound/RBAIsMutedMaker.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 RBAIsMutedMaker.hpp +/// @brief IsMuted object generator class header + +#ifndef RBAISMUTEDMAKER_HPP +#define RBAISMUTEDMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsMuted object generator class +class RBAIsMutedMaker : public RBAOperatorMaker +{ +public: + RBAIsMutedMaker(); + RBAIsMutedMaker(const RBAIsMutedMaker&)=delete; + RBAIsMutedMaker(const RBAIsMutedMaker&&)=delete; + RBAIsMutedMaker& operator=(const RBAIsMutedMaker&)=delete; + RBAIsMutedMaker& operator=(const RBAIsMutedMaker&&)=delete; + virtual ~RBAIsMutedMaker()=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/sound/RBAIsOutputted.cpp b/src/sound/RBAIsOutputted.cpp new file mode 100644 index 0000000..f99d8d5 --- /dev/null +++ b/src/sound/RBAIsOutputted.cpp @@ -0,0 +1,144 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsOutputted class + +#include "RBAIsOutputted.hpp" +#include "RBAArbitrator.hpp" +#include "RBAZoneImpl.hpp" +#include "RBAResultImpl.hpp" +#include "RBAContentState.hpp" +#include "RBAContent.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAExpressionType.hpp" +#include "RBAConstraintInfo.hpp" + +namespace rba +{ + +void +RBAIsOutputted::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsOutputted::getModelElementType() const +{ + return RBAModelElementType::IsOutputted; +} + +bool +RBAIsOutputted::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()) || (ruleObj == nullptr)) { + info->setExceptionBeforeArbitrate(true); + } else { + const RBAAllocatable* const zone {dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())}; + info->addOperandAllocatable(zone); + if (ruleObj->isPrevious() == true) { + if ((arb->getResult()->isPreHidden(zone) == false) + && (arb->getResult()->getPreAllocatedContentState(zone) != nullptr)) { + isPassed = true; + } + } else { + if ((zone->isHiddenChecked()==true) && (zone->isHidden()==true)) { + info->addFalseAllocatable(zone); + } else { + if (zone->isChecked()) { + if (zone->getState() != nullptr) { + info->clearFalseAllocatable(); + info->addTrueAllocatable(zone); + isPassed = true; + } else { + info->addFalseAllocatable(zone); + } + } else { + info->setExceptionBeforeArbitrate(true); + } + } + } + } +#ifdef RBA_USE_LOG + if (ruleObj != nullptr) { + const RBAAllocatable* zone = dynamic_cast<const RBAAllocatable*>(ruleObj + ->getRawObject()); + if (info->isExceptionBeforeArbitrate() == true) { + LOG_arbitrateConstraintLogicLogLine( + " Zone[" + zone->getElementName() + + "] is before arbitrate skip"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::SKIP); + } else if (isPassed == true) { + const RBAContentState* contentState; + if (ruleObj->isPrevious() == true) { + contentState = arb->getResult()->getPreAllocatedContentState(zone); + } else { + contentState = zone->getState(); + } + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Zone[" + + zone->getElementName() + "] is Outputted Content[" + + contentState->getOwner()->getElementName() + "::" + + contentState->getElementName() + "]"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Zone[" + + zone->getElementName() + "] is not Outputted"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::FALSE); + } + } else if (info->isExceptionBeforeArbitrate() == true) { + // At the moment, there is no expression that returns null as an Allocable, + // so it will not go through this path. + // This is implmented because we may add an expression that returns null, + // in the future. + LOG_arbitrateConstraintLogicLogLine( + " Zone[NULL] is not Outputted"); + 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 +RBAIsOutputted::getSymbol() const +{ + return ".isOutputted()"; +} + +RBAExpressionType +RBAIsOutputted::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/sound/RBAIsOutputted.hpp b/src/sound/RBAIsOutputted.hpp new file mode 100644 index 0000000..995527c --- /dev/null +++ b/src/sound/RBAIsOutputted.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. + */ +/** + * IsOutputted class header + */ + +#ifndef RBAISOUTPUTTED_HPP +#define RBAISOUTPUTTED_HPP + +#include <string> +#include "RBAZoneOperator.hpp" + +namespace rba +{ + +class RBAExpression; + +class DLL_EXPORT RBAIsOutputted : public RBAZoneOperator +{ +public: + RBAIsOutputted()=default; + RBAIsOutputted(const RBAIsOutputted&)=delete; + RBAIsOutputted(const RBAIsOutputted&&)=delete; + RBAIsOutputted& operator=(const RBAIsOutputted&)=delete; + RBAIsOutputted& operator=(const RBAIsOutputted&&)=delete; + virtual ~RBAIsOutputted()=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/sound/RBAIsOutputtedMaker.cpp b/src/sound/RBAIsOutputtedMaker.cpp new file mode 100644 index 0000000..844fd27 --- /dev/null +++ b/src/sound/RBAIsOutputtedMaker.cpp @@ -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. + */ +/// @file RBAIsOutputtedMaker.cpp +/// @brief IsOutputted object generator class + +#include <iostream> +#include "RBAIsOutputtedMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsOutputted.hpp" + +namespace rba +{ + +RBAIsOutputtedMaker::RBAIsOutputtedMaker() + : RBAOperatorMaker{"IsOutputted"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsOutputtedMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsOutputted>(); +} + + +} diff --git a/src/sound/RBAIsOutputtedMaker.hpp b/src/sound/RBAIsOutputtedMaker.hpp new file mode 100644 index 0000000..cf31e7f --- /dev/null +++ b/src/sound/RBAIsOutputtedMaker.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 RBAIsOutputtedMaker.hpp +/// @brief IsOutputted object generator class header + +#ifndef RBAISOUTPUTTEDMAKER_HPP +#define RBAISOUTPUTTEDMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsOutputted object generator class +class RBAIsOutputtedMaker : public RBAOperatorMaker +{ +public: + RBAIsOutputtedMaker(); + RBAIsOutputtedMaker(const RBAIsOutputtedMaker&)=delete; + RBAIsOutputtedMaker(const RBAIsOutputtedMaker&&)=delete; + RBAIsOutputtedMaker& operator=(const RBAIsOutputtedMaker&)=delete; + RBAIsOutputtedMaker& operator=(const RBAIsOutputtedMaker&&)=delete; + virtual ~RBAIsOutputtedMaker()=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/sound/RBAIsSounding.cpp b/src/sound/RBAIsSounding.cpp new file mode 100644 index 0000000..a4ab4c4 --- /dev/null +++ b/src/sound/RBAIsSounding.cpp @@ -0,0 +1,161 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsSounding class + +#include <algorithm> + +#include "RBAAllocatable.hpp" +#include "RBAArbitrator.hpp" +#include "RBAConstraintInfo.hpp" +#include "RBAContent.hpp" +#include "RBAContentState.hpp" +#include "RBAExecuteResult.hpp" +#include "RBAExpressionType.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAIsSounding.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAResultImpl.hpp" + +namespace rba +{ + +void +RBAIsSounding::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsSounding::getModelElementType() const +{ + return RBAModelElementType::IsSounding; +} + +bool +RBAIsSounding::executeCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const +{ + bool isPassed {false}; + // Add itself to the constraint hierarchy for coverage + LOG_addHierarchy(getSymbol()); + 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 (leftInfo->isExceptionBeforeArbitrate() || (content == nullptr)) { + info->setExceptionBeforeArbitrate(true); + } else if (ruleObj->isPrevious() == false) { + const RBAContentState* const contentState + {arb->getResult()->getActiveState(content)}; + if (contentState != nullptr) { + for(const RBAAllocatable* const allocatable : content->getAllocatables()) { + info->addOperandAllocatable(allocatable); + if (allocatable->isChecked() == true) { + const RBAContentState* const allocateContentState {allocatable->getState()}; + if (contentState == allocateContentState) { + if ((allocatable->isHiddenChecked() == true) + && (allocatable->isHidden() == true)) { + info->addFalseAllocatable(allocatable); + } else { + info->setExceptionBeforeArbitrate(false); + info->clearFalseAllocatable(); + info->addTrueAllocatable(allocatable); + isPassed = true; + break; + } + } else { + info->addFalseAllocatable(allocatable); + } + } else { + info->setExceptionBeforeArbitrate(true); + } + } + } else{ + for(const auto a:content->getAllocatables()){ + info->addFalseAllocatable(a); + } + } + } else { + const RBAContentState* const contentState + {arb->getResult()->getPreActiveState(content)}; + if (contentState != nullptr) { + for(const RBAAllocatable* const allocatable : content->getAllocatables()) { + info->addOperandAllocatable(allocatable); + const RBAContentState* const allocateContentState + {arb->getResult()->getPreAllocatedContentState(allocatable)}; + if ((contentState == allocateContentState) + && (arb->getResult()->isPreHidden(allocatable) == false)) { + isPassed = true; + } + } + } + } +#ifdef RBA_USE_LOG + if (info->isExceptionBeforeArbitrate() == true) { + if (content != nullptr) { + LOG_arbitrateConstraintLogicLogLine( + " Content[" + content->getElementName() + + "] before arbitrate skip"); + } else { + LOG_arbitrateConstraintLogicLogLine( + " Content[NULL] before arbitrate skip"); + } + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::SKIP); + } else if (isPassed == true) { + const RBAContentState* contentState; + if (ruleObj->isPrevious() == false) { + contentState = arb->getResult()->getActiveState(content); + } else { + contentState = arb->getResult()->getPreActiveState(content); + } + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Content[" + + content->getElementName() + "::" + contentState->getElementName() + + "] is Sounding"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Content[" + + content->getElementName() + "] is not Sounding"); + 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 +RBAIsSounding::getSymbol() const +{ + return ".isSounding()"; +} + +RBAExpressionType RBAIsSounding::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/sound/RBAIsSounding.hpp b/src/sound/RBAIsSounding.hpp new file mode 100644 index 0000000..45aa0ed --- /dev/null +++ b/src/sound/RBAIsSounding.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. + */ +/// IsSounding class header + +#ifndef RBAISSOUNDING_HPP +#define RBAISSOUNDING_HPP + +#include <string> +#include "RBASoundContentOperator.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAIsSounding : public RBASoundContentOperator +{ +public: + RBAIsSounding()=default; + RBAIsSounding(const RBAIsSounding&)=delete; + RBAIsSounding(const RBAIsSounding&&)=delete; + RBAIsSounding& operator=(const RBAIsSounding&)=delete; + RBAIsSounding& operator=(const RBAIsSounding&&)=delete; + virtual ~RBAIsSounding()=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/sound/RBAIsSoundingMaker.cpp b/src/sound/RBAIsSoundingMaker.cpp new file mode 100644 index 0000000..c00981e --- /dev/null +++ b/src/sound/RBAIsSoundingMaker.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. + */ +/// @file RBAIsSoundingMaker.cpp +/// @brief IsSounding object generator class + +#include "RBAIsSoundingMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsSounding.hpp" + +namespace rba +{ + +RBAIsSoundingMaker::RBAIsSoundingMaker() + : RBAOperatorMaker{"IsSounding"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsSoundingMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsSounding>(); +} + +} diff --git a/src/sound/RBAIsSoundingMaker.hpp b/src/sound/RBAIsSoundingMaker.hpp new file mode 100644 index 0000000..764967b --- /dev/null +++ b/src/sound/RBAIsSoundingMaker.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 RBAIsSoundingMaker.hpp +/// @brief IsSounding object generator class header + +#ifndef RBAISSOUNDINGMAKER_HPP +#define RBAISSOUNDINGMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsSounding object generator class +class RBAIsSoundingMaker : public RBAOperatorMaker +{ +public: + RBAIsSoundingMaker(); + RBAIsSoundingMaker(const RBAIsSoundingMaker&)=delete; + RBAIsSoundingMaker(const RBAIsSoundingMaker&&)=delete; + RBAIsSoundingMaker& operator=(const RBAIsSoundingMaker&)=delete; + RBAIsSoundingMaker& operator=(const RBAIsSoundingMaker&&)=delete; + virtual ~RBAIsSoundingMaker()=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/sound/RBAOutputtingSound.cpp b/src/sound/RBAOutputtingSound.cpp new file mode 100644 index 0000000..14d1567 --- /dev/null +++ b/src/sound/RBAOutputtingSound.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. + */ + /** + * OutputtingSound class implementation + */ + +#include "RBAOutputtingSound.hpp" +#include "RBAAllocatable.hpp" +#include "RBAArbitrator.hpp" +#include "RBAContent.hpp" +#include "RBAContentState.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBALogManager.hpp" +#include "RBAResultImpl.hpp" +#include "RBAModelElementType.hpp" +#include "RBAExpressionType.hpp" +#include "RBAConstraintInfo.hpp" + +namespace rba +{ + +void +RBAOutputtingSound::accept(RBAExpressionVisitor& visitor) +{ + // RBASceneAllocatableCollector, the only existing visitor at this time, + // does not accept expression that returns RBARuleObject, so it does not pass + // this path. + // It is implemented because another visitor may accept it in the future. + visitor.visit(*this); +} + +RBAModelElementType +RBAOutputtingSound::getModelElementType() const +{ + return RBAModelElementType::OutputtingSound; +} + +const RBARuleObject* +RBAOutputtingSound::getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const +{ + const RBARuleObject* object {nullptr}; + const auto leftInfo = info->getChild(0U); + const auto ruleObj = getLhsOperand()->getReferenceObject(leftInfo, arb); + if (!leftInfo->isExceptionBeforeArbitrate()) { + if (ruleObj != nullptr) { + const RBAAllocatable* const alloc {dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())}; + if (ruleObj->isPrevious()) { + if (!arb->getResult()->isPreHidden(alloc)) { + const auto contentState = arb->getResult()->getDirectPreContentState(alloc); + if (contentState != nullptr) { + object = contentState->getOwner(); + } + } + } else { + if (!alloc->isChecked()) { + info->setExceptionBeforeArbitrate(true); + } + // When "Hidden" judgment is not executed, or when "Hidden" is already + // judged and "Hidden" is false, contentState assigned to allocatable + // is acquired. + else if (!alloc->isHiddenChecked() || !alloc->isHidden()) { + const auto contentState = alloc->getState(); + if (contentState != nullptr) { + object = contentState->getOwner(); + } + // At this point, it is unknown whether the constraint expression + // will be False or True, so put it in both. + info->addFalseAllocatable(alloc); + info->addTrueAllocatable(alloc); + } else { + ; + } + } + } + } else { + info->setExceptionBeforeArbitrate(true); + } +#ifdef RBA_USE_LOG + bool pre = false; + std::string operandName; + std::string resultText; + if (ruleObj == nullptr) { + operandName = "NULL"; + } else { + pre = ruleObj->isPrevious(); + operandName = ruleObj->getElementName(); + } + if (leftInfo->isExceptionBeforeArbitrate()) { + resultText = "is before arbitrate skip"; + } else if (object == nullptr) { + if((ruleObj != nullptr) && dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())->isChecked()) { + resultText = "has no Outputted Content"; + } else { + resultText = "is before arbitrate skip"; + } + } else { + resultText = "has Outputted Content[" + object->getElementName() + "]"; + } + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(pre) + "Zone[" + operandName + "] " + resultText); +#endif + return object; +} + +#ifdef RBA_USE_LOG +const std::string +RBAOutputtingSound::getSymbol() const +{ + return ".outputtingSound()"; +} + +void +RBAOutputtingSound::createHierarchy() +{ + getLhsOperand()->createHierarchy(); +} + +RBAExpressionType +RBAOutputtingSound::getUnderlyingType() const +{ + return RBAExpressionType::SOUND; +} +#endif + +} diff --git a/src/sound/RBAOutputtingSound.hpp b/src/sound/RBAOutputtingSound.hpp new file mode 100644 index 0000000..67b476c --- /dev/null +++ b/src/sound/RBAOutputtingSound.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. + */ +/** + * 音声出力クラス + */ + +#ifndef RBAOUTPUTTINGSOUND_HPP +#define RBAOUTPUTTINGSOUND_HPP + +#include <string> +#include "RBAZoneOperator.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAOutputtingSound : public RBAZoneOperator +{ +public: + RBAOutputtingSound()=default; + RBAOutputtingSound(const RBAOutputtingSound&)=delete; + RBAOutputtingSound(const RBAOutputtingSound&&)=delete; + RBAOutputtingSound& operator=(const RBAOutputtingSound&)=delete; + RBAOutputtingSound& operator=(const RBAOutputtingSound&&)=delete; + virtual ~RBAOutputtingSound()=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; + RBAExpressionType getUnderlyingType() const override; +#endif + +}; + +} + +#endif diff --git a/src/sound/RBAOutputtingSoundMaker.cpp b/src/sound/RBAOutputtingSoundMaker.cpp new file mode 100644 index 0000000..4771fc6 --- /dev/null +++ b/src/sound/RBAOutputtingSoundMaker.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. + */ +/// @file RBAOutputtingSoundMaker.cpp +/// @brief OutputtingSound object generator class implementation + +#include "RBAOutputtingSoundMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAOutputtingSound.hpp" + +namespace rba +{ + +RBAOutputtingSoundMaker::RBAOutputtingSoundMaker() + : RBAOperatorMaker{"OutputtingSound"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAOutputtingSoundMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAOutputtingSound>(); +} + +} diff --git a/src/sound/RBAOutputtingSoundMaker.hpp b/src/sound/RBAOutputtingSoundMaker.hpp new file mode 100644 index 0000000..39cbe59 --- /dev/null +++ b/src/sound/RBAOutputtingSoundMaker.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 RBAOutputtingSoundMaker.hpp +/// @brief OutputtingSound object generator class header + +#ifndef RBAOUTPUTTINGSOUNDMAKER_HPP +#define RBAOUTPUTTINGSOUNDMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief OutputtingSound object generator class +class RBAOutputtingSoundMaker : public RBAOperatorMaker +{ +public: + RBAOutputtingSoundMaker(); + RBAOutputtingSoundMaker(const RBAOutputtingSoundMaker&)=delete; + RBAOutputtingSoundMaker(const RBAOutputtingSoundMaker&&)=delete; + RBAOutputtingSoundMaker& operator=(const RBAOutputtingSoundMaker&)=delete; + RBAOutputtingSoundMaker& operator=(const RBAOutputtingSoundMaker&&)=delete; + virtual ~RBAOutputtingSoundMaker()=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/sound/RBASoundContent.cpp b/src/sound/RBASoundContent.cpp new file mode 100644 index 0000000..32424ed --- /dev/null +++ b/src/sound/RBASoundContent.cpp @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Sound Content class + */ + +#include "RBASoundContent.hpp" + +namespace rba +{ + +} diff --git a/src/sound/RBASoundContentImpl.cpp b/src/sound/RBASoundContentImpl.cpp new file mode 100644 index 0000000..02f452b --- /dev/null +++ b/src/sound/RBASoundContentImpl.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. + */ +/** + * Sound Content class implementation + */ + +#include "RBASoundContentImpl.hpp" +#include "RBASoundContentStateImpl.hpp" +#include "RBAZoneImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBASoundContentImpl::RBASoundContentImpl(const std::string& name) + : RBARuleObject{name}, + RBASoundContent(), + RBAContent{name} +{ +} + +bool +RBASoundContentImpl::isSoundContent() const +{ + return true; +} + +std::string +RBASoundContentImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +const std::list<const RBASoundContentState*>& +RBASoundContentImpl::getContentStates() const +{ + if(externStates_.size() == 0U) { + for(const RBAContentState* state : getStates()) { + externStates_.push_back(dynamic_cast<const RBASoundContentStateImpl*>(state)); + } + } + return externStates_; +} + +const std::list<const RBAZone*>& +RBASoundContentImpl::getZones() const +{ + if(externZones_.size() == 0U) { + for(const RBAAllocatable* allocatable : getAllocatables()) { + externZones_.push_back(dynamic_cast<const RBAZoneImpl*>(allocatable)); + } + } + return externZones_; +} + +RBAContentLoserType +RBASoundContentImpl::getLoserType() const +{ + return getContentLoserType(); +} + +RBAModelElementType +RBASoundContentImpl::getModelElementType() const +{ + return RBAModelElementType::SoundContent; +} + +#ifdef RBA_USE_LOG +std::string +RBASoundContentImpl::getSymbol() const +{ + return "SoundContent"; +} + +std::string +RBASoundContentImpl::getVisibleSymbol() const +{ + return "sounding"; +} +#endif + +} diff --git a/src/sound/RBASoundContentImpl.hpp b/src/sound/RBASoundContentImpl.hpp new file mode 100644 index 0000000..75d9ab0 --- /dev/null +++ b/src/sound/RBASoundContentImpl.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. + */ +/** + * Sound Content implementation class header + */ + +#ifndef RBASOUNDCONTENTIMPL_HPP +#define RBASOUNDCONTENTIMPL_HPP + +#include <string> +#include "RBASoundContent.hpp" +#include "RBAContent.hpp" + +namespace rba +{ + +class RBASoundContentState; +class RBAZone; +class RBAZoneImpl; +class RBASoundContentStateImpl; + +class DLL_EXPORT RBASoundContentImpl : public RBASoundContent, public RBAContent +{ +public: + explicit RBASoundContentImpl(const std::string& name=""); + RBASoundContentImpl(const RBASoundContentImpl&)=delete; + RBASoundContentImpl(const RBASoundContentImpl&&)=delete; + RBASoundContentImpl& operator=(const RBASoundContentImpl&)=delete; + RBASoundContentImpl& operator=(const RBASoundContentImpl&&)=delete; + virtual ~RBASoundContentImpl()=default; + +public: + bool isSoundContent() const override; + std::string getName() const override; + const std::list<const RBASoundContentState*>& getContentStates() const override; + const std::list<const RBAZone*>& getZones() const override; + RBAContentLoserType getLoserType() const override; + + RBAModelElementType getModelElementType() const override; + + // Log +#ifdef RBA_USE_LOG + std::string getSymbol() const override; + std::string getVisibleSymbol() const override; +#endif + +private: +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4251) +#endif + mutable std::list<const RBASoundContentState*> externStates_; + mutable std::list<const RBAZone*> externZones_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/sound/RBASoundContentMaker.cpp b/src/sound/RBASoundContentMaker.cpp new file mode 100644 index 0000000..6bf0582 --- /dev/null +++ b/src/sound/RBASoundContentMaker.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 RBASoundContentMaker.cpp +/// @brief SoundContent object generator class + +#include "RBASoundContentMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBASoundContentImpl.hpp" +#include "RBASoundContentStateMaker.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBASoundContentMaker::RBASoundContentMaker() + : RBARuleObjectMaker{"soundcontents"}, + RBAContentMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBASoundContentMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBASoundContentImpl>(name); +} + +RBAModelElement* +RBASoundContentMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + element = RBAContentMaker::setProperty(element, jsonElem, model, owner); + if(element == nullptr) { + return nullptr; + } + + RBASoundContentImpl* const content {dynamic_cast<RBASoundContentImpl*>(element)}; + + return content; +} + +} diff --git a/src/sound/RBASoundContentMaker.hpp b/src/sound/RBASoundContentMaker.hpp new file mode 100644 index 0000000..f954cb3 --- /dev/null +++ b/src/sound/RBASoundContentMaker.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. + */ +/// @file RBASoundContentMaker.hpp +/// @brief SoundContent object generator class header + +#ifndef RBASOUNDCONTENTMAKER_HPP +#define RBASOUNDCONTENTMAKER_HPP + +#include "RBAContentMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief SoundContent object generator class +class RBASoundContentMaker : public RBAContentMaker +{ +public: + RBASoundContentMaker(); + RBASoundContentMaker(const RBASoundContentMaker&)=delete; + RBASoundContentMaker(const RBASoundContentMaker&&)=delete; + RBASoundContentMaker& operator=(const RBASoundContentMaker&)=delete; + RBASoundContentMaker& operator=(const RBASoundContentMaker&&)=delete; + virtual ~RBASoundContentMaker()=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; + + /// @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/sound/RBASoundContentOperator.cpp b/src/sound/RBASoundContentOperator.cpp new file mode 100644 index 0000000..d56ee34 --- /dev/null +++ b/src/sound/RBASoundContentOperator.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. + */ +/** + * SoundContentOperator class + */ + +#include "RBASoundContentOperator.hpp" +#include "RBASoundContentImpl.hpp" + +namespace rba +{ + +} diff --git a/src/sound/RBASoundContentOperator.hpp b/src/sound/RBASoundContentOperator.hpp new file mode 100644 index 0000000..ba400e6 --- /dev/null +++ b/src/sound/RBASoundContentOperator.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. + */ +/** + * SoundContentOperator class header + */ + +#ifndef RBASOUNDCONTENTOPERATOR_HPP +#define RBASOUNDCONTENTOPERATOR_HPP + +#include "RBAContentOperator.hpp" + +namespace rba +{ + +class RBASoundContentImpl; + +class DLL_EXPORT RBASoundContentOperator : public RBAContentOperator +{ +protected: + RBASoundContentOperator()=default; + RBASoundContentOperator(const RBASoundContentOperator&)=delete; + RBASoundContentOperator(const RBASoundContentOperator&&)=delete; + RBASoundContentOperator& operator=(const RBASoundContentOperator&)=delete; + RBASoundContentOperator& operator=(const RBASoundContentOperator&&)=delete; + +public: + +}; + +} + +#endif diff --git a/src/sound/RBASoundContentSet.cpp b/src/sound/RBASoundContentSet.cpp new file mode 100644 index 0000000..4b50397 --- /dev/null +++ b/src/sound/RBASoundContentSet.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. + */ +/** + * SoundContentSet class + */ + +#include "RBASoundContentSet.hpp" +#include "RBASoundContent.hpp" +#include "RBAContent.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBASoundContentSet::RBASoundContentSet(const std::string& name) + : RBARuleObject{name}, + RBAContentSet{name} +{ +} + +const std::list<const RBASoundContent*>& +RBASoundContentSet::getTargets() const +{ + return externalContents_; +} + +void +RBASoundContentSet::addTarget(const RBAContent* content) +{ + RBAContentSet::addTarget(content); + externalContents_.push_back(dynamic_cast<const RBASoundContent*>(content)); +} + +void +RBASoundContentSet::clear() +{ + RBAContentSet::clear(); + externalContents_.clear(); +} + +RBAModelElementType +RBASoundContentSet::getModelElementType() const +{ + return RBAModelElementType::SoundContentSet; +} + +} diff --git a/src/sound/RBASoundContentSet.hpp b/src/sound/RBASoundContentSet.hpp new file mode 100644 index 0000000..0d927d9 --- /dev/null +++ b/src/sound/RBASoundContentSet.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. + */ +/** + * SoundContentSet class header + */ + +#ifndef RBASOUNDCONTENTSET_HPP +#define RBASOUNDCONTENTSET_HPP + +#include "RBAContentSet.hpp" +#include "RBADllExport.hpp" + +namespace rba +{ + +class RBASoundContent; +class RBASoundContentImpl; + +class DLL_EXPORT RBASoundContentSet : public RBAContentSet +{ +public: + explicit RBASoundContentSet(const std::string& name=""); + RBASoundContentSet(const RBASoundContentSet&)=delete; + RBASoundContentSet(const RBASoundContentSet&&)=delete; + RBASoundContentSet& operator=(const RBASoundContentSet&)=delete; + RBASoundContentSet& operator=(const RBASoundContentSet&&)=delete; + virtual ~RBASoundContentSet()=default; + +public: + const std::list<const RBASoundContent*>& getTargets() const; + void addTarget(const RBAContent* content) override; + void clear() override; + RBAModelElementType getModelElementType() const override; + +private: +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4251) +#endif + std::list<const RBASoundContent*> externalContents_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/sound/RBASoundContentSetMaker.cpp b/src/sound/RBASoundContentSetMaker.cpp new file mode 100644 index 0000000..8db2afe --- /dev/null +++ b/src/sound/RBASoundContentSetMaker.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. + */ +/// @file RBASoundContentSetMaker.cpp +/// @brief SoundContentSet object generator class + +#include "RBASoundContentSetMaker.hpp" +#include "RBASoundContentSet.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBASoundContentSetMaker::RBASoundContentSetMaker() + : RBARuleObjectMaker{"soundcontentsets"}, + RBAContentSetMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBASoundContentSetMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBASoundContentSet>(name); +} + +RBAModelElement* +RBASoundContentSetMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + static_cast<void>(RBAContentSetMaker::setProperty(element, jsonElem, model, owner)); + + const auto contentSet = dynamic_cast<RBASoundContentSet*>(element); + + model->addSoundContentSet(contentSet); + + return contentSet; +} + +} diff --git a/src/sound/RBASoundContentSetMaker.hpp b/src/sound/RBASoundContentSetMaker.hpp new file mode 100644 index 0000000..256df09 --- /dev/null +++ b/src/sound/RBASoundContentSetMaker.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 RBASoundContentSetMaker.hpp +/// @brief SoundContentSet object generator class header + +#ifndef RBASOUNDCONTENTSETMAKER_HPP +#define RBASOUNDCONTENTSETMAKER_HPP + +#include "RBAContentSetMaker.hpp" + +namespace rba +{ + +/// @brief SoundContentSet object generator class +class RBASoundContentSetMaker : public RBAContentSetMaker +{ +public: + RBASoundContentSetMaker(); + RBASoundContentSetMaker(const RBASoundContentSetMaker&)=delete; + RBASoundContentSetMaker(const RBASoundContentSetMaker&&)=delete; + RBASoundContentSetMaker& operator=(const RBASoundContentSetMaker&)=delete; + RBASoundContentSetMaker& operator=(const RBASoundContentSetMaker&&)=delete; + virtual ~RBASoundContentSetMaker()=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; + + /// @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/sound/RBASoundContentState.cpp b/src/sound/RBASoundContentState.cpp new file mode 100644 index 0000000..14a1b3b --- /dev/null +++ b/src/sound/RBASoundContentState.cpp @@ -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. + */ +/** + * SoundContentState class + */ + +#include "RBASoundContentState.hpp" + +namespace rba +{ + +std::string +RBASoundContentState::getContentNameByContext(const std::string& context) +{ + return context.substr(0U, context.find(CONTEXT_SEPARATER)); +} + +std::string +RBASoundContentState::getContentStateNameByContext(const std::string& context) +{ + const std::string::size_type pos {context.find(CONTEXT_SEPARATER)}; + if(pos == std::string::npos) { + // Returns null string if it does not contain a separator character. + return ""; + } + else { + return context.substr(pos+1U, context.length()-1U); + } +} + +bool +RBASoundContentState::isUniqueName(const std::string& context) +{ + return (context.find(CONTEXT_SEPARATER) != std::string::npos); +} + +} diff --git a/src/sound/RBASoundContentStateImpl.cpp b/src/sound/RBASoundContentStateImpl.cpp new file mode 100644 index 0000000..4903057 --- /dev/null +++ b/src/sound/RBASoundContentStateImpl.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. + */ +/** + * SoundContentState implementation class + */ + +#include "RBASoundContentStateImpl.hpp" +#include "RBAContent.hpp" +#include "RBAContentState.hpp" +#include "RBASoundContentImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBASoundContentStateImpl::RBASoundContentStateImpl(const std::string& name) + : RBASoundContentState(), + RBAContentState{name} +{ +} + +bool +RBASoundContentStateImpl::isSoundContentState() const +{ + return true; +} + +std::string +RBASoundContentStateImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +std::int32_t +RBASoundContentStateImpl::getPriority() const +{ + return getContentStatePriority(); +} + +const RBASoundContent* +RBASoundContentStateImpl::getOwner() const +{ + return dynamic_cast<const RBASoundContentImpl*>(RBARuleObject::getOwner()); +} + +std::int32_t +RBASoundContentStateImpl::getOrder() const +{ + return getContentStateOrder(); +} + +std::string +RBASoundContentStateImpl::getUniqueName() const +{ + return RBARuleObject::getOwner()->getUniqueName() + CONTEXT_SEPARATER + getName(); +} + +RBAModelElementType +RBASoundContentStateImpl::getModelElementType() const +{ + return RBAModelElementType::SoundContentState; +} + +} diff --git a/src/sound/RBASoundContentStateImpl.hpp b/src/sound/RBASoundContentStateImpl.hpp new file mode 100644 index 0000000..4865507 --- /dev/null +++ b/src/sound/RBASoundContentStateImpl.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. + */ +/** + * SoundContentState implementation class header + */ +#ifndef RBASOUNDCONTENTSTATEIMPL_HPP +#define RBASOUNDCONTENTSTATEIMPL_HPP + +#include <cstdint> +#include "RBASoundContentState.hpp" +#include "RBAContentState.hpp" + +namespace rba +{ + +class RBASoundContentImpl; + +class RBASoundContentStateImpl : public RBASoundContentState, + public RBAContentState +{ +public: + explicit RBASoundContentStateImpl(const std::string& name=""); + RBASoundContentStateImpl(const RBASoundContentStateImpl&)=delete; + RBASoundContentStateImpl(const RBASoundContentStateImpl&&)=delete; + RBASoundContentStateImpl& operator=(const RBASoundContentStateImpl&)=delete; + RBASoundContentStateImpl& operator=(const RBASoundContentStateImpl&&)=delete; + virtual ~RBASoundContentStateImpl()=default; + +public: + bool isSoundContentState() const override; + std::string getName() const override; + std::int32_t getPriority() const override; + const RBASoundContent* getOwner() const override; + std::int32_t getOrder() const override; + std::string getUniqueName() const override; + RBAModelElementType getModelElementType() const override; + +}; + +} + +#endif diff --git a/src/sound/RBASoundContentStateMaker.cpp b/src/sound/RBASoundContentStateMaker.cpp new file mode 100644 index 0000000..ce4034d --- /dev/null +++ b/src/sound/RBASoundContentStateMaker.cpp @@ -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. + */ +/// @file RBASoundContentStateMaker.cpp +/// @brief SoundContentState object generator class + +#include "RBASoundContentStateMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBASoundContentStateImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBASoundContentStateMaker::RBASoundContentStateMaker() + : RBAContentStateMaker{"SoundContentState"} +{ +} + +std::unique_ptr<RBAModelElement> +RBASoundContentStateMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBASoundContentStateImpl>(name); +} + +RBAModelElement* +RBASoundContentStateMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + // create instance of unique_ptr and register it to model + // name, priority and owner are also registered. + RBAModelElement* const elem {RBAContentStateMaker::setProperty(element, + jsonElem, model, owner)}; + if(elem == nullptr) { + return nullptr; + } + RBASoundContentStateImpl* const state + {dynamic_cast<RBASoundContentStateImpl*>(elem)}; + + return state; +} + +} diff --git a/src/sound/RBASoundContentStateMaker.hpp b/src/sound/RBASoundContentStateMaker.hpp new file mode 100644 index 0000000..04a43a4 --- /dev/null +++ b/src/sound/RBASoundContentStateMaker.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. + */ +/// @file RBASoundContentStateMaker.hpp +/// @brief SoundContentState object generator class header + +#ifndef RBASOUNDCONTENTSTATEMAKER_HPP +#define RBASOUNDCONTENTSTATEMAKER_HPP + +#include "RBAContentStateMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief SoundContentState object generator class +class RBASoundContentStateMaker : public RBAContentStateMaker +{ +public: + RBASoundContentStateMaker(); + RBASoundContentStateMaker(const RBASoundContentStateMaker&)=delete; + RBASoundContentStateMaker(const RBASoundContentStateMaker&&)=delete; + RBASoundContentStateMaker& operator=(const RBASoundContentStateMaker&)=delete; + RBASoundContentStateMaker& operator=(const RBASoundContentStateMaker&&)=delete; + virtual ~RBASoundContentStateMaker()=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; + + /// @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/sound/RBASoundMakerTable.cpp b/src/sound/RBASoundMakerTable.cpp new file mode 100644 index 0000000..6be7d91 --- /dev/null +++ b/src/sound/RBASoundMakerTable.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 RBASoundMakerTable.cpp +/// @brief Sound element maker table class + +#include "RBASoundMakerTable.hpp" +#include "RBAAllInstanceOfSoundContentMaker.hpp" +#include "RBAAllInstanceOfZoneMaker.hpp" +#include "RBAIsAttenuatedMaker.hpp" +#include "RBAIsMutedMaker.hpp" +#include "RBAIsOutputtedMaker.hpp" +#include "RBAIsSoundingMaker.hpp" +#include "RBAOutputtingSoundMaker.hpp" +#include "RBASoundContentMaker.hpp" +#include "RBASoundContentSetMaker.hpp" +#include "RBASoundContentStateMaker.hpp" +#include "RBAZoneMaker.hpp" +#include "RBAZoneSetMaker.hpp" + +namespace rba +{ + +RBASoundMakerTable::RBASoundMakerTable() + : RBAAbstractMakerTable{} +{ + addTag("zones"); + addTag("zonesets"); + addTag("soundcontents"); + addTag("soundcontentsets"); +} + +std::list<std::unique_ptr<RBAModelElementMaker>> +RBASoundMakerTable::getMakers() const +{ + std::list<std::unique_ptr<RBAModelElementMaker>> makers; + makers.push_back(std::make_unique<RBAAllInstanceOfSoundContentMaker>()); + makers.push_back(std::make_unique<RBAAllInstanceOfZoneMaker>()); + makers.push_back(std::make_unique<RBAIsAttenuatedMaker>()); + makers.push_back(std::make_unique<RBAIsMutedMaker>()); + makers.push_back(std::make_unique<RBAIsOutputtedMaker>()); + makers.push_back(std::make_unique<RBAIsSoundingMaker>()); + makers.push_back(std::make_unique<RBAOutputtingSoundMaker>()); + makers.push_back(std::make_unique<RBASoundContentMaker>()); + RBAModelElementMaker::addMaker("SOUND", std::make_unique<RBASoundContentMaker>()); + RBAModelElementMaker::addMaker("SoundContent", std::make_unique<RBASoundContentMaker>()); + makers.push_back(std::make_unique<RBASoundContentSetMaker>()); + RBAModelElementMaker::addMaker("SET_OF_SOUND", std::make_unique<RBASoundContentSetMaker>()); + makers.push_back(std::make_unique<RBASoundContentStateMaker>()); + makers.push_back(std::make_unique<RBAZoneMaker>()); + RBAModelElementMaker::addMaker("ZONE", std::make_unique<RBAZoneMaker>()); + makers.push_back(std::make_unique<RBAZoneSetMaker>()); + RBAModelElementMaker::addMaker("SET_OF_ZONE", std::make_unique<RBAZoneSetMaker>()); + + return makers; +} + +} diff --git a/src/sound/RBASoundMakerTable.hpp b/src/sound/RBASoundMakerTable.hpp new file mode 100644 index 0000000..f80e046 --- /dev/null +++ b/src/sound/RBASoundMakerTable.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. + */ +/// @file RBASoundMakerTable.hpp +/// @brief Sound element maker table class header + +#ifndef RBASOUNDMAKERTABLE_HPP +#define RBASOUNDMAKERTABLE_HPP + +#include <functional> +#include "RBAAbstractMakerTable.hpp" + +namespace rba +{ + +class DLL_EXPORT RBASoundMakerTable : public RBAAbstractMakerTable +{ +public: + RBASoundMakerTable(); + RBASoundMakerTable(const RBASoundMakerTable&)=delete; + RBASoundMakerTable(const RBASoundMakerTable&&)=delete; + RBASoundMakerTable& operator=(const RBASoundMakerTable&)=delete; + RBASoundMakerTable& operator=(const RBASoundMakerTable&&)=delete; + virtual ~RBASoundMakerTable()=default; + +public: + std::list<std::unique_ptr<RBAModelElementMaker>> getMakers() const override; + +}; + +} + +#endif diff --git a/src/sound/RBAZoneImpl.cpp b/src/sound/RBAZoneImpl.cpp new file mode 100644 index 0000000..2c32498 --- /dev/null +++ b/src/sound/RBAZoneImpl.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. + */ +/** + * Zone implementation clas + */ + +#include "RBASoundContentImpl.hpp" +#include "RBAZone.hpp" +#include "RBAArbitrationPolicy.hpp" +#include "RBAExpression.hpp" +#include "RBAZoneImpl.hpp" +#include "RBAContent.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAZoneImpl::RBAZoneImpl(const std::string& name) + : RBARuleObject{name}, + RBAZone(), + RBAAllocatable{name} +{ +} + +std::string +RBAZoneImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +std::int32_t +RBAZoneImpl::getPriority() const +{ + // Zone priority is treated the same as Area Visibility internally + return getVisibility(); +} + +const std::list<const RBASoundContent*>& +RBAZoneImpl::getContents() const +{ + if(externContents_.size() == 0U) { + for(const RBAContent* content : getInternalContents()) { + externContents_.push_back(dynamic_cast<const RBASoundContentImpl*>(content)); + } + } + + return externContents_; +} + +RBAArbitrationPolicy +RBAZoneImpl::getArbitrationPolicy() const +{ + return getAllocatableArbitrationPolicy(); +} + +void +RBAZoneImpl::addContent(const RBASoundContentImpl* const content) +{ + RBAAbstractAllocatable::addContent(content); +} + +RBAModelElementType +RBAZoneImpl::getModelElementType() const +{ + return RBAModelElementType::Zone; +} + +#ifdef RBA_USE_LOG +std::string +RBAZoneImpl::getSymbol() const +{ + return "Zone"; +} + +std::string +RBAZoneImpl::getHiddenSymbol() const +{ + return "muted"; +} +#endif + +} + diff --git a/src/sound/RBAZoneImpl.hpp b/src/sound/RBAZoneImpl.hpp new file mode 100644 index 0000000..efb345f --- /dev/null +++ b/src/sound/RBAZoneImpl.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. + */ +/** + * Zone implementation clas header + */ + +#ifndef RBAZONEIMPL_HPP +#define RBAZONEIMPL_HPP + +#include <cstdint> +#include <string> +#include "RBAAllocatable.hpp" +#include "RBAArbitrationPolicy.hpp" +#include "RBAZone.hpp" + +namespace rba +{ + +class RBASoundContent; +class RBASoundContentImpl; + +class RBAZoneImpl : public RBAZone, public RBAAllocatable +{ +public: + explicit RBAZoneImpl(const std::string& name=""); + RBAZoneImpl(const RBAZoneImpl&)=delete; + RBAZoneImpl(const RBAZoneImpl&&)=delete; + RBAZoneImpl& operator=(const RBAZoneImpl&)=delete; + RBAZoneImpl& operator=(const RBAZoneImpl&&)=delete; + virtual ~RBAZoneImpl()=default; + +public: + std::string getName() const override; + std::int32_t getPriority() const override; + const std::list<const RBASoundContent*>& getContents() const override; + RBAArbitrationPolicy getArbitrationPolicy() const override; + + void addContent(const RBASoundContentImpl* const content); + RBAModelElementType getModelElementType() const override; + + // Log +#ifdef RBA_USE_LOG + std::string getSymbol() const override; + std::string getHiddenSymbol() const override; +#endif + +private: +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4251) +#endif + mutable std::list<const RBASoundContent*> externContents_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/sound/RBAZoneMaker.cpp b/src/sound/RBAZoneMaker.cpp new file mode 100644 index 0000000..f6923fd --- /dev/null +++ b/src/sound/RBAZoneMaker.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 RBAZoneMaker.cpp +/// @brief Zone object generator class + +#include <iostream> +#include "RBAZoneMaker.hpp" +#include "RBAZoneImpl.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAZoneMaker::RBAZoneMaker() + : RBARuleObjectMaker{"zones"}, + RBAAllocatableMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBAZoneMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAZoneImpl>(name); +} + +RBAModelElement* +RBAZoneMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + element = RBAAllocatableMaker::setProperty(element, jsonElem, model, owner); + if(element == nullptr) { + return nullptr; + } + + RBAZoneImpl* const zone {dynamic_cast<RBAZoneImpl*>(element)}; + + return zone; +} + +} diff --git a/src/sound/RBAZoneMaker.hpp b/src/sound/RBAZoneMaker.hpp new file mode 100644 index 0000000..8367bd0 --- /dev/null +++ b/src/sound/RBAZoneMaker.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 RBAZoneMaker.hpp +/// @brief Zone object generator class header + +#ifndef RBAZONEMAKER_HPP +#define RBAZONEMAKER_HPP + +#include "RBAAllocatableMaker.hpp" + +namespace rba +{ + +/// @brief Zone object generator class +class RBAZoneMaker : public RBAAllocatableMaker +{ +public: + RBAZoneMaker(); + RBAZoneMaker(const RBAZoneMaker&)=delete; + RBAZoneMaker(const RBAZoneMaker&&)=delete; + RBAZoneMaker& operator=(const RBAZoneMaker&)=delete; + RBAZoneMaker& operator=(const RBAZoneMaker&&)=delete; + virtual ~RBAZoneMaker()=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; + + /// @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/sound/RBAZoneOperator.cpp b/src/sound/RBAZoneOperator.cpp new file mode 100644 index 0000000..9add4a5 --- /dev/null +++ b/src/sound/RBAZoneOperator.cpp @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * ZoneOperator class + */ + +#include "RBAZoneOperator.hpp" + +namespace rba +{ + +} diff --git a/src/sound/RBAZoneOperator.hpp b/src/sound/RBAZoneOperator.hpp new file mode 100644 index 0000000..86e6c00 --- /dev/null +++ b/src/sound/RBAZoneOperator.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. + */ +/** + * ZoneOperator class header + */ + +#ifndef RBAZONEOPERATOR_HPP +#define RBAZONEOPERATOR_HPP + +#include "RBAAllocatableOperator.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAZoneOperator : public RBAAllocatableOperator +{ +protected: + RBAZoneOperator()=default; + RBAZoneOperator(const RBAZoneOperator&)=delete; + RBAZoneOperator(const RBAZoneOperator&&)=delete; + RBAZoneOperator& operator=(const RBAZoneOperator&)=delete; + RBAZoneOperator& operator=(const RBAZoneOperator&&)=delete; + +public: + virtual ~RBAZoneOperator()=default; + +}; + +} + +#endif diff --git a/src/sound/RBAZoneSet.cpp b/src/sound/RBAZoneSet.cpp new file mode 100644 index 0000000..e23e84a --- /dev/null +++ b/src/sound/RBAZoneSet.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. + */ +/** + * ZoneSet class + */ + +#include "RBAZoneSet.hpp" +#include "RBAZone.hpp" +#include "RBAAllocatable.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAZoneSet::RBAZoneSet(const std::string& name) + : RBARuleObject{name}, + RBAAllocatableSet{name} +{ +} + +const std::list<const RBAZone*>& +RBAZoneSet::getTargets() const +{ + return externZones_; +} + +void +RBAZoneSet::addTarget(const RBAAllocatable* alloc) +{ + RBAAllocatableSet::addTarget(alloc); + externZones_.push_back(dynamic_cast<const RBAZone*>(alloc)); +} + +void +RBAZoneSet::clear() +{ + RBAAllocatableSet::clear(); + externZones_.clear(); +} + +RBAModelElementType +RBAZoneSet::getModelElementType() const +{ + return RBAModelElementType::ZoneSet; +} + +} diff --git a/src/sound/RBAZoneSet.hpp b/src/sound/RBAZoneSet.hpp new file mode 100644 index 0000000..1f5f1e6 --- /dev/null +++ b/src/sound/RBAZoneSet.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. + */ +/** + * ZoneSet class header + */ + +#ifndef RBAZONESET_HPP +#define RBAZONESET_HPP + +#include "RBAAllocatableSet.hpp" + +namespace rba +{ + +class RBAZoneImpl; +class RBAZone; + +class DLL_EXPORT RBAZoneSet : public RBAAllocatableSet +{ +public: + explicit RBAZoneSet(const std::string& name=""); + RBAZoneSet(const RBAZoneSet&)=delete; + RBAZoneSet(const RBAZoneSet&&)=delete; + RBAZoneSet& operator=(const RBAZoneSet&)=delete; + RBAZoneSet& operator=(const RBAZoneSet&&)=delete; + virtual ~RBAZoneSet()=default; + +public: + const std::list<const RBAZone*>& getTargets() const; + void addTarget(const RBAAllocatable* alloc) override; + void clear() override; + RBAModelElementType getModelElementType() const override; + +private: +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4251) +#endif + std::list<const RBAZone*> externZones_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/sound/RBAZoneSetMaker.cpp b/src/sound/RBAZoneSetMaker.cpp new file mode 100644 index 0000000..b05c935 --- /dev/null +++ b/src/sound/RBAZoneSetMaker.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. + */ +/// @file RBAZoneSetMaker.cpp +/// @brief ZoneSet object generator class + +#include "RBAZoneSetMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAZoneSet.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAZoneSetMaker::RBAZoneSetMaker() + : RBARuleObjectMaker{"zonesets"}, + RBAAllocatableSetMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBAZoneSetMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAZoneSet>(name); +} + +RBAModelElement* +RBAZoneSetMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + static_cast<void>(RBAAllocatableSetMaker::setProperty(element, jsonElem, model, owner)); + + RBAZoneSet* const zoneSet {dynamic_cast<RBAZoneSet*>(element)}; + + model->addZoneSet(zoneSet); + + return zoneSet; +} + +} diff --git a/src/sound/RBAZoneSetMaker.hpp b/src/sound/RBAZoneSetMaker.hpp new file mode 100644 index 0000000..1265628 --- /dev/null +++ b/src/sound/RBAZoneSetMaker.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 RBAZoneSetMaker.hpp +/// @brief ZoneSet object generator class header + +#ifndef RBAZONESETMAKER_HPP +#define RBAZONESETMAKER_HPP + +#include "RBAAllocatableSetMaker.hpp" + +namespace rba +{ + +/// @brief ZoneSet object generator class +class RBAZoneSetMaker : public RBAAllocatableSetMaker +{ +public: + RBAZoneSetMaker(); + RBAZoneSetMaker(const RBAZoneSetMaker&)=delete; + RBAZoneSetMaker(const RBAZoneSetMaker&&)=delete; + RBAZoneSetMaker& operator=(const RBAZoneSetMaker&)=delete; + RBAZoneSetMaker& operator=(const RBAZoneSetMaker&&)=delete; + virtual ~RBAZoneSetMaker()=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; + + /// @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 |