X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FModelHighAPI%2FModelHighAPI_Interface.h;h=8675bb66ce33f14083bc5ab8d424f5c8100d57b4;hb=09365c927ebe8d881de2eda7f96bc33a2d9511c8;hp=037b25c5b13ff2ae1777e304201e58bff37399a0;hpb=4692c3d1bfca82fa0661a5150818cef6d782a7db;p=modules%2Fshaper.git diff --git a/src/ModelHighAPI/ModelHighAPI_Interface.h b/src/ModelHighAPI/ModelHighAPI_Interface.h index 037b25c5b..8675bb66c 100644 --- a/src/ModelHighAPI/ModelHighAPI_Interface.h +++ b/src/ModelHighAPI/ModelHighAPI_Interface.h @@ -1,8 +1,21 @@ -// Name : ModelHighAPI_Interface.h -// Purpose: +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // -// History: -// 17/05/16 - Sergey POKHODENKO - Creation of the file #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ #define SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ @@ -10,10 +23,16 @@ //-------------------------------------------------------------------------------------- #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 @@ -23,26 +42,71 @@ class ModelHighAPI_Interface { public: /// Constructor - MODELHIGHAPI_EXPORT explicit ModelHighAPI_Interface(const std::shared_ptr & theFeature); + MODELHIGHAPI_EXPORT + explicit ModelHighAPI_Interface(const std::shared_ptr & theFeature); /// Destructor - MODELHIGHAPI_EXPORT virtual ~ModelHighAPI_Interface(); + MODELHIGHAPI_EXPORT + virtual ~ModelHighAPI_Interface(); /// Return ModelAPI_Feature - MODELHIGHAPI_EXPORT std::shared_ptr feature() const; + 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() - MODELHIGHAPI_EXPORT const std::string& getKind(); + MODELHIGHAPI_EXPORT + const std::string& getKind() const; /// Shortcut for feature()->execute() - MODELHIGHAPI_EXPORT 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); + + /// Shortcut for feature()->data()->name() + MODELHIGHAPI_EXPORT + std::string name() const; + + /// 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); + 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_ */