diff options
Diffstat (limited to 'src/view')
64 files changed, 4357 insertions, 0 deletions
diff --git a/src/view/RBAAllInstanceOfArea.cpp b/src/view/RBAAllInstanceOfArea.cpp new file mode 100644 index 0000000..032cc90 --- /dev/null +++ b/src/view/RBAAllInstanceOfArea.cpp @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * AllInstanceOfArea implementation class definition file + */ + +#include "RBAAllInstanceOfArea.hpp" +#include "RBAAreaImpl.hpp" +#include "RBAArbitrator.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +void +RBAAllInstanceOfArea::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 left because another visitor may accept it in the future. + visitor.visit(*this); +} + +RBAModelElementType +RBAAllInstanceOfArea::getModelElementType() const +{ + return RBAModelElementType::AllInstanceOfArea; +} + +const RBARuleObject* +RBAAllInstanceOfArea::getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const +{ + return &allAreaSet_; +} + +void +RBAAllInstanceOfArea::setAreas(const std::list<const RBAAreaImpl*>& areas) +{ + for (auto& a : areas) { + allAreaSet_.addTarget(a); + } +} + +#ifdef RBA_USE_LOG +const std::string +RBAAllInstanceOfArea::getExpressionText() const +{ + return "ALL_AREAS"; +} + +const std::string +RBAAllInstanceOfArea::getCoverageExpressionText() const +{ + return getExpressionText(); +} +#endif + +} diff --git a/src/view/RBAAllInstanceOfArea.hpp b/src/view/RBAAllInstanceOfArea.hpp new file mode 100644 index 0000000..b2ffaa7 --- /dev/null +++ b/src/view/RBAAllInstanceOfArea.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. + */ + +/** + * AllInstanceOfArea class header file + */ + +#ifndef RBAAllInstanceOfArea_HPP +#define RBAAllInstanceOfArea_HPP + +#include "RBAAreaSet.hpp" +#include "RBASetExpression.hpp" + +namespace rba +{ +class DLL_EXPORT RBAAllInstanceOfArea : public RBASetExpression +{ + public: + RBAAllInstanceOfArea()=default; + RBAAllInstanceOfArea(const RBAAllInstanceOfArea&)=delete; + RBAAllInstanceOfArea(const RBAAllInstanceOfArea&&)=delete; + RBAAllInstanceOfArea& operator=(const RBAAllInstanceOfArea&)=delete; + RBAAllInstanceOfArea& operator=(const RBAAllInstanceOfArea&&)=delete; + + public: + void accept(RBAExpressionVisitor& visitor) override; + RBAModelElementType getModelElementType() const override; + const RBARuleObject* getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const override; + void setAreas(const std::list<const RBAAreaImpl*>& areas); + + // Log +#ifdef RBA_USE_LOG + const std::string getExpressionText() const override; + const std::string getCoverageExpressionText() const override; +#endif + + private: + RBAAreaSet allAreaSet_; +}; + +} + +#endif diff --git a/src/view/RBAAllInstanceOfAreaMaker.cpp b/src/view/RBAAllInstanceOfAreaMaker.cpp new file mode 100644 index 0000000..f9cf28f --- /dev/null +++ b/src/view/RBAAllInstanceOfAreaMaker.cpp @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// @file RBAAllInstanceOfAreaMaker.cpp +/// @brief AllInstanceOfArea object generation class definition file + +#include <iostream> +#include "RBAAllInstanceOfAreaMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAAllInstanceOfArea.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAAllInstanceOfAreaMaker::RBAAllInstanceOfAreaMaker() + : RBAExpressionMaker{"AllInstanceOfArea"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAAllInstanceOfAreaMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAAllInstanceOfArea>(); +} + +RBAModelElement* +RBAAllInstanceOfAreaMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBAAllInstanceOfArea* const allArea + {dynamic_cast<RBAAllInstanceOfArea*>(element)}; + allArea->setAreas(model->getAreaImpls()); + + return allArea; +} + +} diff --git a/src/view/RBAAllInstanceOfAreaMaker.hpp b/src/view/RBAAllInstanceOfAreaMaker.hpp new file mode 100644 index 0000000..7977874 --- /dev/null +++ b/src/view/RBAAllInstanceOfAreaMaker.hpp @@ -0,0 +1,62 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// @file RBAAllInstanceOfAreaMaker.hpp +/// @brief AllInstanceOfArea object generation class header file + +#ifndef RBAALLINSTANCEOFAREAMAKER_HPP +#define RBAALLINSTANCEOFAREAMAKER_HPP + +#include "RBAExpressionMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief AllInstanceOfArea object generation class +class RBAAllInstanceOfAreaMaker : public RBAExpressionMaker +{ +public: + RBAAllInstanceOfAreaMaker(); + RBAAllInstanceOfAreaMaker(const RBAAllInstanceOfAreaMaker&)=delete; + RBAAllInstanceOfAreaMaker(const RBAAllInstanceOfAreaMaker&&)=delete; + RBAAllInstanceOfAreaMaker& operator=(const RBAAllInstanceOfAreaMaker&)=delete; + RBAAllInstanceOfAreaMaker& operator=(const RBAAllInstanceOfAreaMaker&&)=delete; + virtual ~RBAAllInstanceOfAreaMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return instans of unique_ptr + 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 Model to save the generated object + /// @param[in,out] owner parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBAAllInstanceOfViewContent.cpp b/src/view/RBAAllInstanceOfViewContent.cpp new file mode 100644 index 0000000..7620410 --- /dev/null +++ b/src/view/RBAAllInstanceOfViewContent.cpp @@ -0,0 +1,74 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * AllInstanceOfViewContent implementation class definition file + */ + +#include "RBAAllInstanceOfViewContent.hpp" +#include "RBAViewContentImpl.hpp" +#include "RBAArbitrator.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +void +RBAAllInstanceOfViewContent::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 left because another visitor may accept it in the future. + visitor.visit(*this); +} + +RBAModelElementType +RBAAllInstanceOfViewContent::getModelElementType() const +{ + return RBAModelElementType::AllInstanceOfViewContent; +} + +const RBARuleObject* +RBAAllInstanceOfViewContent::getReferenceObjectCore(RBAConstraintInfo* info, + RBAArbitrator* arb) const +{ + return &allViewContentSet_; +} + +void +RBAAllInstanceOfViewContent::setContents(const std::list<const RBAViewContentImpl*>& contents) +{ + for (auto& content : contents) { + allViewContentSet_.addTarget(content); + } +} + +#ifdef RBA_USE_LOG +const std::string +RBAAllInstanceOfViewContent::getExpressionText() const +{ + return "ALL_VIEWCONTENTS"; +} + +const std::string +RBAAllInstanceOfViewContent::getCoverageExpressionText() const +{ + return getExpressionText(); +} +#endif + +} diff --git a/src/view/RBAAllInstanceOfViewContent.hpp b/src/view/RBAAllInstanceOfViewContent.hpp new file mode 100644 index 0000000..214a070 --- /dev/null +++ b/src/view/RBAAllInstanceOfViewContent.hpp @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * AllInstanceOfViewContent class header file + */ + +#ifndef RBAALLINSRTANCEOFVIEWCONTENTIMPL_HPP +#define RBAALLINSRTANCEOFVIEWCONTENTIMPL_HPP + +#include "RBASetExpression.hpp" +#include "RBAViewContentSet.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAAllInstanceOfViewContent : public RBASetExpression +{ +public: + RBAAllInstanceOfViewContent()=default; + RBAAllInstanceOfViewContent(const RBAAllInstanceOfViewContent&)=delete; + RBAAllInstanceOfViewContent(const RBAAllInstanceOfViewContent&&)=delete; + RBAAllInstanceOfViewContent& operator=(const RBAAllInstanceOfViewContent&)=delete; + RBAAllInstanceOfViewContent& operator=(const RBAAllInstanceOfViewContent&&)=delete; + +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 RBAViewContentImpl*>& contents); + + // Log +#ifdef RBA_USE_LOG + const std::string getExpressionText() const override; + const std::string getCoverageExpressionText() const override; +#endif + +private: + RBAViewContentSet allViewContentSet_; + +}; + +} + +#endif diff --git a/src/view/RBAAllInstanceOfViewContentMaker.cpp b/src/view/RBAAllInstanceOfViewContentMaker.cpp new file mode 100644 index 0000000..7fe7c6d --- /dev/null +++ b/src/view/RBAAllInstanceOfViewContentMaker.cpp @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/// @file RBAAllInstanceOfViewContentMaker.cpp +/// @brief AllInstanceOfViewContenta object generation class definition file + +#include <iostream> +#include "RBAAllInstanceOfViewContentMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAAllInstanceOfViewContent.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAAllInstanceOfViewContentMaker::RBAAllInstanceOfViewContentMaker() + : RBAExpressionMaker{"AllInstanceOfViewContent"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAAllInstanceOfViewContentMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAAllInstanceOfViewContent>(); +} + +RBAModelElement* +RBAAllInstanceOfViewContentMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBAAllInstanceOfViewContent* const allCont + {dynamic_cast<RBAAllInstanceOfViewContent*>(element)}; + allCont->setContents(model->getViewContentImpls()); + + return allCont; +} + +} diff --git a/src/view/RBAAllInstanceOfViewContentMaker.hpp b/src/view/RBAAllInstanceOfViewContentMaker.hpp new file mode 100644 index 0000000..f9e2b3f --- /dev/null +++ b/src/view/RBAAllInstanceOfViewContentMaker.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 RBAAllInstanceOfViewContentMaker.hpp +/// @brief AllInstanceOfViewContent object generation class header file + +#ifndef RBAALLINSTANCEOFVIEWCONTENTMAKER_HPP +#define RBAALLINSTANCEOFVIEWCONTENTMAKER_HPP + +#include "RBAExpressionMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief AllInstanceOfViewContent object generation class +class RBAAllInstanceOfViewContentMaker : public RBAExpressionMaker +{ +public: + RBAAllInstanceOfViewContentMaker(); + RBAAllInstanceOfViewContentMaker(const RBAAllInstanceOfViewContentMaker&)=delete; + RBAAllInstanceOfViewContentMaker(const RBAAllInstanceOfViewContentMaker&&)=delete; + RBAAllInstanceOfViewContentMaker& operator=(const RBAAllInstanceOfViewContentMaker&)=delete; + RBAAllInstanceOfViewContentMaker& operator=(const RBAAllInstanceOfViewContentMaker&&)=delete; + virtual ~RBAAllInstanceOfViewContentMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return instance of unique_ptr + std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override; + + /// @brief Set model element attributes for each derived class + /// @param[in] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBAAreaImpl.cpp b/src/view/RBAAreaImpl.cpp new file mode 100644 index 0000000..ffc354f --- /dev/null +++ b/src/view/RBAAreaImpl.cpp @@ -0,0 +1,222 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Area imeplementation class + */ + +#include "RBAAreaImpl.hpp" + +#include "RBAArbitrationPolicy.hpp" +#include "RBAContent.hpp" +#include "RBASizeImpl.hpp" +#include "RBAViewContentImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAAreaImpl::RBAAreaImpl(const std::string& name) + : RBARuleObject{name}, + RBAArea(), + RBAAllocatable{name} +{ +} + +std::string +RBAAreaImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +std::int32_t +RBAAreaImpl::getX() const +{ + return x_; +} + +std::int32_t +RBAAreaImpl::getY() const +{ + return y_; +} + +std::int32_t +RBAAreaImpl::getZorder() const +{ + return zorder_; +} + +const std::list<const RBAViewContent*>& +RBAAreaImpl::getContents() const +{ + if(externContents_.size() == 0U) { + for(const RBAContent* const content : getInternalContents()) { + if(content->isViewContent()) { + const RBAViewContentImpl* contentImpl + {dynamic_cast<const RBAViewContentImpl*>(content)}; + externContents_.push_back(contentImpl); + } + } + } + + return externContents_; +} + +const std::list<const RBAViewContent*>& +RBAAreaImpl::getAllViewContents() const +{ + if(externAllContents_.size() == 0U) { + for(const RBAViewContent* const content : getAllViewContentsRecursive(this)) { + externAllContents_.push_back(content); + } + } + + return externAllContents_; +} + +const std::list<const RBAViewContent*> +RBAAreaImpl::getAllViewContentsRecursive(const RBAAllocatable* const alloc) const +{ + std::list<const RBAViewContent*> contents; + if(alloc == nullptr) { + return contents; + } + + for(const RBAContent* const content : alloc->getInternalContents()) { + if(content->isViewContent()) { + const RBAViewContentImpl* contentImpl {dynamic_cast<const RBAViewContentImpl*>(content)}; + contents.push_back(contentImpl); + } + else { + const RBAAllocatable* const a {dynamic_cast<const RBAAllocatable*>(content)}; + if(a != nullptr) { + // @Deviation (MEM05-CPP,Rule-7_5_4,A7-5-2) + // [Contents that deviate from the rules] + // Recursively calling getAllViewContentsRecursive() + // [Why there is no problem if it deviate from the rules] + // When getAllViewContentsRecursive() is performed for Area associated + // with CyclicContent, it responds including ViewContent associated + // with CyclicContent. + // Multiple recursive calls may be made, such as when CyclicContent + // is assigned to CyclicContent, but the rule model definition + // is finite and stack overflow does not occur, so there is no problem. + for(const RBAViewContent* const c : getAllViewContentsRecursive(a)) { + contents.push_back(c); + } + } + } + } + + return contents; +} + +const std::list<const RBASize*>& +RBAAreaImpl::getSizes() const +{ + return externSizes_; +} + +RBAArbitrationPolicy +RBAAreaImpl::getArbitrationPolicy() const +{ + return getAllocatableArbitrationPolicy(); +} + +void +RBAAreaImpl::clearStatus() +{ + RBAAllocatable::clearStatus(); + resetCoordinate(); +} + +bool +RBAAreaImpl::isArea() const +{ + return true; +} + +void +RBAAreaImpl::setZorder(const std::int32_t newZorder) +{ + zorder_ = newZorder; +} + +void +RBAAreaImpl::setDefaultX(const std::int32_t defaultX) +{ + defaultX_ = defaultX; + x_ = defaultX; +} + +void +RBAAreaImpl::setDefaultY(const std::int32_t defaultY) +{ + defaultY_ = defaultY; + y_ = defaultY; +} + +void +RBAAreaImpl::setOffsetX(const std::int32_t offsetX) +{ + x_ = defaultX_ + offsetX; +} + +void +RBAAreaImpl::setOffsetY(const std::int32_t offsetY) +{ + y_ = defaultY_ + offsetY; +} + +void +RBAAreaImpl::addSize(const RBASizeImpl* size) +{ + externSizes_.push_back(size); +} + +void +RBAAreaImpl::addContent(const RBAViewContentImpl* const content) +{ + RBAAbstractAllocatable::addContent(content); +} + +void +RBAAreaImpl::resetCoordinate() +{ + x_ = defaultX_; + y_ = defaultY_; +} + +RBAModelElementType +RBAAreaImpl::getModelElementType() const +{ + return RBAModelElementType::Area; +} + +#ifdef RBA_USE_LOG +std::string +RBAAreaImpl::getSymbol() const +{ + return "Area"; +} + +std::string +RBAAreaImpl::getHiddenSymbol() const +{ + return "hidden"; +} +#endif + +} diff --git a/src/view/RBAAreaImpl.hpp b/src/view/RBAAreaImpl.hpp new file mode 100644 index 0000000..d5998ee --- /dev/null +++ b/src/view/RBAAreaImpl.hpp @@ -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. + */ +/** + * Area imeplementation class header + */ + +#ifndef RBAAREAIMPL_HPP +#define RBAAREAIMPL_HPP + +#include <cstdint> +#include <string> +#include "RBAArea.hpp" +#include "RBAAllocatable.hpp" + +namespace rba +{ + +class RBASize; +class RBASizeImpl; +class RBAViewContent; +class RBAViewContentImpl; + +class DLL_EXPORT RBAAreaImpl : public RBAArea, public RBAAllocatable +{ +public: + explicit RBAAreaImpl(const std::string& name=""); + RBAAreaImpl(const RBAAreaImpl&)=delete; + RBAAreaImpl(const RBAAreaImpl&&)=delete; + RBAAreaImpl& operator=(const RBAAreaImpl&)=delete; + RBAAreaImpl& operator=(const RBAAreaImpl&&)=delete; + +public: + std::string getName() const override; + std::int32_t getX() const override; + std::int32_t getY() const override; + std::int32_t getZorder() const override; + const std::list<const RBAViewContent*>& getContents() const override; + const std::list<const RBASize*>& getSizes() const override; + RBAArbitrationPolicy getArbitrationPolicy() const override; + + void clearStatus() final; + bool isArea() const override; + + void setZorder(const std::int32_t newZorder); + void setDefaultX(const std::int32_t defaultX); + void setDefaultY(const std::int32_t defaultY); + void setOffsetX(const std::int32_t offsetX); + void setOffsetY(const std::int32_t offsetY); + void addSize(const RBASizeImpl* size); + void addContent(const RBAViewContentImpl* const content); + void resetCoordinate(); + RBAModelElementType getModelElementType() const override; + const std::list<const RBAViewContent*>& getAllViewContents() const; + const std::list<const RBAViewContent*> getAllViewContentsRecursive(const RBAAllocatable* const alloc) const; + + // Log +#ifdef RBA_USE_LOG + std::string getSymbol() const override; + std::string getHiddenSymbol() const override; +#endif + +private: + std::int32_t x_ {0}; + std::int32_t y_ {0}; + std::int32_t defaultX_ {0}; + std::int32_t defaultY_ {0}; + std::int32_t zorder_ {0}; +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4251) +#endif + std::list<const RBASize*> externSizes_; + mutable std::list<const RBAViewContent*> externContents_; + mutable std::list<const RBAViewContent*> externAllContents_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/view/RBAAreaMaker.cpp b/src/view/RBAAreaMaker.cpp new file mode 100644 index 0000000..3b33572 --- /dev/null +++ b/src/view/RBAAreaMaker.cpp @@ -0,0 +1,90 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 RBAAreaMaker.cpp +/// @brief Area object generation class + +#include <iostream> +#include "RBAAreaMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAAreaImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBASizeMaker.hpp" + +namespace rba +{ + +RBAAreaMaker::RBAAreaMaker() + : RBARuleObjectMaker{"areas"}, + RBAAllocatableMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBAAreaMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAAreaImpl>(name); +} + +RBAModelElement* +RBAAreaMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + element = RBAAllocatableMaker::setProperty(element, jsonElem, model, owner); + if (element == nullptr) { + return nullptr; + } + + RBAAreaImpl* const area {dynamic_cast<RBAAreaImpl*>(element)}; + + // Set default X and Y + std::int32_t x{-1}; + std::int32_t y{-1}; + const RBAJsonElement* const elemX {jsonElem->findChildren("x")}; + const RBAJsonElement* const elemY {jsonElem->findChildren("y")}; + if(elemX != nullptr) { + x = elemX->getInt(); + } + if(elemY != nullptr) { + y = elemY->getInt(); + } + area->setDefaultX(x); + area->setDefaultY(y); + + // Set zorder + const RBAJsonElement* const zorder {jsonElem->findChildren("zorder")}; + if(zorder == nullptr) { + std::cerr << area->getElementName() + << ": zorder not found" << &std::endl; + return nullptr; + } + area->setZorder(zorder->getInt()); + + // Size + RBASizeMaker szMaker; + szMaker.setFactory(getFactory()); + for(const auto& size : jsonElem->findChildren("size")->getChildren()) { + const auto sizeInst = szMaker.create(size.get(), model, area); + area->addSize(dynamic_cast<RBASizeImpl*>(sizeInst)); + } + + return area; +} + +} diff --git a/src/view/RBAAreaMaker.hpp b/src/view/RBAAreaMaker.hpp new file mode 100644 index 0000000..291e91b --- /dev/null +++ b/src/view/RBAAreaMaker.hpp @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// @file RBAAreaMaker.hpp +/// @brief Area object generation class header + +#ifndef RBAAREAMAKER_HPP +#define RBAAREAMAKER_HPP + +#include "RBAAllocatableMaker.hpp" + +namespace rba +{ + +/// @brief Area object generation class +class RBAAreaMaker : public RBAAllocatableMaker +{ +public: + RBAAreaMaker(); + RBAAreaMaker(const RBAAreaMaker&)=default; + RBAAreaMaker& operator=(const RBAAreaMaker&)=default; + // move削除 + RBAAreaMaker(const RBAAreaMaker&&)=delete; + RBAAreaMaker& operator=(const RBAAreaMaker&&)=delete; + virtual ~RBAAreaMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBAAreaOperator.cpp b/src/view/RBAAreaOperator.cpp new file mode 100644 index 0000000..58ab1ac --- /dev/null +++ b/src/view/RBAAreaOperator.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. + */ +/** + * Area oeprator class + */ + +#include "RBAAreaOperator.hpp" + +namespace rba +{ + +} diff --git a/src/view/RBAAreaOperator.hpp b/src/view/RBAAreaOperator.hpp new file mode 100644 index 0000000..d17f470 --- /dev/null +++ b/src/view/RBAAreaOperator.hpp @@ -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. + */ +/** + * Area oeprator class header + */ + +#ifndef RBAAREAOPERATOR_HPP +#define RBAAREAOPERATOR_HPP + +#include "RBAAllocatableOperator.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAAreaOperator : public RBAAllocatableOperator +{ +public: + RBAAreaOperator()=default; + RBAAreaOperator(const RBAAreaOperator&)=delete; + RBAAreaOperator(const RBAAreaOperator&&)=delete; + RBAAreaOperator& operator=(const RBAAreaOperator&)=delete; + RBAAreaOperator& operator=(const RBAAreaOperator&&)=delete; + ~RBAAreaOperator()=default; +}; + +} + +#endif diff --git a/src/view/RBAAreaSet.cpp b/src/view/RBAAreaSet.cpp new file mode 100644 index 0000000..5ef8bee --- /dev/null +++ b/src/view/RBAAreaSet.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. + */ +/** + * AreaSet class + */ + +#include "RBAAreaSet.hpp" +#include "RBAArea.hpp" +#include "RBAAllocatable.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAAreaSet::RBAAreaSet(const std::string& name) + : RBARuleObject{name}, + RBAAllocatableSet{name} +{ +} + +const std::list<const RBAArea*>& +RBAAreaSet::getTargets() const +{ + return externAreas_; +} + +void +RBAAreaSet::addTarget(const RBAAllocatable* alloc) +{ + RBAAllocatableSet::addTarget(alloc); + externAreas_.push_back(dynamic_cast<const RBAArea*>(alloc)); +} + +void +RBAAreaSet::clear() +{ + RBAAllocatableSet::clear(); + externAreas_.clear(); +} + +RBAModelElementType +RBAAreaSet::getModelElementType() const +{ + return RBAModelElementType::AreaSet; +} + +} diff --git a/src/view/RBAAreaSet.hpp b/src/view/RBAAreaSet.hpp new file mode 100644 index 0000000..33b9d6b --- /dev/null +++ b/src/view/RBAAreaSet.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. + */ +/** + * AreaSet class header + */ + +#ifndef RBAAREASET_HPP +#define RBAAREASET_HPP + +#include "RBAAllocatableSet.hpp" + +namespace rba +{ + +class RBAArea; +class RBAAreaImpl; + +class DLL_EXPORT RBAAreaSet : public RBAAllocatableSet +{ +public: + explicit RBAAreaSet(const std::string& name=""); + RBAAreaSet(const RBAAreaSet&)=delete; + RBAAreaSet(const RBAAreaSet&&)=delete; + RBAAreaSet& operator=(const RBAAreaSet&)=delete; + RBAAreaSet& operator=(const RBAAreaSet&&)=delete; + virtual ~RBAAreaSet()=default; + +public: + const std::list<const RBAArea*>& 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 RBAArea*> externAreas_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/view/RBAAreaSetMaker.cpp b/src/view/RBAAreaSetMaker.cpp new file mode 100644 index 0000000..f1fdfa6 --- /dev/null +++ b/src/view/RBAAreaSetMaker.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 RBAAreaSetMaker.cpp +/// @brief AreaSet object generation class + +#include "RBAAreaSetMaker.hpp" +#include "RBAAreaSet.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAAreaSetMaker::RBAAreaSetMaker() + : RBARuleObjectMaker{"areasets"}, + RBAAllocatableSetMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBAAreaSetMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAAreaSet>(name); +} + +RBAModelElement* +RBAAreaSetMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + static_cast<void>(RBAAllocatableSetMaker::setProperty(element, jsonElem, model, owner)); + + RBAAreaSet* const areaSet {dynamic_cast<RBAAreaSet*>(element)}; + + model->addAreaSet(areaSet); + + return areaSet; +} + +} diff --git a/src/view/RBAAreaSetMaker.hpp b/src/view/RBAAreaSetMaker.hpp new file mode 100644 index 0000000..0d9e57a --- /dev/null +++ b/src/view/RBAAreaSetMaker.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 RBAAreaSetMaker.hpp +/// @brief AreaSet object generation class header + +#ifndef RBAAREASETMAKER_HPP +#define RBAAREASETMAKER_HPP + +#include "RBAAllocatableSetMaker.hpp" + +namespace rba +{ + +/// @brief AreaSet object generation class +class RBAAreaSetMaker : public RBAAllocatableSetMaker +{ +public: + RBAAreaSetMaker(); + RBAAreaSetMaker(const RBAAreaSetMaker&)=delete; + RBAAreaSetMaker(const RBAAreaSetMaker&&)=delete; + RBAAreaSetMaker& operator=(const RBAAreaSetMaker&)=delete; + RBAAreaSetMaker& operator=(const RBAAreaSetMaker&&)=delete; + virtual ~RBAAreaSetMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBADisplayImpl.cpp b/src/view/RBADisplayImpl.cpp new file mode 100644 index 0000000..0fe6f5b --- /dev/null +++ b/src/view/RBADisplayImpl.cpp @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Display implmentation class + */ + +#include "RBADisplayImpl.hpp" +#include "RBASizeImpl.hpp" +#include "RBAAreaImpl.hpp" + +namespace rba +{ + +RBADisplayImpl::RBADisplayImpl(const std::string& name) + : RBADisplay(), + RBANamedElement{name} +{ +} + +std::string +RBADisplayImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +const RBASize* +RBADisplayImpl::getSize() const +{ + return size_; +} + +const std::list<const RBAArea*>& +RBADisplayImpl::getAreas() const +{ + return getAreaImpls(); +} + +void +RBADisplayImpl::setSize(const RBASizeImpl* const newSize) +{ + size_ = newSize; +} + +void +RBADisplayImpl::addArea(const RBAAreaImpl* area) +{ + areas_.push_back(area); +} + +const std::list<const RBAArea*>& +RBADisplayImpl::getAreaImpls() const +{ + return areas_; +} + +} diff --git a/src/view/RBADisplayImpl.hpp b/src/view/RBADisplayImpl.hpp new file mode 100644 index 0000000..383ab4d --- /dev/null +++ b/src/view/RBADisplayImpl.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. + */ +/** + * Display implmentation class header + */ + +#ifndef RBADISPLAYIMPL_HPP +#define RBADISPLAYIMPL_HPP + +#include "RBADisplay.hpp" +#include "RBANamedElement.hpp" + +namespace rba +{ + +class RBASizeImpl; +class RBAAreaImpl; + +class RBADisplayImpl : public RBADisplay, public RBANamedElement +{ +public: + explicit RBADisplayImpl(const std::string& name); + RBADisplayImpl(const RBADisplayImpl&)=delete; + RBADisplayImpl(const RBADisplayImpl&&)=delete; + RBADisplayImpl& operator=(const RBADisplayImpl&)=delete; + RBADisplayImpl& operator=(const RBADisplayImpl&&)=delete; + virtual ~RBADisplayImpl()=default; + +public: + std::string getName() const override; + const RBASize* getSize() const override; + const std::list<const RBAArea*>& getAreas() const override; + + void setSize(const RBASizeImpl* const newSize); + void addArea(const RBAAreaImpl* area); + const std::list<const RBAArea*>& getAreaImpls() const; + +private: + std::list<const RBAArea*> areas_; + const RBASizeImpl* size_ {nullptr}; + +}; + +} + +#endif diff --git a/src/view/RBADisplayMaker.cpp b/src/view/RBADisplayMaker.cpp new file mode 100644 index 0000000..b7e1206 --- /dev/null +++ b/src/view/RBADisplayMaker.cpp @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// @file RBADisplayMaker.cpp +/// @brief Display object generation class + +#include "RBADisplayMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBADisplayImpl.hpp" +#include "RBASizeMaker.hpp" +#include "RBAPositionContainerMaker.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBADisplayMaker::RBADisplayMaker() + : RBAModelElementMaker::RBAModelElementMaker{"displays"} +{ +} + +std::unique_ptr<RBAModelElement> +RBADisplayMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBADisplayImpl>(name); +} + +RBAModelElement* +RBADisplayMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBADisplayImpl* const display {dynamic_cast<RBADisplayImpl*>(element)}; + + // Set size + RBASizeMaker sizeMaker; + sizeMaker.setFactory(getFactory()); + const RBAModelElement* const size {sizeMaker.create(jsonElem->findChildren("size"), model, + display)}; + display->setSize(dynamic_cast<const RBASizeImpl*>(size)); + + // Set position container + const RBAJsonElement* const jsonPosConts {jsonElem->findChildren("PositionContainer")}; + if(jsonPosConts != nullptr) { + RBAPositionContainerMaker pcMaker; + pcMaker.setFactory(getFactory()); + for(const auto& jsonPosCont : jsonPosConts->getChildren()) { + static_cast<void>(pcMaker.create(jsonPosCont.get(), model, display)); + } + } + + model->addDisplay(display); + + return display; +} + +} diff --git a/src/view/RBADisplayMaker.hpp b/src/view/RBADisplayMaker.hpp new file mode 100644 index 0000000..ee6b5ed --- /dev/null +++ b/src/view/RBADisplayMaker.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 RBADisplayMaker.hpp +/// @brief Display object generation class header + +#ifndef RBADISPLAYMAKER_HPP +#define RBADISPLAYMAKER_HPP + +#include "RBAModelElementMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief Display object generation class +class RBADisplayMaker : public RBAModelElementMaker +{ +public: + RBADisplayMaker(); + RBADisplayMaker(const RBADisplayMaker&)=delete; + RBADisplayMaker(const RBADisplayMaker&&)=delete; + RBADisplayMaker& operator=(const RBADisplayMaker&)=delete; + RBADisplayMaker& operator=(const RBADisplayMaker&&)=delete; + virtual ~RBADisplayMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBADisplayingContent.cpp b/src/view/RBADisplayingContent.cpp new file mode 100644 index 0000000..003e3c3 --- /dev/null +++ b/src/view/RBADisplayingContent.cpp @@ -0,0 +1,138 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * Displaying content class + */ + +#include "RBADisplayingContent.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 +RBADisplayingContent::accept(RBAExpressionVisitor& visitor) +{ + // RBASceneAllocatableCollector, the only existing visitor at this time, + // does not accept Content, so it does not pass this path. + // This is implemented because another visitor may accept it in the future. + visitor.visit(*this); +} + +RBAModelElementType +RBADisplayingContent::getModelElementType() const +{ + return RBAModelElementType::DisplayingContent; +} + +const RBARuleObject* +RBADisplayingContent::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 Displayed Content"; + } else { + resultText = "is before arbitrate skip"; + } + } else { + resultText = "has Displayed Content[" + object->getElementName() + "]"; + } + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(pre) + "Area[" + operandName + "] " + resultText); +#endif + return object; +} + +#ifdef RBA_USE_LOG +const std::string +RBADisplayingContent::getSymbol() const +{ + return ".displayingContent()"; +} + +void +RBADisplayingContent::createHierarchy() +{ + getLhsOperand()->createHierarchy(); +} + +RBAExpressionType +RBADisplayingContent::getUnderlyingType() const +{ + return RBAExpressionType::CONTENT; +} +#endif + +} diff --git a/src/view/RBADisplayingContent.hpp b/src/view/RBADisplayingContent.hpp new file mode 100644 index 0000000..0bcbf5a --- /dev/null +++ b/src/view/RBADisplayingContent.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. + */ +/** + * Displaying content class header + */ + +#ifndef RBADISPLAYINGCONTENT_HPP +#define RBADISPLAYINGCONTENT_HPP + +#include <string> +#include "RBAAreaOperator.hpp" + +namespace rba +{ + +class DLL_EXPORT RBADisplayingContent : public RBAAreaOperator +{ +public: + RBADisplayingContent()=default; + RBADisplayingContent(const RBADisplayingContent&)=delete; + RBADisplayingContent(const RBADisplayingContent&&)=delete; + RBADisplayingContent& operator=(const RBADisplayingContent&)=delete; + RBADisplayingContent& operator=(const RBADisplayingContent&&)=delete; + virtual ~RBADisplayingContent()=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/view/RBADisplayingContentMaker.cpp b/src/view/RBADisplayingContentMaker.cpp new file mode 100644 index 0000000..0606263 --- /dev/null +++ b/src/view/RBADisplayingContentMaker.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 RBADisplayingContentMaker.cpp +/// @brief DisplayingContent object generation class + +#include <iostream> +#include "RBADisplayingContentMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBADisplayingContent.hpp" + +namespace rba +{ + +RBADisplayingContentMaker::RBADisplayingContentMaker() + : RBAOperatorMaker{"DisplayingContent"} +{ +} + +std::unique_ptr<RBAModelElement> +RBADisplayingContentMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBADisplayingContent>(); +} + +} diff --git a/src/view/RBADisplayingContentMaker.hpp b/src/view/RBADisplayingContentMaker.hpp new file mode 100644 index 0000000..4624651 --- /dev/null +++ b/src/view/RBADisplayingContentMaker.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 RBADisplayingContentMaker.hpp +/// @brief DisplayingContent object generation class header + +#ifndef RBADISPLAYINGCONTENTMAKER_HPP +#define RBADISPLAYINGCONTENTMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief DisplayingContent object generation class +class RBADisplayingContentMaker : public RBAOperatorMaker +{ +public: + RBADisplayingContentMaker(); + RBADisplayingContentMaker(const RBADisplayingContentMaker&)=delete; + RBADisplayingContentMaker(const RBADisplayingContentMaker&&)=delete; + RBADisplayingContentMaker& operator=(const RBADisplayingContentMaker&)=delete; + RBADisplayingContentMaker& operator=(const RBADisplayingContentMaker&&)=delete; + virtual ~RBADisplayingContentMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return unique_ptr for instance + std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override; + +}; + +} + +#endif diff --git a/src/view/RBAIsDisplayed.cpp b/src/view/RBAIsDisplayed.cpp new file mode 100644 index 0000000..34a445d --- /dev/null +++ b/src/view/RBAIsDisplayed.cpp @@ -0,0 +1,146 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsDisplayed class + +#include "RBAIsDisplayed.hpp" + +#include "RBAExpression.hpp" +#include "RBAAllocatable.hpp" +#include "RBARuleObject.hpp" +#include "RBAContentState.hpp" +#include "RBAArbitrator.hpp" +#include "RBAResultImpl.hpp" +#include "RBAContent.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAExpressionType.hpp" +#include "RBAConstraintInfo.hpp" + +namespace rba +{ + +void RBAIsDisplayed::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsDisplayed::getModelElementType() const +{ + return RBAModelElementType::IsDisplayed; +} + +bool +RBAIsDisplayed::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 allocatable {dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())}; + info->addOperandAllocatable(allocatable); + if (ruleObj->isPrevious() == true) { + if ((arb->getResult()->isPreHidden(allocatable) == false) + && (arb->getResult()->getPreAllocatedContentState(allocatable) + != nullptr)) { + isPassed = true; + } + } else { + if ((allocatable->isHiddenChecked() == true) + && (allocatable->isHidden() == true)) { + info->addFalseAllocatable(allocatable); + } else { + if (allocatable->isChecked() == true) { + if (allocatable->getState() != nullptr) { + info->addTrueAllocatable(allocatable); + isPassed = true; + } else { + info->addFalseAllocatable(allocatable); + } + } else { + info->setExceptionBeforeArbitrate(true); + } + } + } + } +#ifdef RBA_USE_LOG + std::string lhsName; + const RBAAllocatable* allocatable = nullptr; + if (ruleObj == nullptr) { + // At the moment, there is no expression that returns null as Allocatable, + // so it will not go through this path. + // but in the future, an expression that returns null may be added + // so this is implemented. + lhsName = "NULL"; + } else { + allocatable = dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject()); + lhsName = allocatable->getElementName(); + } + if (info->isExceptionBeforeArbitrate() == true) { + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Area[" + lhsName + + "] 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(allocatable); + } else { + contentState = allocatable->getState(); + } + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Area[" + lhsName + + "] is Displayed Content[" + + contentState->getOwner()->getElementName() + + "::" + contentState->getElementName() + "]"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Area[" + lhsName + + "] is not Displayed"); + 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 +RBAIsDisplayed::getSymbol() const +{ + return ".isDisplayed()"; +} + +RBAExpressionType +RBAIsDisplayed::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/view/RBAIsDisplayed.hpp b/src/view/RBAIsDisplayed.hpp new file mode 100644 index 0000000..a991588 --- /dev/null +++ b/src/view/RBAIsDisplayed.hpp @@ -0,0 +1,53 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsDisplayed class header + +#ifndef RBAISDISPLAYED_HPP +#define RBAISDISPLAYED_HPP + +#include "RBAAreaOperator.hpp" + +namespace rba +{ + +class RBAExpression; + +class DLL_EXPORT RBAIsDisplayed : public RBAAreaOperator +{ +public: + RBAIsDisplayed()=default; + RBAIsDisplayed(const RBAIsDisplayed&)=delete; + RBAIsDisplayed(const RBAIsDisplayed&&)=delete; + RBAIsDisplayed& operator=(const RBAIsDisplayed&)=delete; + RBAIsDisplayed& operator=(const RBAIsDisplayed&&)=delete; + virtual ~RBAIsDisplayed()=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/view/RBAIsDisplayedMaker.cpp b/src/view/RBAIsDisplayedMaker.cpp new file mode 100644 index 0000000..a47b97f --- /dev/null +++ b/src/view/RBAIsDisplayedMaker.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 RBAIsDisplayedMaker.cpp +/// @brief IsDisplayed object generation class + +#include <iostream> +#include "RBAIsDisplayedMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsDisplayed.hpp" + +namespace rba +{ + +RBAIsDisplayedMaker::RBAIsDisplayedMaker() + : RBAOperatorMaker{"IsDisplayed"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsDisplayedMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsDisplayed>(); +} + +} diff --git a/src/view/RBAIsDisplayedMaker.hpp b/src/view/RBAIsDisplayedMaker.hpp new file mode 100644 index 0000000..836602b --- /dev/null +++ b/src/view/RBAIsDisplayedMaker.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 RBAIsDisplayedMaker.hpp +/// @brief IsDisplayed object generation class header + +#ifndef RBAISDISPLAYEDMAKER_HPP +#define RBAISDISPLAYEDMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsDisplayed object generation class +class RBAIsDisplayedMaker : public RBAOperatorMaker +{ +public: + RBAIsDisplayedMaker(); + RBAIsDisplayedMaker(const RBAIsDisplayedMaker&)=delete; + RBAIsDisplayedMaker(const RBAIsDisplayedMaker&&)=delete; + RBAIsDisplayedMaker& operator=(const RBAIsDisplayedMaker&)=delete; + RBAIsDisplayedMaker& operator=(const RBAIsDisplayedMaker&&)=delete; + virtual ~RBAIsDisplayedMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return unique_ptr for instance + std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override; + +}; + +} + +#endif diff --git a/src/view/RBAIsHidden.cpp b/src/view/RBAIsHidden.cpp new file mode 100644 index 0000000..f33c3ed --- /dev/null +++ b/src/view/RBAIsHidden.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. + */ +/// IsHidden class + +#include "RBAIsHidden.hpp" + +#include "RBAArbitrator.hpp" +#include "RBAAllocatable.hpp" +#include "RBAExpressionVisitor.hpp" +#include "RBAResultImpl.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAExpressionType.hpp" +#include "RBAConstraintInfo.hpp" + +namespace rba +{ + +void RBAIsHidden::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsHidden::getModelElementType() const +{ + return RBAModelElementType::IsHidden; +} + +bool +RBAIsHidden::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 area {dynamic_cast<const RBAAllocatable*>(ruleObj->getRawObject())}; + info->addOperandAllocatable(area); + if (ruleObj->isPrevious() == false) { + if (area->isHiddenChecked() == false) { + info->setExceptionBeforeArbitrate(true); + } else if (area->isHidden() == true) { + isPassed = true; + info->addTrueAllocatable(area); + } else { + info->addFalseAllocatable(area); + } + } else { + isPassed = arb->getResult()->isPreHidden(area); + } + } +#ifdef RBA_USE_LOG + if (ruleObj != nullptr) { + const RBAAllocatable* area = dynamic_cast<const RBAAllocatable*>(ruleObj + ->getRawObject()); + if (info->isExceptionBeforeArbitrate() == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + area->getElementName() + getSymbol() + + "] before arbitrate skip"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::SKIP); + } else if (isPassed == true) { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + area->getElementName() + + getSymbol() + "] true"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " [" + getPreMsg(ruleObj->isPrevious()) + area->getElementName() + + getSymbol() + "] false"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::FALSE); + } + } else { + // At the moment, there is no expression that returns null as Allocatable, + // so it will not go through this path. + // but in the future, an expression that returns null may be added + // so this is implemented. + 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 +RBAIsHidden::getSymbol() const +{ + return ".isHidden()"; +} + +RBAExpressionType +RBAIsHidden::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/view/RBAIsHidden.hpp b/src/view/RBAIsHidden.hpp new file mode 100644 index 0000000..ab33826 --- /dev/null +++ b/src/view/RBAIsHidden.hpp @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsHidden class header + +#ifndef RBAISHIDDEN_HPP +#define RBAISHIDDEN_HPP + +#include <string> +#include "RBAAreaOperator.hpp" + +namespace rba +{ + +class RBAExpression; + +class DLL_EXPORT RBAIsHidden : public RBAAreaOperator +{ +public: + RBAIsHidden()=default; + RBAIsHidden(const RBAIsHidden&)=delete; + RBAIsHidden(const RBAIsHidden&&)=delete; + RBAIsHidden& operator=(const RBAIsHidden&)=delete; + RBAIsHidden& operator=(const RBAIsHidden&&)=delete; + virtual ~RBAIsHidden()=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/view/RBAIsHiddenMaker.cpp b/src/view/RBAIsHiddenMaker.cpp new file mode 100644 index 0000000..398074a --- /dev/null +++ b/src/view/RBAIsHiddenMaker.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 RBAIsHiddenMaker.cpp +/// @brief IsHidden object generation class + +#include <iostream> +#include "RBAIsHiddenMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsHidden.hpp" + +namespace rba +{ + +RBAIsHiddenMaker::RBAIsHiddenMaker() + : RBAOperatorMaker{"IsHidden"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsHiddenMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsHidden>(); +} + +} diff --git a/src/view/RBAIsHiddenMaker.hpp b/src/view/RBAIsHiddenMaker.hpp new file mode 100644 index 0000000..c782674 --- /dev/null +++ b/src/view/RBAIsHiddenMaker.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 RBAIsHiddenMaker.hpp +/// @brief IsHidden object generation class header + +#ifndef RBAISHIDDENMAKER_HPP +#define RBAISHIDDENMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsHidden object generation class +class RBAIsHiddenMaker : public RBAOperatorMaker +{ +public: + RBAIsHiddenMaker(); + RBAIsHiddenMaker(const RBAIsHiddenMaker&)=delete; + RBAIsHiddenMaker(const RBAIsHiddenMaker&&)=delete; + RBAIsHiddenMaker& operator=(const RBAIsHiddenMaker&)=delete; + RBAIsHiddenMaker& operator=(const RBAIsHiddenMaker&&)=delete; + virtual ~RBAIsHiddenMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return unique_ptr for instance + std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override; + +}; + +} + +#endif diff --git a/src/view/RBAIsVisible.cpp b/src/view/RBAIsVisible.cpp new file mode 100644 index 0000000..8ebfac7 --- /dev/null +++ b/src/view/RBAIsVisible.cpp @@ -0,0 +1,157 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsVisible class + +#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 "RBAIsVisible.hpp" +#include "RBALogManager.hpp" +#include "RBAModelElementType.hpp" +#include "RBAResultImpl.hpp" + +namespace rba +{ + +void RBAIsVisible::accept(RBAExpressionVisitor& visitor) +{ + visitor.visit(*this); +} + +RBAModelElementType +RBAIsVisible::getModelElementType() const +{ + return RBAModelElementType::IsVisible; +} + +bool +RBAIsVisible::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)}; + 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); + const RBAContentState* const allocateContentState {allocatable->getState()}; + if (allocatable->isChecked() == true) { + 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 (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[NULL] is not Visible"); + } else { + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Content[" + + content->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()->getPreActiveState(content); + } else { + contentState = arb->getResult()->getActiveState(content); + } + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Content[" + + content->getElementName() + "::" + contentState->getElementName() + + "] is Visible"); + LOG_coverageConstraintExpressionLog(LOG_getCoverageExpressionText(), + RBAExecuteResult::TRUE); + } else { + LOG_arbitrateConstraintLogicLogLine( + " " + getPreMsg(ruleObj->isPrevious()) + "Content[" + + content->getElementName() + "] is not Visible"); + 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 +RBAIsVisible::getSymbol() const +{ + return ".isVisible()"; +} + +RBAExpressionType +RBAIsVisible::getUnderlyingType() const +{ + return RBAExpressionType::BOOLEAN; +} +#endif + +} diff --git a/src/view/RBAIsVisible.hpp b/src/view/RBAIsVisible.hpp new file mode 100644 index 0000000..a919519 --- /dev/null +++ b/src/view/RBAIsVisible.hpp @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// IsVisible class header + +#ifndef RBAISVISIBLE_HPP +#define RBAISVISIBLE_HPP + +#include <string> +#include "RBAViewContentOperator.hpp" + +namespace rba +{ + +class RBAViewContentImpl; + +class DLL_EXPORT RBAIsVisible : public RBAViewContentOperator +{ +public: + RBAIsVisible()=default; + RBAIsVisible(const RBAIsVisible&)=delete; + RBAIsVisible(const RBAIsVisible&&)=delete; + RBAIsVisible& operator=(const RBAIsVisible&)=delete; + RBAIsVisible& operator=(const RBAIsVisible&&)=delete; + virtual ~RBAIsVisible()=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/view/RBAIsVisibleMaker.cpp b/src/view/RBAIsVisibleMaker.cpp new file mode 100644 index 0000000..5b42220 --- /dev/null +++ b/src/view/RBAIsVisibleMaker.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 RBAIsVisibleMaker.cpp +/// @brief IsVisible objct generation class + +#include <iostream> +#include "RBAIsVisibleMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" +#include "RBAIsVisible.hpp" + +namespace rba +{ + +RBAIsVisibleMaker::RBAIsVisibleMaker() + : RBAOperatorMaker{"IsVisible"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAIsVisibleMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAIsVisible>(); +} + +} diff --git a/src/view/RBAIsVisibleMaker.hpp b/src/view/RBAIsVisibleMaker.hpp new file mode 100644 index 0000000..81e0175 --- /dev/null +++ b/src/view/RBAIsVisibleMaker.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 RBAIsVisibleMaker.hpp +/// @brief IsVisible objct generation class header + +#ifndef RBAISVISIBLEMAKER_HPP +#define RBAISVISIBLEMAKER_HPP + +#include "RBAOperatorMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief IsVisible objct generation class +class RBAIsVisibleMaker : public RBAOperatorMaker +{ +public: + RBAIsVisibleMaker(); + RBAIsVisibleMaker(const RBAIsVisibleMaker&)=delete; + RBAIsVisibleMaker(const RBAIsVisibleMaker&&)=delete; + RBAIsVisibleMaker& operator=(const RBAIsVisibleMaker&)=delete; + RBAIsVisibleMaker& operator=(const RBAIsVisibleMaker&&)=delete; + virtual ~RBAIsVisibleMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return unique_ptr for instance + std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override; + +}; + +} + +#endif diff --git a/src/view/RBAPositionContainerImpl.cpp b/src/view/RBAPositionContainerImpl.cpp new file mode 100644 index 0000000..5343336 --- /dev/null +++ b/src/view/RBAPositionContainerImpl.cpp @@ -0,0 +1,103 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * PositionContainerImpl class + */ + +#include "RBAPositionContainerImpl.hpp" +#include "RBAAreaImpl.hpp" + +namespace rba +{ + +std::int32_t +RBAPositionContainerImpl::getX() const +{ + return x_; +} + +void +RBAPositionContainerImpl::setX(const std::int32_t newX) +{ + x_ = newX; +} + +std::int32_t +RBAPositionContainerImpl::getY() const +{ + return y_; +} + +void +RBAPositionContainerImpl::setY(const std::int32_t newY) +{ + y_ = newY; +} + +RBABasePoint +RBAPositionContainerImpl::getBasePoint() const +{ + return basePoint_; +} + +void +RBAPositionContainerImpl::setBasePoint(const RBABasePoint newBasePoint) +{ + basePoint_ = newBasePoint; +} + +const RBAArea* +RBAPositionContainerImpl::getArea() const +{ + return getAreaImpl(); +} + +void +RBAPositionContainerImpl::setArea(const RBAAreaImpl* const newArea) +{ + area_ = newArea; +} + +const RBAAreaImpl* +RBAPositionContainerImpl::getAreaImpl() const +{ + return area_; +} + +void +RBAPositionContainerImpl::addOffset(const std::string& sizeName, + std::int32_t offsetX, std::int32_t offsetY) +{ + sizeToOffset_[sizeName] = std::make_pair(offsetX, offsetY); +} + +std::pair<std::int32_t, std::int32_t> +RBAPositionContainerImpl::getOffset(const std::string& sizeName) const +{ + std::pair<std::int32_t, std::int32_t> offset; + + auto it = sizeToOffset_.find(sizeName); + if(it != sizeToOffset_.end()) { + offset = it->second; + } + else { + offset = std::make_pair(0, 0); + } + + return offset; +} + +} diff --git a/src/view/RBAPositionContainerImpl.hpp b/src/view/RBAPositionContainerImpl.hpp new file mode 100644 index 0000000..1f37e17 --- /dev/null +++ b/src/view/RBAPositionContainerImpl.hpp @@ -0,0 +1,70 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * PositionContainerImpl class header + */ + +#ifndef RBAPOSITIONCONTAINERIMPL_HPP +#define RBAPOSITIONCONTAINERIMPL_HPP + +#include <string> +#include <cstdint> +#include <unordered_map> +#include "RBAPositionContainer.hpp" +#include "RBAModelElement.hpp" + +namespace rba +{ + +class RBAAreaImpl; + +class RBAPositionContainerImpl : public RBAPositionContainer, + public RBAModelElement +{ +public: + RBAPositionContainerImpl()=default; + RBAPositionContainerImpl(const RBAPositionContainerImpl&)=delete; + RBAPositionContainerImpl(const RBAPositionContainerImpl&&)=delete; + RBAPositionContainerImpl& operator=(const RBAPositionContainerImpl&)=delete; + RBAPositionContainerImpl& operator=(const RBAPositionContainerImpl&&)=delete; + virtual ~RBAPositionContainerImpl()=default; + +public: + std::int32_t getX() const override; + std::int32_t getY() const override; + RBABasePoint getBasePoint() const override; + const RBAArea* getArea() const override; + void setX(const std::int32_t newX); + void setY(const std::int32_t newY); + void setBasePoint(const RBABasePoint newBasePoint); + void setArea(const RBAAreaImpl* const newArea); + const RBAAreaImpl* getAreaImpl() const; + void addOffset(const std::string& sizeName, + std::int32_t offsetX, std::int32_t offsetY); + std::pair<std::int32_t, std::int32_t> getOffset(const std::string& sizeName) const; + +private: + std::int32_t x_ {X_EDEFAULT}; + std::int32_t y_ {Y_EDEFAULT}; + RBABasePoint basePoint_ {BASE_POINT_EDEFAULT}; + const RBAAreaImpl* area_{nullptr}; + std::unordered_map<std::string, std::pair<std::int32_t, std::int32_t>> sizeToOffset_; + +}; + +} + +#endif diff --git a/src/view/RBAPositionContainerMaker.cpp b/src/view/RBAPositionContainerMaker.cpp new file mode 100644 index 0000000..c2dd6db --- /dev/null +++ b/src/view/RBAPositionContainerMaker.cpp @@ -0,0 +1,125 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 RBAPositionContainerMaker.cpp +/// @brief PositionContainer object generation class + +#include "RBAPositionContainerMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAPositionContainerImpl.hpp" +#include "RBASizeMaker.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAPositionContainerMaker::RBAPositionContainerMaker() + : RBAModelElementMaker::RBAModelElementMaker{"PositionContainer"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAPositionContainerMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAPositionContainerImpl>(); +} + +RBAModelElement* +RBAPositionContainerMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBAPositionContainerImpl* const posCont + {dynamic_cast<RBAPositionContainerImpl*>(element)}; + + // Set areaReference and x,y + std::int32_t x {-1}; + std::int32_t y {-1}; + const RBAJsonElement* const areaRef {jsonElem->findChildren("areaReference")}; + RBAAreaImpl* const area {const_cast<RBAAreaImpl*>(model->findAreaImpl(areaRef->getString()))}; + //// set area to owner + RBADisplayImpl* const display {dynamic_cast<RBADisplayImpl*>(owner)}; + display->addArea(area); + //// set default x,y to area + const RBAJsonElement* const elemX {jsonElem->findChildren("x")}; + if(elemX != nullptr) { + x = elemX->getInt(); + area->setDefaultX(x); + } + const RBAJsonElement* const elemY {jsonElem->findChildren("y")}; + if(elemY != nullptr) { + y = elemY->getInt(); + area->setDefaultY(y); + } + posCont->setArea(area); + posCont->setX(x); + posCont->setY(y); + + // Set basePoint + const std::string basePoint {jsonElem->findChildren("basePoint")->getString()}; + RBABasePoint basePointVal{RBAPositionContainer::BASE_POINT_EDEFAULT}; + if(basePoint == "LEFT_TOP") { + basePointVal = RBABasePoint::LEFT_TOP; + } else if(basePoint == "LEFT_MIDDLE") { + basePointVal = RBABasePoint::LEFT_MIDDLE; + } else if(basePoint == "LEFT_BOTTOM") { + basePointVal = RBABasePoint::LEFT_BOTTOM; + } else if(basePoint == "RIGHT_TOP") { + basePointVal = RBABasePoint::RIGHT_TOP; + } else if(basePoint == "RIGHT_MIDDLE") { + basePointVal = RBABasePoint::RIGHT_MIDDLE; + } else if(basePoint == "RIGHT_BOTTOM") { + basePointVal = RBABasePoint::RIGHT_BOTTOM; + } else if(basePoint == "CENTER_TOP") { + basePointVal = RBABasePoint::CENTER_TOP; + } else if(basePoint == "CENTER_MIDDLE") { + basePointVal = RBABasePoint::CENTER_MIDDLE; + } else if(basePoint == "CENTER_BOTTOM") { + basePointVal = RBABasePoint::CENTER_BOTTOM; + } else { + ; + } + posCont->setBasePoint(basePointVal); + + // Set offset + const RBAJsonElement* const offsets {jsonElem->findChildren("Offset")}; + if(offsets != nullptr) { + for(const auto& offset : offsets->getChildren()) { + const RBAJsonElement* const elemSizeRef {offset->findChildren("sizeReference")}; + if(elemSizeRef != nullptr) { + std::int32_t offsetX {-1}; + const RBAJsonElement* const elemOffsetX {offset->findChildren("x")}; + if(elemOffsetX != nullptr) { + offsetX = elemOffsetX->getInt(); + } + std::int32_t offsetY {-1}; + const RBAJsonElement* const elemOffsetY {offset->findChildren("y")}; + if(elemOffsetY != nullptr) { + offsetY = elemOffsetY->getInt(); + } + posCont->addOffset(elemSizeRef->getString(), offsetX, offsetY); + } + } + } + + model->addPositionContainer(posCont); + + return posCont; +} + +} diff --git a/src/view/RBAPositionContainerMaker.hpp b/src/view/RBAPositionContainerMaker.hpp new file mode 100644 index 0000000..3cfad0b --- /dev/null +++ b/src/view/RBAPositionContainerMaker.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 RBAPositionContainerMaker.hpp +/// @brief PositionContainer object generation class header + +#ifndef RBAPOSITIONCONTAINERMAKER_HPP +#define RBAPOSITIONCONTAINERMAKER_HPP + +#include "RBAModelElementMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief PositionContainer object generation class +class RBAPositionContainerMaker : public RBAModelElementMaker +{ +public: + RBAPositionContainerMaker(); + RBAPositionContainerMaker(const RBAPositionContainerMaker&)=delete; + RBAPositionContainerMaker(const RBAPositionContainerMaker&&)=delete; + RBAPositionContainerMaker& operator=(const RBAPositionContainerMaker&)=delete; + RBAPositionContainerMaker& operator=(const RBAPositionContainerMaker&&)=delete; + virtual ~RBAPositionContainerMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBASizeImpl.cpp b/src/view/RBASizeImpl.cpp new file mode 100644 index 0000000..d57b5ef --- /dev/null +++ b/src/view/RBASizeImpl.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. + */ +/** + * Size information implementation class + */ + +#include "RBASizeImpl.hpp" + +namespace rba +{ + +RBASizeImpl::RBASizeImpl(const std::string& name) + : RBASize(), + RBANamedElement{name} +{ +} + +std::string +RBASizeImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +std::int32_t +RBASizeImpl::getWidth() const +{ + return width_; +} + +std::int32_t +RBASizeImpl::getHeight() const +{ + return height_; +} + +void +RBASizeImpl::setWidth(const std::int32_t newWidth) +{ + width_ = newWidth; +} + +void +RBASizeImpl::setHeight(const std::int32_t newHeight) +{ + height_ = newHeight; +} + +std::int32_t +RBASizeImpl::diff(const RBASizeImpl* const size) const +{ + std::int32_t w {width_ - size->getWidth()}; + if(w < 0) { + w = -w; + } + std::int32_t h {height_ - size->getHeight()}; + if(h < 0) { + h = -h; + } + + return w + h; +} + +} diff --git a/src/view/RBASizeImpl.hpp b/src/view/RBASizeImpl.hpp new file mode 100644 index 0000000..e5d46e0 --- /dev/null +++ b/src/view/RBASizeImpl.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. + */ +/** + * Size information implementation class header + */ + +#ifndef RBASIZEIMPL_HPP +#define RBASIZEIMPL_HPP + +#include "RBASize.hpp" +#include "RBANamedElement.hpp" + +namespace rba +{ + +class RBASizeImpl : public RBASize, public RBANamedElement +{ +public: + explicit RBASizeImpl(const std::string& name=""); + RBASizeImpl(const RBASizeImpl&)=default; + RBASizeImpl(RBASizeImpl&&)=default; + RBASizeImpl& operator=(const RBASizeImpl&)=default; + RBASizeImpl& operator=(RBASizeImpl&&)=default; + virtual ~RBASizeImpl()=default; + +public: + std::string getName() const override; + std::int32_t getWidth() const override; + std::int32_t getHeight() const override; + + void setWidth(const std::int32_t newWidth); + void setHeight(const std::int32_t newHeight); + + std::int32_t diff(const RBASizeImpl* const size) const; + +private: + std::int32_t width_ {WIDTH_EDEFAULT}; + std::int32_t height_ {HEIGHT_EDEFAULT}; + +}; + +} + +#endif diff --git a/src/view/RBASizeMaker.cpp b/src/view/RBASizeMaker.cpp new file mode 100644 index 0000000..0cf38f1 --- /dev/null +++ b/src/view/RBASizeMaker.cpp @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT 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 RBASizeMaker.cpp +/// @brief Size information object generation class + +#include "RBASizeMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBASizeImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBASizeMaker::RBASizeMaker() + : RBAModelElementMaker::RBAModelElementMaker{"Size"} +{ +} + +RBAModelElement* +RBASizeMaker::create(const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + std::unique_ptr<RBAModelElement> inst + {createInstance(jsonElem->findChildren("name")->getString())}; + const auto element = inst.get(); + static_cast<void>(model->addSizeInstance(dynamic_cast<RBANamedElement*>(owner)->getElementName(), std::move(inst))); + + return setProperty(element, jsonElem, model, owner); +} + +std::unique_ptr<RBAModelElement> +RBASizeMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBASizeImpl>(name); +} + +RBAModelElement* +RBASizeMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + RBASizeImpl* const size {dynamic_cast<RBASizeImpl*>(element)}; + + // Set width + size->setWidth(jsonElem->findChildren("width")->getInt()); + // Set height + size->setHeight(jsonElem->findChildren("height")->getInt()); + + return size; +} + +} diff --git a/src/view/RBASizeMaker.hpp b/src/view/RBASizeMaker.hpp new file mode 100644 index 0000000..58ba99b --- /dev/null +++ b/src/view/RBASizeMaker.hpp @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// @file RBASizeMaker.hpp +/// @brief Size information object generation class header + +#ifndef RBASIZEMAKER_HPP +#define RBASIZEMAKER_HPP + +#include "RBAModelElementMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief Size information object generation class +class RBASizeMaker : public RBAModelElementMaker +{ +public: + RBASizeMaker(); + RBASizeMaker(const RBASizeMaker&)=delete; + RBASizeMaker(const RBASizeMaker&&)=delete; + RBASizeMaker& operator=(const RBASizeMaker&)=delete; + RBASizeMaker& operator=(const RBASizeMaker&&)=delete; + virtual ~RBASizeMaker()=default; + +public: + /// @brief Create ModelElement object + /// @details Create ModelElement object and register unique_ptr to model. + /// @param[in] jsonElem JSON element of ModelElement + /// @param[in] model The model to store generated object + /// @param[in,out] owner Parent object (Not in use) + /// @return ModelElement object + RBAModelElement* create(const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBAViewContent.cpp b/src/view/RBAViewContent.cpp new file mode 100644 index 0000000..f32960e --- /dev/null +++ b/src/view/RBAViewContent.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. + */ +/** + * ViewContent class + */ + +#include "RBAViewContent.hpp" + +namespace rba +{ + +} diff --git a/src/view/RBAViewContentImpl.cpp b/src/view/RBAViewContentImpl.cpp new file mode 100644 index 0000000..8437dd5 --- /dev/null +++ b/src/view/RBAViewContentImpl.cpp @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * View Content implmentation class + */ + +#include "RBAViewContentImpl.hpp" + +#include "RBAAreaImpl.hpp" +#include "RBASizeImpl.hpp" +#include "RBAViewContentStateImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAViewContentImpl::RBAViewContentImpl(const std::string& name) + : RBARuleObject{name}, + RBAViewContent(), + RBAContent{name} +{ +} + +/** + * Return true if RBAViewContent + */ +bool +RBAViewContentImpl::isViewContent() const +{ + return true; +} + +std::string +RBAViewContentImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +const std::list<const RBAViewContentState*>& +RBAViewContentImpl::getContentStates() const +{ + if(externStates_.size() == 0U) { + for(const RBAContentState* state : getStates()) { + externStates_.push_back(dynamic_cast<const RBAViewContentStateImpl*>(state)); + } + } + return externStates_; +} + +const std::list<const RBAArea*>& +RBAViewContentImpl::getAreas() const +{ + if(externAreas_.size() == 0U) { + for(const RBAAllocatable* allocatable : getAllocatables()) { + externAreas_.push_back(dynamic_cast<const RBAAreaImpl*>(allocatable)); + } + } + return externAreas_; +} + +const std::list<const RBASize*>& +RBAViewContentImpl::getSizes() const +{ + return externSizes_; +} + +RBAContentLoserType +RBAViewContentImpl::getLoserType() const +{ + return getContentLoserType(); +} + +void +RBAViewContentImpl::addSize(const RBASizeImpl* size) +{ + externSizes_.push_back(size); +} + +RBAModelElementType +RBAViewContentImpl::getModelElementType() const +{ + return RBAModelElementType::ViewContent; +} + +#ifdef RBA_USE_LOG +std::string +RBAViewContentImpl::getSymbol() const +{ + return "ViewContent"; +} + +std::string +RBAViewContentImpl::getVisibleSymbol() const +{ + return "visible"; +} +#endif + +} diff --git a/src/view/RBAViewContentImpl.hpp b/src/view/RBAViewContentImpl.hpp new file mode 100644 index 0000000..d3df5cd --- /dev/null +++ b/src/view/RBAViewContentImpl.hpp @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * View Content implmentation class header + */ + +#ifndef RBAVIEWCONTENTIMPL_HPP +#define RBAVIEWCONTENTIMPL_HPP + +#include <string> +#include "RBAViewContent.hpp" +#include "RBAContent.hpp" + +namespace rba +{ + +class RBAViewContentState; +class RBAArea; +class RBASize; +class RBASizeImpl; + +class DLL_EXPORT RBAViewContentImpl : public RBAViewContent, public RBAContent +{ +public: + explicit RBAViewContentImpl(const std::string& name=""); + RBAViewContentImpl(const RBAViewContentImpl&)=delete; + RBAViewContentImpl(const RBAViewContentImpl&&)=delete; + RBAViewContentImpl& operator=(const RBAViewContentImpl&)=delete; + RBAViewContentImpl& operator=(const RBAViewContentImpl&&)=delete; + virtual ~RBAViewContentImpl()=default; + +public: + bool isViewContent() const override; + std::string getName() const override; + const std::list<const RBAViewContentState*>& getContentStates() const override; + const std::list<const RBAArea*>& getAreas() const override; + const std::list<const RBASize*>& getSizes() const override; + RBAContentLoserType getLoserType() const override; + + void addSize(const RBASizeImpl* size); + 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 RBAArea*> externAreas_; + mutable std::list<const RBASize*> externSizes_; + mutable std::list<const RBAViewContentState*> externStates_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/view/RBAViewContentMaker.cpp b/src/view/RBAViewContentMaker.cpp new file mode 100644 index 0000000..5a3cc87 --- /dev/null +++ b/src/view/RBAViewContentMaker.cpp @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// @file RBAViewContentMaker.cpp +/// @brief ViewContent object generation class + +#include "RBAViewContentMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAViewContentImpl.hpp" +#include "RBASizeMaker.hpp" +#include "RBAViewContentStateMaker.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAViewContentMaker::RBAViewContentMaker() + : RBARuleObjectMaker{"viewcontents"}, + RBAContentMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBAViewContentMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAViewContentImpl>(name); +} + +RBAModelElement* +RBAViewContentMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + element = RBAContentMaker::setProperty(element, jsonElem, model, owner); + if(element == nullptr) { + return nullptr; + } + + RBAViewContentImpl* const content {dynamic_cast<RBAViewContentImpl*>(element)}; + + // size + RBASizeMaker szMaker; + szMaker.setFactory(getFactory()); + for(auto& size : jsonElem->findChildren("size")->getChildren()) { + const auto sizeInst = szMaker.create(size.get(), model, content); + content->addSize(dynamic_cast<RBASizeImpl*>(sizeInst)); + } + + return content; +} + +} diff --git a/src/view/RBAViewContentMaker.hpp b/src/view/RBAViewContentMaker.hpp new file mode 100644 index 0000000..e5abe5f --- /dev/null +++ b/src/view/RBAViewContentMaker.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 RBAViewContentMaker.hpp +/// @brief ViewContent object generation class header + +#ifndef RBAVIEWCONTENTMAKER_HPP +#define RBAVIEWCONTENTMAKER_HPP + +#include "RBAContentMaker.hpp" + +namespace rba +{ + +/// @brief ViewContent object generation class +class RBAViewContentMaker : public RBAContentMaker +{ +public: + RBAViewContentMaker(); + RBAViewContentMaker(const RBAViewContentMaker&)=delete; + RBAViewContentMaker(const RBAViewContentMaker&&)=delete; + RBAViewContentMaker& operator=(const RBAViewContentMaker&)=delete; + RBAViewContentMaker& operator=(const RBAViewContentMaker&&)=delete; + virtual ~RBAViewContentMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBAViewContentOperator.cpp b/src/view/RBAViewContentOperator.cpp new file mode 100644 index 0000000..82813e9 --- /dev/null +++ b/src/view/RBAViewContentOperator.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. + */ +/** + * ViewContentOperator class + */ + +#include "RBAViewContentOperator.hpp" +#include "RBAViewContentImpl.hpp" + +namespace rba +{ + +} diff --git a/src/view/RBAViewContentOperator.hpp b/src/view/RBAViewContentOperator.hpp new file mode 100644 index 0000000..04aabd0 --- /dev/null +++ b/src/view/RBAViewContentOperator.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. + */ +/** + * ViewContentOperator class header + */ + +#ifndef RBAVIEWCONTENTOPERATOR_HPP +#define RBAVIEWCONTENTOPERATOR_HPP + +#include "RBAContentOperator.hpp" + +namespace rba +{ + +class RBAViewContentImpl; + +class DLL_EXPORT RBAViewContentOperator : public RBAContentOperator +{ +protected: + RBAViewContentOperator()=default; + RBAViewContentOperator(const RBAViewContentOperator&)=delete; + RBAViewContentOperator(const RBAViewContentOperator&&)=delete; + RBAViewContentOperator& operator=(const RBAViewContentOperator&)=delete; + RBAViewContentOperator& operator=(const RBAViewContentOperator&&)=delete; + +public: + +}; + +} + +#endif diff --git a/src/view/RBAViewContentSet.cpp b/src/view/RBAViewContentSet.cpp new file mode 100644 index 0000000..4ea135d --- /dev/null +++ b/src/view/RBAViewContentSet.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. + */ +/** + * ViewContentSet class + */ + +#include "RBAViewContentSet.hpp" +#include "RBAViewContent.hpp" +#include "RBAContent.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAViewContentSet::RBAViewContentSet(const std::string& name) + : RBARuleObject{name}, + RBAContentSet{name} +{ +} + +const std::list<const RBAViewContent*>& +RBAViewContentSet::getTargets() const +{ + return externalContents_; +} + +void +RBAViewContentSet::addTarget(const RBAContent* content) +{ + RBAContentSet::addTarget(content); + externalContents_.push_back(dynamic_cast<const RBAViewContent*>(content)); +} + +void +RBAViewContentSet::clear() +{ + RBAContentSet::clear(); + externalContents_.clear(); +} + +RBAModelElementType +RBAViewContentSet::getModelElementType() const +{ + return RBAModelElementType::ViewContentSet; +} + +} diff --git a/src/view/RBAViewContentSet.hpp b/src/view/RBAViewContentSet.hpp new file mode 100644 index 0000000..61dcba4 --- /dev/null +++ b/src/view/RBAViewContentSet.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. + */ +/** + * ViewContentSet class header + */ + +#ifndef RBAVIEWCONTENTSET_HPP +#define RBAVIEWCONTENTSET_HPP + +#include "RBAContentSet.hpp" +#include "RBADllExport.hpp" + +namespace rba +{ + +class RBAViewContent; +class RBAViewContentImpl; + +class DLL_EXPORT RBAViewContentSet : public RBAContentSet +{ +public: + explicit RBAViewContentSet(const std::string& name=""); + RBAViewContentSet(const RBAViewContentSet&)=delete; + RBAViewContentSet(const RBAViewContentSet&&)=delete; + RBAViewContentSet& operator=(const RBAViewContentSet&)=delete; + RBAViewContentSet& operator=(const RBAViewContentSet&&)=delete; + virtual ~RBAViewContentSet()=default; + +public: + const std::list<const RBAViewContent*>& 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 RBAViewContent*> externalContents_; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif diff --git a/src/view/RBAViewContentSetMaker.cpp b/src/view/RBAViewContentSetMaker.cpp new file mode 100644 index 0000000..8a49520 --- /dev/null +++ b/src/view/RBAViewContentSetMaker.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 RBAViewContentSetMaker.cpp +/// @brief ViewContentSet object geneation class + +#include "RBAViewContentSetMaker.hpp" +#include "RBAViewContentSet.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAViewContentSetMaker::RBAViewContentSetMaker() + : RBARuleObjectMaker{"viewcontentsets"}, + RBAContentSetMaker() +{ +} + +std::unique_ptr<RBAModelElement> +RBAViewContentSetMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAViewContentSet>(name); +} + +RBAModelElement* +RBAViewContentSetMaker::setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner) +{ + static_cast<void>(RBAContentSetMaker::setProperty(element, jsonElem, model, owner)); + + const auto contentSet = dynamic_cast<RBAViewContentSet*>(element); + + model->addViewContentSet(contentSet); + + return contentSet; +} + +} diff --git a/src/view/RBAViewContentSetMaker.hpp b/src/view/RBAViewContentSetMaker.hpp new file mode 100644 index 0000000..e731cc9 --- /dev/null +++ b/src/view/RBAViewContentSetMaker.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 RBAViewContentSetMaker.hpp +/// @brief ViewContentSet object geneation class header + +#ifndef RBAVIEWCONTENTSETMAKER_HPP +#define RBAVIEWCONTENTSETMAKER_HPP + +#include "RBAContentSetMaker.hpp" + +namespace rba +{ + +/// @brief ViewContentSet object geneation class +class RBAViewContentSetMaker : public RBAContentSetMaker +{ +public: + RBAViewContentSetMaker(); + RBAViewContentSetMaker(const RBAViewContentSetMaker&)=delete; + RBAViewContentSetMaker(const RBAViewContentSetMaker&&)=delete; + RBAViewContentSetMaker& operator=(const RBAViewContentSetMaker&)=delete; + RBAViewContentSetMaker& operator=(const RBAViewContentSetMaker&&)=delete; + virtual ~RBAViewContentSetMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your 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] JSON element of jsonElem ModelElement + /// @param[in] model Model to save the generated object + /// @param[in,out] owner Parent object (unused) + RBAModelElement* setProperty(RBAModelElement* element, + const RBAJsonElement* jsonElem, + RBAModelImpl* model, + RBAModelElement* owner=nullptr) override; + +}; + +} + +#endif diff --git a/src/view/RBAViewContentState.cpp b/src/view/RBAViewContentState.cpp new file mode 100644 index 0000000..7d29e4d --- /dev/null +++ b/src/view/RBAViewContentState.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. + */ +/** + * View Content state class + */ + +#include "RBAViewContentState.hpp" + +namespace rba +{ + +std::string +RBAViewContentState::getContentNameByContext(const std::string& context) +{ + return context.substr(0U, context.find(CONTEXT_SEPARATER)); +} + +std::string +RBAViewContentState::getContentStateNameByContext(const std::string& context) +{ + const std::string::size_type pos {context.find(CONTEXT_SEPARATER)}; + if(pos == std::string::npos) { + // Returns a null string if it does not contain a separator character. + return ""; + } + else { + return context.substr(pos+1U, context.length()-1U); + } +} + +bool +RBAViewContentState::isUniqueName(const std::string& context) +{ + return (context.find(CONTEXT_SEPARATER) != std::string::npos); +} + +} diff --git a/src/view/RBAViewContentStateImpl.cpp b/src/view/RBAViewContentStateImpl.cpp new file mode 100644 index 0000000..8a8de3f --- /dev/null +++ b/src/view/RBAViewContentStateImpl.cpp @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/** + * View Content state implementation class + */ + +#include "RBAViewContentImpl.hpp" +#include "RBAViewContentStateImpl.hpp" +#include "RBAModelElementType.hpp" + +namespace rba +{ + +RBAViewContentStateImpl::RBAViewContentStateImpl(const std::string& name) + : RBAViewContentState(), + RBAContentState{name} +{ +} + +std::string +RBAViewContentStateImpl::getName() const +{ + return RBANamedElement::getElementName(); +} + +std::int32_t +RBAViewContentStateImpl::getPriority() const +{ + return getContentStatePriority(); +} + +const RBAViewContent* +RBAViewContentStateImpl::getOwner() const +{ + return dynamic_cast<const RBAViewContent*>(RBARuleObject::getOwner()); +} + +std::int32_t +RBAViewContentStateImpl::getOrder() const +{ + return getContentStateOrder(); +} + +std::string +RBAViewContentStateImpl::getUniqueName() const +{ + return RBARuleObject::getOwner()->getUniqueName() + CONTEXT_SEPARATER + getName(); +} + +bool +RBAViewContentStateImpl::isViewContentState() const +{ + return true; +} + +RBAModelElementType +RBAViewContentStateImpl::getModelElementType() const +{ + return RBAModelElementType::ViewContentState; +} + +} diff --git a/src/view/RBAViewContentStateImpl.hpp b/src/view/RBAViewContentStateImpl.hpp new file mode 100644 index 0000000..5ad601d --- /dev/null +++ b/src/view/RBAViewContentStateImpl.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. + */ +/** + * View Content state implementation class header + */ + +#ifndef RBAVIEWCONTENTSTATEIMPL_HPP +#define RBAVIEWCONTENTSTATEIMPL_HPP + +#include <cstdint> +#include "RBAViewContentState.hpp" +#include "RBAContentState.hpp" + +namespace rba +{ + +class RBAViewContentImpl; + +class RBAViewContentStateImpl : public RBAViewContentState, + public RBAContentState +{ +public: + explicit RBAViewContentStateImpl(const std::string& name=""); + RBAViewContentStateImpl(const RBAViewContentStateImpl&)=delete; + RBAViewContentStateImpl(const RBAViewContentStateImpl&&)=delete; + RBAViewContentStateImpl& operator=(const RBAViewContentStateImpl&)=delete; + RBAViewContentStateImpl& operator=(const RBAViewContentStateImpl&&)=delete; + virtual ~RBAViewContentStateImpl()=default; + +public: + std::string getName() const override; + std::int32_t getPriority() const override; + const RBAViewContent* getOwner() const override; + std::int32_t getOrder() const override; + std::string getUniqueName() const override; + bool isViewContentState() const override; + RBAModelElementType getModelElementType() const override; + +}; + +} + +#endif diff --git a/src/view/RBAViewContentStateMaker.cpp b/src/view/RBAViewContentStateMaker.cpp new file mode 100644 index 0000000..7877c55 --- /dev/null +++ b/src/view/RBAViewContentStateMaker.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 RBAViewContentStateMaker.cpp +/// @brief ViewContentState object generation class + +#include "RBAViewContentStateMaker.hpp" +#include "RBAJsonElement.hpp" +#include "RBAModelElement.hpp" +#include "RBAModelImpl.hpp" +#include "RBAViewContentStateImpl.hpp" +#include "RBAModelFactory.hpp" + +namespace rba +{ + +RBAViewContentStateMaker::RBAViewContentStateMaker() + : RBAContentStateMaker{"ViewContentState"} +{ +} + +std::unique_ptr<RBAModelElement> +RBAViewContentStateMaker::createInstance(const std::string& name) +{ + return std::make_unique<RBAViewContentStateImpl>(name); +} + +} + diff --git a/src/view/RBAViewContentStateMaker.hpp b/src/view/RBAViewContentStateMaker.hpp new file mode 100644 index 0000000..c3a666f --- /dev/null +++ b/src/view/RBAViewContentStateMaker.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 RBAViewContentStateMaker.hpp +/// @brief ViewContentState object generation class header + +#ifndef RBAVIEWCONTENTSTATEMAKER_HPP +#define RBAVIEWCONTENTSTATEMAKER_HPP + +#include "RBAContentStateMaker.hpp" + +namespace rba +{ + +class RBAModelElement; +class RBAJsonElement; +class RBAModelImpl; + +/// @brief ViewContentState object generation class +class RBAViewContentStateMaker : public RBAContentStateMaker +{ +public: + RBAViewContentStateMaker(); + RBAViewContentStateMaker(const RBAViewContentStateMaker&)=delete; + RBAViewContentStateMaker(const RBAViewContentStateMaker&&)=delete; + RBAViewContentStateMaker& operator=(const RBAViewContentStateMaker&)=delete; + RBAViewContentStateMaker& operator=(RBAViewContentStateMaker&&)=delete; + virtual ~RBAViewContentStateMaker()=default; + +protected: + /// @brief create empty instance + /// @details Create an empty instance of unique_ptr in your derived class. + /// @return unique_ptr for instance + std::unique_ptr<RBAModelElement> createInstance(const std::string& name="") override; + +}; + +} + +#endif diff --git a/src/view/RBAViewMakerTable.cpp b/src/view/RBAViewMakerTable.cpp new file mode 100644 index 0000000..dcd3aec --- /dev/null +++ b/src/view/RBAViewMakerTable.cpp @@ -0,0 +1,75 @@ +/** + * Copyright (c) 2019 DENSO CORPORATION. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +/// @file RBAViewMakerTable.cpp +/// @brief ViewMakerTable class + +#include "RBAViewMakerTable.hpp" +#include "RBAAllInstanceOfAreaMaker.hpp" +#include "RBAAllInstanceOfViewContentMaker.hpp" +#include "RBAAreaMaker.hpp" +#include "RBAAreaSetMaker.hpp" +#include "RBADisplayMaker.hpp" +#include "RBADisplayingContentMaker.hpp" +#include "RBAIsDisplayedMaker.hpp" +#include "RBAIsHiddenMaker.hpp" +#include "RBAIsVisibleMaker.hpp" +#include "RBAPositionContainerMaker.hpp" +#include "RBASizeMaker.hpp" +#include "RBAViewContentMaker.hpp" +#include "RBAViewContentSetMaker.hpp" +#include "RBAViewContentStateMaker.hpp" + +namespace rba +{ + +RBAViewMakerTable::RBAViewMakerTable() + : RBAAbstractMakerTable{} +{ + addTag("areas"); + addTag("areasets"); + addTag("viewcontents"); + addTag("viewcontentsets"); + addTag("displays"); +} + +std::list<std::unique_ptr<RBAModelElementMaker>> +RBAViewMakerTable::getMakers() const +{ + std::list<std::unique_ptr<RBAModelElementMaker>> makers; + makers.push_back(std::make_unique<RBAAllInstanceOfAreaMaker>()); + makers.push_back(std::make_unique<RBAAllInstanceOfViewContentMaker>()); + makers.push_back(std::make_unique<RBAAreaMaker>()); + RBAModelElementMaker::addMaker("AREA", std::make_unique<RBAAreaMaker>()); + makers.push_back(std::make_unique<RBAAreaSetMaker>()); + RBAModelElementMaker::addMaker("SET_OF_AREA", std::make_unique<RBAAreaSetMaker>()); + makers.push_back(std::make_unique<RBADisplayMaker>()); + makers.push_back(std::make_unique<RBADisplayingContentMaker>()); + makers.push_back(std::make_unique<RBAIsDisplayedMaker>()); + makers.push_back(std::make_unique<RBAIsHiddenMaker>()); + makers.push_back(std::make_unique<RBAIsVisibleMaker>()); + makers.push_back(std::make_unique<RBAPositionContainerMaker>()); + makers.push_back(std::make_unique<RBASizeMaker>()); + makers.push_back(std::make_unique<RBAViewContentMaker>()); + RBAModelElementMaker::addMaker("CONTENT", std::make_unique<RBAViewContentMaker>()); + RBAModelElementMaker::addMaker("ViewContent", std::make_unique<RBAViewContentMaker>()); + makers.push_back(std::make_unique<RBAViewContentSetMaker>()); + RBAModelElementMaker::addMaker("SET_OF_CONTENT", std::make_unique<RBAViewContentSetMaker>()); + makers.push_back(std::make_unique<RBAViewContentStateMaker>()); + + return makers; +} + +} diff --git a/src/view/RBAViewMakerTable.hpp b/src/view/RBAViewMakerTable.hpp new file mode 100644 index 0000000..19cd70f --- /dev/null +++ b/src/view/RBAViewMakerTable.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 RBAViewMakerTable.hpp +/// @brief ViewMakerTable class header + +#ifndef RBAVIEWMAKERTABLE_HPP +#define RBAVIEWMAKERTABLE_HPP + +#include <functional> +#include "RBAAbstractMakerTable.hpp" + +namespace rba +{ + +class DLL_EXPORT RBAViewMakerTable : public RBAAbstractMakerTable +{ +public: + RBAViewMakerTable(); + RBAViewMakerTable(const RBAViewMakerTable&)=delete; + RBAViewMakerTable(const RBAViewMakerTable&&)=delete; + RBAViewMakerTable& operator=(const RBAViewMakerTable&)=delete; + RBAViewMakerTable& operator=(const RBAViewMakerTable&&)=delete; + virtual ~RBAViewMakerTable()=default; + +public: +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4251) +#endif + std::list<std::unique_ptr<RBAModelElementMaker>> getMakers() const override; +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +}; + +} + +#endif |