Salome HOME
97084a50bc2223434188c0c49fdbe0d11bc01bd7
[modules/shaper.git] / src / ModelHighAPI / ModelHighAPI_Interface.h
1 // Name   : ModelHighAPI_Interface.h
2 // Purpose: 
3 //
4 // History:
5 // 17/05/16 - Sergey POKHODENKO - Creation of the file
6
7 #ifndef SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_
8 #define SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_
9
10 //--------------------------------------------------------------------------------------
11 #include "ModelHighAPI.h"
12
13 #include <list>
14 #include <memory>
15 #include <string>
16 //--------------------------------------------------------------------------------------
17 class ModelAPI_Feature;
18 class ModelAPI_Result;
19 class ModelHighAPI_Selection;
20 //--------------------------------------------------------------------------------------
21 /**\class ModelHighAPI_Interface
22  * \ingroup CPPHighAPI
23  * \brief Base class for feature interfaces
24  */
25 class ModelHighAPI_Interface
26 {
27 public:
28   /// Constructor
29   MODELHIGHAPI_EXPORT
30   explicit ModelHighAPI_Interface(const std::shared_ptr<ModelAPI_Feature> & theFeature);
31   /// Destructor
32   MODELHIGHAPI_EXPORT
33   virtual ~ModelHighAPI_Interface();
34
35   /// Return ModelAPI_Feature
36   MODELHIGHAPI_EXPORT
37   std::shared_ptr<ModelAPI_Feature> feature() const;
38
39   /// Shortcut for feature()->getKind()
40   MODELHIGHAPI_EXPORT
41   const std::string& getKind() const;
42
43   /// Shortcut for feature()->execute()
44   MODELHIGHAPI_EXPORT
45   void execute();
46
47   // TODO(spo): rename to selectAll()
48   /// Return all objects of the feature
49   MODELHIGHAPI_EXPORT
50   virtual std::list<ModelHighAPI_Selection> result() const;
51
52   /// Return default result. Default implementation feature()->lastResult()
53   MODELHIGHAPI_EXPORT
54   virtual std::shared_ptr<ModelAPI_Result> defaultResult() const;
55
56   /// Throw exception to event loop
57   MODELHIGHAPI_EXPORT
58   void throwException(const std::string & theDescription);
59
60 protected:
61   std::shared_ptr<ModelAPI_Feature> myFeature;
62 };
63
64 //--------------------------------------------------------------------------------------
65 //--------------------------------------------------------------------------------------
66 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */