X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelAPI%2FModelAPI_Feature.h;h=6ea57af293a8d43874d5a198030f372c105923e4;hb=3c3d2b36e230e15ee8384554118ea13ca1415772;hp=3dc6a3d5d956a1e6622a51cb37647b559a1f31c1;hpb=23bd046563358cc8654b0d084fb0f7135acc31f7;p=modules%2Fshaper.git diff --git a/src/ModelAPI/ModelAPI_Feature.h b/src/ModelAPI/ModelAPI_Feature.h index 3dc6a3d5d..6ea57af29 100644 --- a/src/ModelAPI/ModelAPI_Feature.h +++ b/src/ModelAPI/ModelAPI_Feature.h @@ -7,29 +7,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include #include #include -#include -#include +#include #include #include -class ModelAPI_Data; -class ModelAPI_Document; -class ModelAPI_Result; - /**\class ModelAPI_Feature * \ingroup DataModel * \brief Feature function that represents the particular functionality @@ -38,7 +23,7 @@ class ModelAPI_Result; class ModelAPI_Feature : public ModelAPI_Object { ///< list of current results of this feature - std::list > myResults; + std::list > myResults; public: /// Returns the unique kind of a feature (like "Point") virtual const std::string& getKind() = 0; @@ -51,7 +36,7 @@ class ModelAPI_Feature : public ModelAPI_Object } /// Returns document this feature belongs to - virtual boost::shared_ptr document() + virtual std::shared_ptr document() const { return ModelAPI_Object::document(); } @@ -68,17 +53,24 @@ class ModelAPI_Feature : public ModelAPI_Object /// Computes or recomputes the results virtual void execute() = 0; + /// Registers error during the execution, causes the ExecutionFailed state + virtual void setError(const std::string& theError) { + data()->setError(theError); + } + /// returns the current results of the feature - MODELAPI_EXPORT const std::list >& results(); + MODELAPI_EXPORT const std::list >& results(); /// returns the first result in the list or NULL reference - MODELAPI_EXPORT boost::shared_ptr firstResult(); + MODELAPI_EXPORT std::shared_ptr firstResult(); + /// returns the last result in the list or NULL reference + MODELAPI_EXPORT std::shared_ptr lastResult(); /// sets the alone result - MODELAPI_EXPORT void setResult(const boost::shared_ptr& theResult); + MODELAPI_EXPORT void setResult(const std::shared_ptr& theResult); /// sets the result by index (zero based), results before this must be set before - MODELAPI_EXPORT void setResult(const boost::shared_ptr& theResult, + MODELAPI_EXPORT void setResult(const std::shared_ptr& theResult, const int theIndex); /// removes the result from the feature - MODELAPI_EXPORT void removeResult(const boost::shared_ptr& theResult); + MODELAPI_EXPORT void removeResult(const std::shared_ptr& theResult); /// removes all results from the feature MODELAPI_EXPORT void eraseResults(); /// removes all fields from this feature: results, data, etc @@ -97,12 +89,12 @@ class ModelAPI_Feature : public ModelAPI_Object /// Must return document where the new feature must be added to /// By default it is current document - MODELAPI_EXPORT virtual boost::shared_ptr documentToAdd(); + MODELAPI_EXPORT virtual std::shared_ptr documentToAdd(); /// To virtually destroy the fields of successors MODELAPI_EXPORT virtual ~ModelAPI_Feature(); - MODELAPI_EXPORT static boost::shared_ptr feature(ObjectPtr theObject); + MODELAPI_EXPORT static std::shared_ptr feature(ObjectPtr theObject); // // Helper methods, aliases for data()->method() @@ -112,57 +104,57 @@ class ModelAPI_Feature : public ModelAPI_Object return data()->name(); } - inline boost::shared_ptr boolean(const std::string& theID) + inline std::shared_ptr boolean(const std::string& theID) { return data()->boolean(theID); } - inline boost::shared_ptr document(const std::string& theID) + inline std::shared_ptr document(const std::string& theID) { return data()->document(theID); } - inline boost::shared_ptr real(const std::string& theID) + inline std::shared_ptr real(const std::string& theID) { return data()->real(theID); } - inline boost::shared_ptr integer(const std::string& theID) + inline std::shared_ptr integer(const std::string& theID) { return data()->integer(theID); } - inline boost::shared_ptr refattr(const std::string& theID) + inline std::shared_ptr refattr(const std::string& theID) { return data()->refattr(theID); } - inline boost::shared_ptr reference(const std::string& theID) + inline std::shared_ptr reference(const std::string& theID) { return data()->reference(theID); } - inline boost::shared_ptr reflist(const std::string& theID) + inline std::shared_ptr reflist(const std::string& theID) { return data()->reflist(theID); } - inline boost::shared_ptr selection(const std::string& theID) + inline std::shared_ptr selection(const std::string& theID) { return data()->selection(theID); } - inline boost::shared_ptr selectionList(const std::string& theID) + inline std::shared_ptr selectionList(const std::string& theID) { return data()->selectionList(theID); } - inline boost::shared_ptr string(const std::string& theID) + inline std::shared_ptr string(const std::string& theID) { return data()->string(theID); } - inline boost::shared_ptr attribute(const std::string& theID) + inline std::shared_ptr attribute(const std::string& theID) { return data()->attribute(theID); } @@ -170,7 +162,7 @@ class ModelAPI_Feature : public ModelAPI_Object }; //! Pointer on feature object -typedef boost::shared_ptr FeaturePtr; +typedef std::shared_ptr FeaturePtr; #endif