Salome HOME
e61e599758b2edef2cc2428ce00b283dd50a8c63
[modules/shaper.git] / src / ExchangePlugin / ExchangePlugin_Dump.h
1 // Copyright (C) 2014-2023  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 email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef EXCHANGEPLUGIN_DUMP_H_
21 #define EXCHANGEPLUGIN_DUMP_H_
22
23 #include <ExchangePlugin.h>
24
25 #include <ModelAPI_Feature.h>
26
27 /**
28  * \class ExchangePlugin_Dump
29  * \ingroup Plugins
30  * \brief Store full model as a Python script
31  */
32 class ExchangePlugin_Dump : public ModelAPI_Feature
33 {
34 public:
35   /// Feature kind
36   inline static const std::string& ID()
37   {
38     static const std::string MY_DUMP_ID("Dump");
39     return MY_DUMP_ID;
40   }
41   /// attribute name of true dumping directory
42   inline static const std::string& DUMP_DIR_ID()
43   {
44     static const std::string MY_DUMP_DIR_ID("dump_dir");
45     return MY_DUMP_DIR_ID;
46   }
47   /// attribute name of file path
48   inline static const std::string& FILE_PATH_ID()
49   {
50     static const std::string MY_FILE_PATH_ID("file_path");
51     return MY_FILE_PATH_ID;
52   }
53   /// attribute name of file format
54   inline static const std::string& FILE_FORMAT_ID()
55   {
56     static const std::string MY_FILE_FORMAT_ID("file_format");
57     return MY_FILE_FORMAT_ID;
58   }
59
60   /// attribute name of dumping by topological naming
61   inline static const std::string& TOPOLOGICAL_NAMING_DUMP_ID()
62   {
63     static const std::string MY_TOOPNAMING_DUMP_ID("topological_naming");
64     return MY_TOOPNAMING_DUMP_ID;
65   }
66   /// attribute name of dumping by geometric selection
67   inline static const std::string& GEOMETRIC_DUMP_ID()
68   {
69     static const std::string MY_GEOM_DUMP_ID("geometric_selection");
70     return MY_GEOM_DUMP_ID;
71   }
72
73   /// attribute name of dumping by using weak naming identifiers of selection
74   inline static const std::string& WEAK_NAMING_DUMP_ID()
75   {
76     static const std::string MY_WEAK_NAMING_DUMP_ID("weak_naming");
77     return MY_WEAK_NAMING_DUMP_ID;
78   }
79
80   /// attribute name for boolean flag to export variable names correspondence to another module
81   inline static const std::string& EXPORT_VARIABLES_ID()
82   {
83     static const std::string MY_EXPORT_VARIABLES_ID("export_variables");
84     return MY_EXPORT_VARIABLES_ID;
85   }
86
87   /// Default constructor
88   EXCHANGEPLUGIN_EXPORT ExchangePlugin_Dump();
89   /// Default destructor
90   EXCHANGEPLUGIN_EXPORT virtual ~ExchangePlugin_Dump();
91
92   /// Returns the unique kind of a feature
93   EXCHANGEPLUGIN_EXPORT virtual const std::string& getKind()
94   {
95     return ExchangePlugin_Dump::ID();
96   }
97
98   /// Request for initialization of data model of the feature: adding all attributes
99   EXCHANGEPLUGIN_EXPORT virtual void initAttributes();
100
101   /// Computes or recomputes the results
102   EXCHANGEPLUGIN_EXPORT virtual void execute();
103
104   /// Reimplemented from ModelAPI_Feature::isMacro(). Returns true.
105   EXCHANGEPLUGIN_EXPORT virtual bool isMacro() const { return true; }
106
107   /// Reimplemented from ModelAPI_Feature::isPreviewNeeded(). Returns false.
108   EXCHANGEPLUGIN_EXPORT virtual bool isPreviewNeeded() const { return false; }
109
110 protected:
111   /// Performs dump to the file
112   EXCHANGEPLUGIN_EXPORT void dump(const std::string& theFileName);
113 };
114
115 #endif