diff options
Diffstat (limited to 'include/rba/RBAArbitrator.hpp')
-rw-r--r-- | include/rba/RBAArbitrator.hpp | 128 |
1 files changed, 4 insertions, 124 deletions
diff --git a/include/rba/RBAArbitrator.hpp b/include/rba/RBAArbitrator.hpp index 017db1a..d70e83e 100644 --- a/include/rba/RBAArbitrator.hpp +++ b/include/rba/RBAArbitrator.hpp @@ -34,13 +34,8 @@ #include <string> #include <list> #include <memory> -#include <mutex> -#include <deque> #include "RBAModel.hpp" #include "RBAResult.hpp" -#include "RBARequestQueMember.hpp" -#include "RBAResultSet.hpp" -#include "RBAResultImpl.hpp" /** * @namespace rba @@ -56,11 +51,7 @@ class RBALogManager; class RBARuleObject; class RBAExpression; -class RBAModelImpl; -class RBAAffectInfo; -class RBARollbacker; -class RBAWindowRouter; -class RBAConstraintImpl; +class RBAArbitratorImpl; // } /** @@ -77,7 +68,6 @@ public: * @param newModel Processing model. * The model is generated by rba::RBAJsonParser. */ - RBAArbitrator()=default; RBAArbitrator(RBAModel* newModel); /** @@ -485,129 +475,19 @@ public: const RBARuleObject* evaluateObject(RBAExpression* expression); int32_t evaluateValue(RBAExpression* expression); + RBAArbitratorImpl* getImpl() const; // } private: + class Impl; #ifdef _MSC_VER #pragma warning(push) #pragma warning(disable:4251) #endif + std::unique_ptr<Impl> impl_; #ifdef _MSC_VER #pragma warning(pop) #endif - -private: - bool isValidContext(const std::string& context); - bool isValidContext(std::list<std::string>& contexts); - bool setRequestData( - const std::string& context, bool require, - std::list<std::pair<std::string, std::int32_t>>* const properties = nullptr, - std::uint32_t syncIndex = 0xFFFFU); - void setRequestData(const RBAContentState* state, bool require); - void setRequestData(const RBAContent* const content, bool require); - void setActive(const RBASceneImpl* const scene, const bool require); - void setSceneProperty(const RBAAbstractProperty* const prop, const std::int32_t value); - void setRequestData(std::list<std::string>& contexts, const bool require); - -#ifdef RBA_USE_LOG - void checkAllConstraints(); -#endif - void updateResult(); - void checkCancelContent() const; - void createResultData(); - -public: - bool satisfiesConstraints() const; - -private: - std::unique_ptr<RBAResult> arbitrateMain(); - void arbitrate(std::list<RBAAllocatable*>& allocatables); - void arbitrateAllocatable(RBAAllocatable* allocatable, - std::set<const RBAAllocatable*>& revisited, - const std::int32_t nest, RBAAffectInfo* const affectInfo, - RBARollbacker* const parentRollbacker); - - bool sortContentStates(const RBAAllocatable* const allocatable, - std::list<const RBAContentState*>& states) const; - void postArbitrate(); - void changeContentStateCancelWithPolicy(const RBAContentState* const state); - void collectRevisitAllocatable( - std::list<const RBAAllocatable*>* const totalRevisitAllocatables, - RBAAllocatable*& allocatable, - std::list<RBAConstraintImpl*>& falseConstraints, - std::set<const RBAAllocatable*>& revisited); - - static std::int32_t getViewActionPriority(const RBAViewActionType viewActionType); - static bool compareViewAction(const std::unique_ptr<RBAViewAction>& lhs, - const std::unique_ptr<RBAViewAction>& rhs); - -public: - RBAResultImpl* getResult() const; /// Used by rba_tool - bool isCancel(const RBAContentState* const state) const; - -private: - void differenceArbitrate(); - bool checkConstraints(std::list<RBAConstraintImpl*>& constraints, - std::list<RBAConstraintImpl*>& falseConstraints, - const RBAAllocatable* const allocatable); - bool checkConstraintAndReArbitrate(RBAAllocatable* allocatable, - std::set<const RBAAllocatable*>& revisited, - const std::int32_t nest, - RBAAffectInfo* const affectInfo, - RBARollbacker* const parentRollbacker, - std::list<RBAConstraintImpl*>& constraints, - bool * const isSkipped, const bool isFinal); - void setCancel(const RBAContentState* const state, const bool checked); - void getSortedContentStates( - const RBAAllocatable* const allocatable, - std::list<const RBAContentState*>& contentStates) const; - -#ifdef RBA_USE_LOG - void logRequestArbitration(); - void logPreResultArbitration(); - void logRequestForCoverage(); - void logResultArbitration(); - void logResultForCoverage(); - void setLogToResult(); -#endif - -public: - std::set<const RBAContentState*>& getCancelChecked(); - std::unique_ptr<RBAResultImpl>& getResultRef() const; - void setResult(std::unique_ptr<RBAResultImpl> result); - std::unique_ptr<RBAResultSet>& getNextResultSet(); - void setNextResultSet(std::unique_ptr<RBAResultSet> nextResultSet); - std::unique_ptr<RBAResultSet>& getBackupResultSet(); - void setBackupResultSet(std::unique_ptr<RBAResultSet> backupResultSet); - std::unique_ptr<RBAResultSet>& getReservedResultSet(); - void setReservedResultSet(std::unique_ptr<RBAResultSet> reservedResultSet); - std::recursive_mutex& getMutex() const; -#ifdef RBA_USE_LOG - void setSimulationMode(bool simulationMode); -#endif - std::deque<std::unique_ptr<RBARequestQueMember>>& getRequestQue(); - -private: - RBAModelImpl* model_ {nullptr}; - std::set<const RBAContentState*> cancelChecked_; - - mutable std::unique_ptr<RBAResultImpl> result_; - // ResultSet to use as CurrentResultSet in next arbitration - std::unique_ptr<RBAResultSet> nextResultSet_; - // ResultSet to use as PreviousResultSet in next arbitration - std::unique_ptr<RBAResultSet> backupResultSet_; - // ResultSet to be used as CurrentResultSet in cancelArbitration() - std::unique_ptr<RBAResultSet> reservedResultSet_; - // ResultSet to use as CurrentResultSet in satisfiesConstraints() - std::unique_ptr<RBAResultSet> resultSetForSatisfiesConstraints_; - mutable std::recursive_mutex mutex_; -#ifdef RBA_USE_LOG - bool simulationMode_ = false; -#endif - std::deque<std::unique_ptr<RBARequestQueMember>> requestQue_; - -public: - void setModel(RBAModelImpl* const newModel); }; } |