7 #include "imstkGeometryAlgorithm.h" 8 #include "imstkGeometry.h" 9 #include "imstkLogger.h" 16 if (m_inputs.count(port) == 0)
18 LOG(WARNING) <<
"Tried to set input " << port <<
" on filter with " << m_NumInputPorts <<
" ports";
21 m_inputs[port] = inputGeometry;
27 if (m_outputs.count(port) == 0)
29 LOG(WARNING) <<
"Tried to set output " << port <<
" on filter with " << m_NumOutputPorts <<
" ports";
31 m_outputs[port] = outputGeometry;
37 this->m_NumInputPorts = numPorts;
39 for (
size_t i = 0; i < numPorts; i++)
41 if (m_inputs.count(i) == 0)
43 m_inputs[i] =
nullptr;
51 this->m_NumOutputPorts = numPorts;
53 for (
size_t i = 0; i < numPorts; i++)
55 if (m_outputs.count(i) == 0)
57 m_outputs[i] =
nullptr;
66 for (
const auto& port : m_inputs)
68 const size_t portId = port.first;
70 auto found = m_requiredTypeChecks.find(portId);
71 if (found != m_requiredTypeChecks.cend())
74 if (port.second ==
nullptr)
76 LOG(WARNING) <<
"GeometryAlgorithm input " << portId <<
" missing!";
79 else if (!found->second(input))
81 LOG(WARNING) <<
"GeometryAlgorithm received invalid geometry type \"" <<
82 m_inputs.at(portId)->getTypeName() <<
"\" in port " << portId;
88 found = m_optionalTypeChecks.find(portId);
89 if (found != m_optionalTypeChecks.cend())
92 if (input !=
nullptr && !found->second(input))
94 LOG(WARNING) <<
"GeometryAlgorithm received invalid geometry type \"" <<
95 m_inputs.at(portId)->getTypeName() <<
"\" in port " << portId;
void setNumOutputPorts(const size_t numPorts)
Get/Set the amount of output ports.
Base class for any geometrical representation.
void setInput(std::shared_ptr< Geometry > inputGeometry, size_t port=0)
Set the input at the port.
virtual bool areInputsValid()
Check inputs are correct.
void setOutput(std::shared_ptr< Geometry > inputGeometry, const size_t port=0)
Set the output at the port.
void setNumInputPorts(const size_t numPorts)
Get/Set the amount of input ports.