1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_IEntityWrapper.h
4 // Created: 30 Nov 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_IEntityWrapper_H_
8 #define SketchSolver_IEntityWrapper_H_
10 #include <SketchSolver.h>
11 #include <SketchSolver_IParameterWrapper.h>
13 #include <ModelAPI_Attribute.h>
14 #include <ModelAPI_Feature.h>
20 enum SketchSolver_EntityType {
32 * Wrapper providing operations with entities regardless the solver.
34 class SketchSolver_IEntityWrapper
37 virtual ~SketchSolver_IEntityWrapper() {}
39 /// \brief Return base feature
40 const FeaturePtr& baseFeature() const
41 { return myBaseFeature; }
42 /// \brief Return base attribute
43 const AttributePtr& baseAttribute() const
44 { return myBaseAttribute; }
46 /// \brief Check the feature is basis for this wrapper
47 bool isBase(FeaturePtr theFeature) const
48 { return myBaseFeature && myBaseFeature == theFeature; }
49 /// \brief Check the attribute is basis for this wrapper
50 bool isBase(AttributePtr theAttribute) const
51 { return myBaseAttribute && myBaseAttribute == theAttribute; }
53 /// \brief Assign list of parameters for this entity
54 void setParameters(const std::list<ParameterWrapperPtr>& theParams)
55 { myParameters = theParams; }
56 /// \brief Return list of parameters
57 const std::list<ParameterWrapperPtr>& parameters() const
58 { return myParameters; }
60 /// \brief Assign list of sub-entities
61 void setSubEntities(const std::list<std::shared_ptr<SketchSolver_IEntityWrapper> >& theEntities)
62 { mySubEntities = theEntities; }
63 /// \brief Return list of sub-entities
64 const std::list<std::shared_ptr<SketchSolver_IEntityWrapper> >& subEntities() const
65 { return mySubEntities; }
67 /// \brief Return ID of current entity
68 virtual EntityID id() const = 0;
70 /// \brief Change group for the entity
71 virtual void setGroup(const GroupID& theGroup) = 0;
72 /// \brief Return identifier of the group the entity belongs to
73 virtual const GroupID& group() const = 0;
75 /// \brief Return type of current entity
76 virtual SketchSolver_EntityType type() const = 0;
78 /// \brief Verify the feature is used in the entity
79 virtual bool isUsed(FeaturePtr theFeature) const = 0;
80 /// \brief Verify the attribute is used in the entity
81 virtual bool isUsed(AttributePtr theAttribute) const = 0;
83 /// \brief Compare current entity with other
84 virtual bool isEqual(const std::shared_ptr<SketchSolver_IEntityWrapper>& theOther) = 0;
86 /// \brief Update values of parameters of this entity by the parameters of given one
87 /// \return \c true if some parameters change their values
88 virtual bool update(const std::shared_ptr<SketchSolver_IEntityWrapper>& theOther) = 0;
91 FeaturePtr myBaseFeature;
92 AttributePtr myBaseAttribute;
94 std::list<ParameterWrapperPtr> myParameters;
95 std::list<std::shared_ptr<SketchSolver_IEntityWrapper> > mySubEntities;
98 typedef std::shared_ptr<SketchSolver_IEntityWrapper> EntityWrapperPtr;