IProcessorEx.hpp
1 #ifndef DM_PROCESSOR_IPROCESSOR_EX_HPP_INCLUDED
2 #define DM_PROCESSOR_IPROCESSOR_EX_HPP_INCLUDED
3 
4 #ifdef _MSC_VER
5  #pragma once
6 #endif
7 
8 #include "DM/config.hpp"
9 #include "DM/Handle.hpp"
10 #include "DM/IFilter.hpp"
11 #include "DM/IAddInfoLayout.hpp"
12 #include "DM/IDatamanager.hpp"
13 #include "DM/ISpatialQueryDescriptor.hpp"
14 #include "DM/IControlObject.hpp"
15 #include "DM/IMessageOutput.hpp"
16 
17 #include "DM/Processor/IKernelEx.hpp"
18 #include "DM/Processor/AutoLink.hpp" //enable autolink
19 
20 DM_NAMESPACE_BEGIN
21 
22 
23 /// \brief Statistic interface to object that can be retrieved after a IProcessorEx run
24 class DM_PS_API IProcessStats : public ObjectBase
25 {
26 protected:
27  virtual ~IProcessStats() {}
28 
29 public:
30  virtual int64_t pointsProccessed() const = 0; ///< overall points processed (which fullfill the optional limit criterion): pointsProccessed = pointsFiltered + pointsUsed
31  virtual int64_t pointsFiltered() const = 0; ///< number of points that where filtered by the (optional) process filter
32  virtual int64_t pointsChanged() const = 0; ///< number of points that passed the (optional) process filter and have been changed by the kernel object
33  virtual int64_t pointsUnchanged() const = 0; ///< number of points that passed the (optional) process filter and have NOT been changed by the kernel object
34  virtual int64_t pointsUsed() const = 0; ///< number of points that passed the (optional) process filter: pointsUsed = pointsChanged + pointsUnchanged
35 
36  //statistic about spatial data selection
37  virtual int64_t neighborsMin() const = 0;
38  virtual int64_t neighborsMax() const = 0;
39  virtual double neighborsMean() const = 0;
40  virtual double neighborsSigma() const = 0;
41  virtual int64_t pointsZeroNeighbors() const = 0; ///< number of points that have no neighbors at all
42  virtual int64_t pointsSingleNeighbors() const = 0; //< number of points that have only a single neighbor
43 };
44 
46 
47 /// \brief Extended processor/kernel concept
48 /**
49  Compared to the simple processor/kernel the exteneded version handles all spatial neighborhood queries (also no spatial queries), supports
50  processing and spatial selection filters, as well as, addinfo layout setting for processing and neighborhood points. Furthermore, an optional
51  processing limit (currently only 2d) can be applied. After the runThreaded function was called a detailed statistic object can be accessed
52 
53  (see getStats and IProcessStats for details). Progress control support is also implemented (see setControlObject)
54  The code uses template functions and specialised code to bypass unneeded functions resulting in optimal performance.
55 
56  Hence, the extended processor concept reduces the necessary kernel code to an absolute minimum supporting efficient module development
57 */
58 class DM_PS_API IProcessorEx : public ObjectBase
59 {
60 public:
61  static IProcessorEx* New(IDatamanager &manager, SpatialQueryDescriptorHandle query,
62  FilterHandle processFilter, AddInfoLayoutHandle processLayout, bool processLayoutReadOnly,
63  FilterHandle spatialFilter, AddInfoLayoutHandle spatialLayout, bool spatialLayoutReadOnly);
64  static IProcessorEx* New(IDatamanager &manager, const IWindow &processLimit, SpatialQueryDescriptorHandle query,
65  FilterHandle processFilter, AddInfoLayoutHandle processLayout, bool processLayoutReadOnly,
66  FilterHandle spatialFilter, AddInfoLayoutHandle spatialLayout, bool spatialLayoutReadOnly);
67 protected:
68  virtual ~IProcessorEx() {}
69 
70 public:
71  /// set and optional control object
72  virtual void setControlObject(ControlObjectHandle control) = 0;
73  /// get the current control object
74  virtual ControlObjectHandle getControlObject() const = 0;
75 
76  /// \brief start processing with the given kernel object
77  /// \param[in] kernel processing kernel object (will be cloned for each processing thread)
78  /// \param[in] threads number of processing thread (0 -> use logical number of cpus of the current machine)
79  /// \param[in] messageOutput optional message callback object to recieve warnings and errors
80  virtual void runThreaded(IPointKernelEx &kernel, int threads = 0, MessageOutputHandle messageOutput = MessageOutputHandle()) = 0;
81 
82  /// get processing statistic object (after the runThreaded function was called)
83  virtual ProcessStatsHandle getStats() const = 0;
84 };
85 
87 
88 
89 DM_NAMESPACE_END
90 
91 #endif //DM_PROCESSOR_IPROCESSOR_HPP_INCLUDED