Salome HOME
Fix for the issue #2808 : Documentation on the "Groups" panel. Added description...
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Dump.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef EXCHANGEPLUGIN_DUMP_H_
22 #define EXCHANGEPLUGIN_DUMP_H_
23
24 #include <ExchangePlugin.h>
25
26 #include <ModelAPI_Feature.h>
27
28 /**
29  * \class ExchangePlugin_Dump
30  * \ingroup Plugins
31  * \brief Store full model as a Python script
32  */
33 class ExchangePlugin_Dump : public ModelAPI_Feature
34 {
35 public:
36   /// Feature kind
37   inline static const std::string& ID()
38   {
39     static const std::string MY_DUMP_ID("Dump");
40     return MY_DUMP_ID;
41   }
42   /// attribute name of file path
43   inline static const std::string& FILE_PATH_ID()
44   {
45     static const std::string MY_FILE_PATH_ID("file_path");
46     return MY_FILE_PATH_ID;
47   }
48   /// attribute name of file format
49   inline static const std::string& FILE_FORMAT_ID()
50   {
51     static const std::string MY_FILE_FORMAT_ID("file_format");
52     return MY_FILE_FORMAT_ID;
53   }
54   /// attribute name of selection type string (GUI radio button) of dumping by topological naming
55   inline static const std::string& SELECTION_TYPE_ID()
56   {
57     static const std::string MY_SELECTION_TYPE_ID("selection_type");
58     return MY_SELECTION_TYPE_ID;
59   }
60
61   /// string identifier of dumping by topological naming
62   inline static const std::string& TOPOLOGICAL_NAMING_DUMP_ID()
63   {
64     static const std::string MY_TOOPNAMING_DUMP_ID("topological_naming");
65     return MY_TOOPNAMING_DUMP_ID;
66   }
67   /// string identifier of dumping by geometric selection
68   inline static const std::string& GEOMETRIC_DUMP_ID()
69   {
70     static const std::string MY_GEOM_DUMP_ID("geometric_selection");
71     return MY_GEOM_DUMP_ID;
72   }
73
74   /// string identifier of dumping by using weak naming identifiers of selection
75   inline static const std::string& WEAK_NAMING_DUMP_ID()
76   {
77     static const std::string MY_WEAK_NAMING_DUMP_ID("weak_naming");
78     return MY_WEAK_NAMING_DUMP_ID;
79   }
80
81   /// Default constructor
82   EXCHANGEPLUGIN_EXPORT ExchangePlugin_Dump();
83   /// Default destructor
84   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Dump();
85
86   /// Returns the unique kind of a feature
87   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
88   {
89     return ExchangePlugin_Dump::ID();
90   }
91
92   /// Request for initialization of data model of the feature: adding all attributes
93   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
94
95   /// Computes or recomputes the results
96   EXCHANGEPLUGIN_EXPORT virtual void execute();
97
98   /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
99   EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
100
101   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
102   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
103
104 protected:
105   /// Performs dump to the file
106   EXCHANGEPLUGIN_EXPORT void dump(const std::string& theFileName);
107 };
108
109 #endif