X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Interface.h;h=7c9774e3aa540cbde44096bb82aa02013e24f41d;hb=2054879244f3323c305222c79c57d2db6a487538;hp=295d870365e9a7205d4a050f5c3a31cd2ce36841;hpb=cfe5bbc0ebcc59652a4aa95539f2580b8efc8d6a;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index 295d87036..7c9774e3a 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -1,5 +1,6 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D // Name : ModelHighAPI_Interface.h -// Purpose: +// Purpose: // // History: // 17/05/16 - Sergey POKHODENKO - Creation of the file @@ -8,10 +9,18 @@ #define SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ //-------------------------------------------------------------------------------------- +#include "ModelHighAPI.h" + +#include +#include #include #include +#include //-------------------------------------------------------------------------------------- class ModelAPI_Feature; +class ModelAPI_Result; +class ModelHighAPI_Selection; +class ModelHighAPI_Dumper; //-------------------------------------------------------------------------------------- /**\class ModelHighAPI_Interface * \ingroup CPPHighAPI @@ -21,26 +30,67 @@ class ModelHighAPI_Interface { public: /// Constructor + MODELHIGHAPI_EXPORT explicit ModelHighAPI_Interface(const std::shared_ptr & theFeature); /// Destructor + MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Interface(); /// Return ModelAPI_Feature + MODELHIGHAPI_EXPORT std::shared_ptr feature() const; + /// If feature is composite return intefrace for sub-feature by zero-based index, + /// or empty pointer if feature not composite or does not have sub-feature with such index. + MODELHIGHAPI_EXPORT + std::shared_ptr subFeature(const int theIndex) const; + /// Shortcut for feature()->getKind() - const std::string& getKind(); + MODELHIGHAPI_EXPORT + const std::string& getKind() const; /// Shortcut for feature()->execute() - void execute(); + /// \param isForce start execution of feature instead of sending events + MODELHIGHAPI_EXPORT + void execute(bool isForce = false); + + /// Shortcut for feature()->data()->setName() + MODELHIGHAPI_EXPORT + void setName(const std::string& theName); + + /// Return firts object of the feature + MODELHIGHAPI_EXPORT + virtual ModelHighAPI_Selection result() const; + + /// Return all objects of the feature + MODELHIGHAPI_EXPORT + virtual std::list results() const; + + /// Return default result. Default implementation feature()->lastResult() + MODELHIGHAPI_EXPORT + virtual std::shared_ptr defaultResult() const; /// Throw exception to event loop + MODELHIGHAPI_EXPORT void throwException(const std::string & theDescription); + /// Return name of getter for specified attribute + MODELHIGHAPI_EXPORT + const std::string& attributeGetter(const std::string& theAttrName); + + /// Dump wrapped feature + MODELHIGHAPI_EXPORT + virtual void dump(ModelHighAPI_Dumper& theDumper) const {} + protected: - std::shared_ptr myFeature; + std::shared_ptr myFeature; ///< feature of this interface + + std::map myAttrGetter; ///< names of attributes and their getters }; +//! Pointer on Interface object +typedef std::shared_ptr InterfacePtr; + //-------------------------------------------------------------------------------------- //-------------------------------------------------------------------------------------- -#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */ +#endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */