diff --git a/src/Engine/Operator/GeometryOpDef.h b/src/Engine/Operator/GeometryOpDef.h index 635be41..12f44c2 100644 --- a/src/Engine/Operator/GeometryOpDef.h +++ b/src/Engine/Operator/GeometryOpDef.h @@ -13,17 +13,58 @@ namespace enzo::nt { class NetworkManager; +/** +* @brief Abstract class used to create new operators. +* +* The operator definition is a base class from which new geometry operators +* are inherited from. It provides and abstracted interface, to read and +* write data about itself and the context it is being computed. +* +* The class exposes utility functions for setting outputs and reading information +* about itself like the number of inputs. +* +* The most important part of this node is the virtual cookOp member function. +* This must be overridden to implement the node's logic when being cooked. +* When a node is cooked it takes the optional input geometry from the context +* class and outputs new geometry based on the purpose of that operator. +*/ class BOOST_SYMBOL_EXPORT GeometryOpDef { public: + /** + * @brief Sets up internal state + */ GeometryOpDef(nt::NetworkManager* network, op::OpInfo opInfo); + /** + * @brief This function is called at runtime to create the output geometry + * + * @post When overriding, this function must call setOutputGeo(n) at + * the end of a successful cook. Any outputs that are not set will output + * an emtpy geometry object. + */ virtual void cookOp(op::Context context) = 0; + + /** + * @brief Returns the current output geometry. + * + * For use by the runtime Node + * Does not force a cook. + * + * @todo move to friend class Node + */ geo::Geometry& getOutputGeo(unsigned outputIndex); + /** + * @brief Stops the cook and displays an error. Use inside the #cookOp function. + * @todo Add visual error to GUI + */ void throwError(std::string error); + /// @brief Returns the minimum number of input connections for the node to function required. Set by op::OpInfo when registering the operator. unsigned int getMinInputs() const; + /// @brief Returns the maximum number of input connections accepted by the node. Set by op::OpInfo when registering the operator. unsigned int getMaxInputs() const; + /// @brief Returns the number of available outputs the node provides. Set by op::OpInfo when registering the operator. unsigned int getMaxOutputs() const; private: std::vector outputGeometry_;