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 {
33 * Wrapper providing operations with entities regardless the solver.
35 class SketchSolver_IEntityWrapper
38 virtual ~SketchSolver_IEntityWrapper() {}
40 /// \brief Return base feature
41 const FeaturePtr& baseFeature() const
42 { return myBaseFeature; }
43 /// \brief Return base attribute
44 const AttributePtr& baseAttribute() const
45 { return myBaseAttribute; }
47 /// \brief Check the feature is basis for this wrapper
48 bool isBase(FeaturePtr theFeature) const
49 { return myBaseFeature && myBaseFeature == theFeature; }
50 /// \brief Check the attribute is basis for this wrapper
51 bool isBase(AttributePtr theAttribute) const
52 { return myBaseAttribute && myBaseAttribute == theAttribute; }
54 /// \brief Assign list of parameters for this entity
55 void setParameters(const std::list<ParameterWrapperPtr>& theParams)
56 { myParameters = theParams; }
57 /// \brief Return list of parameters
58 const std::list<ParameterWrapperPtr>& parameters() const
59 { return myParameters; }
61 /// \brief Assign list of sub-entities
62 void setSubEntities(const std::list<std::shared_ptr<SketchSolver_IEntityWrapper> >& theEntities)
63 { mySubEntities = theEntities; }
64 /// \brief Return list of sub-entities
65 const std::list<std::shared_ptr<SketchSolver_IEntityWrapper> >& subEntities() const
66 { return mySubEntities; }
68 /// \brief Return ID of current entity
69 virtual EntityID id() const = 0;
71 /// \brief Change group for the entity
72 virtual void setGroup(const GroupID& theGroup) = 0;
73 /// \brief Return identifier of the group the entity belongs to
74 virtual GroupID group() const = 0;
76 /// \brief Return type of current entity
77 virtual SketchSolver_EntityType type() const = 0;
79 /// \brief Verify the feature is used in the entity
80 virtual bool isUsed(FeaturePtr theFeature) const = 0;
81 /// \brief Verify the attribute is used in the entity
82 virtual bool isUsed(AttributePtr theAttribute) const = 0;
84 /// \brief Compare current entity with other
85 virtual bool isEqual(const std::shared_ptr<SketchSolver_IEntityWrapper>& theOther) = 0;
87 /// \brief Update values of parameters of this entity by the parameters of given one
88 /// \return \c true if some parameters change their values
89 virtual bool update(const std::shared_ptr<SketchSolver_IEntityWrapper>& theOther) = 0;
92 FeaturePtr myBaseFeature;
93 AttributePtr myBaseAttribute;
95 std::list<ParameterWrapperPtr> myParameters;
96 std::list<std::shared_ptr<SketchSolver_IEntityWrapper> > mySubEntities;
99 typedef std::shared_ptr<SketchSolver_IEntityWrapper> EntityWrapperPtr;