Enzo
Loading...
Searching...
No Matches
enzo::nt::GeometryOperator Class Reference

The unique runtime representation of a node. More...

#include <GeometryOperator.h>

Public Member Functions

 GeometryOperator (enzo::nt::OpId opId, op::OpInfo opInfo)
 Constructs a new node.
 
 GeometryOperator (const GeometryOperator &)=delete
 Deleted copy constructor to avoid accidental copies.
 
GeometryOperatoroperator= (const GeometryOperator &)=delete
 Deleted copy assignment operator to avoid accidental copies.
 
void cookOp (op::CookContext context)
 Computes the output geometry based on the cookOp definition in nt::GeometryOpDef. This is set by the opInfo constructor parameter.
 
std::shared_ptr< const enzo::NodePacketgetOutputPacket (unsigned int outputIndex) const
 Returns the current output geometry.
 
std::vector< std::weak_ptr< prm::NodeParameter > > getParameters ()
 Returns all parameters belonging to this node.
 
std::weak_ptr< prm::NodeParametergetParameter (std::string_view parameterName)
 Returns a parameter with the given name belonging to this node.
 
bool isParameterEnabled (std::string_view parmName)
 Whether the named parameter's disable condition leaves it enabled.
 
bool isParameterHidden (std::string_view parmName)
 Whether the named parameter's hide condition currently hides it.
 
const std::vector< prm::Template > & getTemplates () const
 Returns the template tree declared by this node's type.
 
std::string getName () const
 Returns the runtime name uniquely identifying this node within its scope (eg. "my_node_05")
 
const PathgetPath () const
 Returns the full path locating this node within the network.
 
void setPath (const Path &path)
 Sets the full path locating this node within the network.
 
const op::OpInfogetType () const
 Returns the static type definition this node was created from.
 
void dirtyNode (bool dirtyDescendents=true)
 Marks the outputed geometry as outdated and notifies the network.
 
bool isDirty ()
 Returns true if the node is dirty and false if the node is clean (does not need cooking).
 
unsigned int getMinInputs () const
 Returns the minimum number of input connections required for the node to function. These are in order so 3 would mean the first three inputs must have a connection.
 
unsigned int getMaxInputs () const
 Returns the maximum number of input connections accepted by the node.
 
unsigned int getMaxOutputs () const
 Returns the number of available outputs the node provides.
 
Vector2 getPosition () const
 Returns the node's position in the network graph.
 
void setPosition (Vector2 pos)
 Sets the node's position in the network graph.
 

Public Attributes

boost::signals2::signal< void(nt::OpId opId, bool dirtyDescendents)> nodeDirtied
 A signal emitted when the node is dirtied. This will usually notify the NetworkManager.
 
boost::signals2::signal< void(const std::string &parmName)> parameterChanged
 A signal emitted when one parameter's value changes, carrying its name.
 

Detailed Description

The unique runtime representation of a node.

Constructor & Destructor Documentation

◆ GeometryOperator()

enzo::nt::GeometryOperator::GeometryOperator ( enzo::nt::OpId opId,
op::OpInfo opInfo )

Constructs a new node.

Parameters
opIdthe operator id assigned to this node. For most situations this should be set by the nt::NetworkManager
opInfoThe data class informing the node what its properties are that set it apart from other nodes. This is what makes a grid node different to a transform node.

Member Function Documentation

◆ dirtyNode()

void enzo::nt::GeometryOperator::dirtyNode ( bool dirtyDescendents = true)

Marks the outputed geometry as outdated and notifies the network.

Parameters
dirtyDescendentsSets whether all descendents (nodes connected directly or indirectly to the output of this node) are also dirtied. This is usually what you want.

◆ getName()

std::string enzo::nt::GeometryOperator::getName ( ) const

Returns the runtime name uniquely identifying this node within its scope (eg. "my_node_05")

The name is the leaf of the node's path, not stored separately. Unlike the type name it is per node and is intended to be user assignable.

Note
The starting name is synthesized from the type name and op id as a placeholder.
Todo
implement uniqueness checked node names

◆ getOutputPacket()

std::shared_ptr< const NodePacket > enzo::nt::GeometryOperator::getOutputPacket ( unsigned int outputIndex) const

Returns the current output geometry.

Does not trigger a cook so if the geometry may be outdated if not cooked first.

Todo
Add option to force cook or cook if dirty.

◆ getParameter()

std::weak_ptr< prm::NodeParameter > enzo::nt::GeometryOperator::getParameter ( std::string_view parameterName)

Returns a parameter with the given name belonging to this node.

Returns
Empty default constructed std::weak_ptr<prm::Parameter>() if no parameter of that name exists.

◆ getTemplates()

const std::vector< prm::Template > & enzo::nt::GeometryOperator::getTemplates ( ) const

Returns the template tree declared by this node's type.

Returns
Top level templates. Group templates contain child templates recursively.

◆ getType()

const op::OpInfo & enzo::nt::GeometryOperator::getType ( ) const

Returns the static type definition this node was created from.

The type carries data shared by every node of the same type such as its name and label. Use getType().getName() for the internal type name (eg. "copy_to_points") and getType().getLabel() for the display label (eg. "Copy To Points").

◆ isParameterEnabled()

bool enzo::nt::GeometryOperator::isParameterEnabled ( std::string_view parmName)

Whether the named parameter's disable condition leaves it enabled.

Returns
True when the condition is empty, unparsable, or not met.

◆ isParameterHidden()

bool enzo::nt::GeometryOperator::isParameterHidden ( std::string_view parmName)

Whether the named parameter's hide condition currently hides it.

Returns
True only when the condition is present and met.

The documentation for this class was generated from the following files: