OpenLexocad  27.0
ExecObject.h
Go to the documentation of this file.
1 #pragma once
2 #pragma warning(disable : 4251)
3 
4 #include <Core/DocObject.h>
5 #include <Core/core_defines2.h>
6 
7 class QMutex;
8 
9 namespace App
10 {
11 class ElementTool;
12 }
13 
14 
15 namespace Core
16 {
17 class ExecObject;
18 
20 {
23 };
24 
26 {
27 public:
28  ExecuteError(Core::DocObject* obj, const std::string& m = "");
30  std::string msg;
31 };
32 
34 {
35 public:
36  ExecuteContext(QMutex& aMutex) : mutex(aMutex) {}
37  std::vector<Core::ExecuteError> objects_with_errors;
38  // Holds an array of error message that are recorded when executing the object
39  std::map<Core::DocObject*, std::vector<std::string> > errorMsgPerObject;
40 
41  bool throwException_On_Error = true;
42  bool checkShape = true;
43  bool checkFacetedBrep = false;
44  bool checkSliverFaces = false;
45  bool printErrorMessage = true;
46  bool checkResultFromPolyToAcisConverter = false; // PolyToAcisConverter has sometimes problems, removing loops etc
47  int checkLevel = 20;
48  double _tolerance;
49 
50 #ifdef SWIG
51  private:
52 #endif
53  QMutex& mutex;
54  void addErrorMsg(Core::DocObject* o, const std::string& msg);
55 };
56 
58 {
61  // PROPERTYCONTAINER_HEADER( Core::ExecObject );
62 
63 public:
65  // //
66  // --------------------- BEGIN API --------------------- //
67  // //
68  // ATTENTION: DO NOT CHANGE ANY SIGNATURES IN THE API ! //
69  // //
71 
72  friend class ::App::ElementTool;
73 
74 
76  virtual Core::ExecuteStatus execute(Core::ExecuteContext* context) = 0;
78  bool isExecutable() const { return true; }
80  void skipExecution(bool yesno);
82  bool skipExecution() const;
83 
85  static void getOrderedLinks(const Core::ExecObject* obj, std::vector<Core::ExecObject*>& ordered_links);
87  static void getLinks(const Core::ExecObject* obj, std::vector<Core::ExecObject*>& links);
88 
89 protected:
90  ExecObject();
91  virtual ~ExecObject();
92 
94  // //
95  // ---------------------- END API ---------------------- //
96  // //
98 
99 #ifndef LXAPI // INTERFACES BELOW ARE -NOT- PART OF THE LEXOCAD API
100 
101 private:
102  bool _skipExecution;
103 
104 
105 #endif
106 };
107 
108 
109 } // namespace Core
#define CORE_EXPORT
Definition: core_defines2.h:10
Core::DocObject * obj
Definition: ExecObject.h:29
Definition: ExecObject.h:33
ExecuteStatus
Definition: ExecObject.h:19
Definition: ExecObject.h:21
ExecuteContext(QMutex &aMutex)
Definition: ExecObject.h:36
std::vector< Core::ExecuteError > objects_with_errors
Definition: ExecObject.h:37
Definition: ExecObject.h:57
Definition: ExecObject.h:25
std::map< Core::DocObject *, std::vector< std::string > > errorMsgPerObject
Definition: ExecObject.h:39
Definition: Base.h:19
bool isExecutable() const
Checks if the ExecObject is executable.
Definition: ExecObject.h:78
QMutex & mutex
Definition: ExecObject.h:53
std::string msg
Definition: ExecObject.h:30
LX_NODE_HEADER()
double _tolerance
Definition: ExecObject.h:48
Definition: ExecObject.h:22
TYPESYSTEM_HEADER()
Definition: DocObject.h:28