-
Notifications
You must be signed in to change notification settings - Fork 74
v0.2.53..v0.2.54 changeset ElementVisitor.h
Garret Voltz edited this page Mar 31, 2020
·
1 revision
diff --git a/hoot-core/src/main/cpp/hoot/core/elements/ElementVisitor.h b/hoot-core/src/main/cpp/hoot/core/elements/ElementVisitor.h
index c80fc09..7d48acc 100644
--- a/hoot-core/src/main/cpp/hoot/core/elements/ElementVisitor.h
+++ b/hoot-core/src/main/cpp/hoot/core/elements/ElementVisitor.h
@@ -22,7 +22,7 @@
* This will properly maintain the copyright information. DigitalGlobe
* copyrights will be updated automatically.
*
- * @copyright Copyright (C) 2015, 2017, 2018, 2019 DigitalGlobe (http://www.digitalglobe.com/)
+ * @copyright Copyright (C) 2015, 2017, 2018, 2019, 2020 DigitalGlobe (http://www.digitalglobe.com/)
*/
#ifndef ELEMENTVISITOR_H
#define ELEMENTVISITOR_H
@@ -30,6 +30,8 @@
// hoot
#include <hoot/core/elements/Element.h>
#include <hoot/core/info/ApiEntityInfo.h>
+#include <hoot/core/criterion/FilteredByCriteria.h>
+#include <hoot/core/info/OperationStatusInfo.h>
namespace hoot
{
@@ -41,8 +43,11 @@ namespace hoot
* OsmMapOperation when you do not need the entire input map in memory at once (visitor logic
* does not require it and you are not running in the conflate pipeline where all map data must
* be read into memory).
+ *
+ * @todo We could eventually remove the default empty string implementations of OperationStatusInfo
+ * methods and require them to be implemented in children.
*/
-class ElementVisitor : public ApiEntityInfo
+class ElementVisitor : public ApiEntityInfo, public FilteredByCriteria, public OperationStatusInfo
{
public:
@@ -51,8 +56,50 @@ public:
ElementVisitor() : _numAffected(0), _numProcessed(0) {}
virtual ~ElementVisitor() {}
+ /**
+ * Performs the visitor's logic on a single element
+ *
+ * @param e the element to operate on
+ */
virtual void visit(const ElementPtr& e) = 0;
+ /**
+ * @see OperationStatusInfo
+ */
+ virtual long getNumFeaturesAffected() const { return _numAffected; }
+
+ /**
+ * @see OperationStatusInfo
+ */
+ virtual long getNumFeaturesProcessed() const { return _numProcessed; }
+
+ /**
+ * @see OperationStatusInfo
+ */
+ virtual QString getInitStatusMessage() const { return ""; }
+
+ /**
+ * @see OperationStatusInfo
+ */
+ virtual QString getCompletedStatusMessage() const { return ""; }
+
+ /**
+ * @see FilteredByCriteria
+ *
+ * An empty list returned here means that the visitor is associated no specific criteria and
+ * can be run against any feature type. Any visitors that want to control which feature types
+ * they are run against during conflation should populate this list. The list is treated in a
+ * logical OR fashion.
+ */
+ virtual QStringList getCriteria() const { return QStringList(); }
+
+ /**
+ * Returns the visitor's class name
+ *
+ * @return class name string
+ */
+ virtual std::string getClassName() const = 0;
+
protected:
// These will only be used by those implementing OperationStatusInfo.