Salome HOME
Dump Python in the High Level Parameterized Geometry API (issue #1648)
[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 #include <iostream>
17 //--------------------------------------------------------------------------------------
18 class ModelAPI_Feature;
19 class ModelAPI_Result;
20 class ModelHighAPI_Selection;
21 class ModelHighAPI_Dumper;
22 //--------------------------------------------------------------------------------------
23 /**\class ModelHighAPI_Interface
24  * \ingroup CPPHighAPI
25  * \brief Base class for feature interfaces
26  */
27 class ModelHighAPI_Interface
28 {
29 public:
30   /// Constructor
31   MODELHIGHAPI_EXPORT
32   explicit ModelHighAPI_Interface(const std::shared_ptr<ModelAPI_Feature> & theFeature);
33   /// Destructor
34   MODELHIGHAPI_EXPORT
35   virtual ~ModelHighAPI_Interface();
36
37   /// Return ModelAPI_Feature
38   MODELHIGHAPI_EXPORT
39   std::shared_ptr<ModelAPI_Feature> feature() const;
40
41   /// Shortcut for feature()->getKind()
42   MODELHIGHAPI_EXPORT
43   const std::string& getKind() const;
44
45   /// Shortcut for feature()->execute()
46   MODELHIGHAPI_EXPORT
47   void execute();
48
49   // TODO(spo): rename to selectAll()
50   /// Return all objects of the feature
51   MODELHIGHAPI_EXPORT
52   virtual std::list<ModelHighAPI_Selection> result() const;
53
54   /// Return default result. Default implementation feature()->lastResult()
55   MODELHIGHAPI_EXPORT
56   virtual std::shared_ptr<ModelAPI_Result> defaultResult() const;
57
58   /// Throw exception to event loop
59   MODELHIGHAPI_EXPORT
60   void throwException(const std::string & theDescription);
61
62   /// Dump wrapped feature
63   MODELHIGHAPI_EXPORT
64   virtual void dump(ModelHighAPI_Dumper& theDumper) const {}
65
66 protected:
67   std::shared_ptr<ModelAPI_Feature> myFeature;
68 };
69
70 //! Pointer on Interface object
71 typedef std::shared_ptr<ModelHighAPI_Interface> InterfacePtr;
72
73 //--------------------------------------------------------------------------------------
74 //--------------------------------------------------------------------------------------
75 #endif /* SRC_MODELHIGHAPI_MODELHIGHAPI_INTERFACE_H_ */