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