4 #include <unordered_map>
5 #include <unordered_set>
33 void update(
int executeToken = -1);
34 typedef std::shared_ptr<ProcessObject>
pointer;
40 void enableRuntimeMeasurements();
41 void disableRuntimeMeasurements();
57 int getNrOfInputConnections()
const;
58 int getNrOfOutputPorts()
const;
60 virtual std::string getNameOfClass()
const = 0;
62 return "ProcessObject";
64 virtual void loadAttributes();
65 std::shared_ptr<Attribute> getAttribute(std::string
id);
66 std::unordered_map<std::string, std::shared_ptr<Attribute>> getAttributes();
67 void setAttributes(std::vector<std::shared_ptr<Attribute>> attributes);
74 void setModified(
bool modified);
76 template <
class DataType>
77 std::shared_ptr<DataType> updateAndGetOutputData(
uint portID = 0);
86 int m_lastExecuteToken = -1;
89 virtual void execute()=0;
90 virtual void preExecute();
91 virtual void postExecute();
93 template <
class DataType>
94 void createInputPort(
uint portID,
bool required =
true);
95 template <
class DataType>
96 void createOutputPort(
uint portID);
98 template <
class DataType>
99 std::shared_ptr<DataType> getInputData(
uint portID = 0);
100 template <
class DataType>
101 std::shared_ptr<DataType> getOutputData(
uint portID = 0);
104 bool hasNewInputData(
uint portID);
111 void createOpenCLProgram(std::string sourceFilename, std::string name =
"");
112 cl::Program getOpenCLProgram(
113 std::shared_ptr<OpenCLDevice> device,
114 std::string name =
"",
115 std::string buildOptions =
""
118 void createFloatAttribute(std::string
id, std::string name, std::string description,
float initialValue);
119 void createIntegerAttribute(std::string
id, std::string name, std::string description,
int initialValue);
120 void createBooleanAttribute(std::string
id, std::string name, std::string description,
bool initialValue);
121 void createStringAttribute(std::string
id, std::string name, std::string description, std::string initialValue);
122 float getFloatAttribute(std::string
id);
123 int getIntegerAttribute(std::string
id);
124 bool getBooleanAttribute(std::string
id);
125 std::string getStringAttribute(std::string
id);
126 std::vector<float> getFloatListAttribute(std::string
id);
127 std::vector<int> getIntegerListAttribute(std::string
id);
128 std::vector<bool> getBooleanListAttribute(std::string
id);
129 std::vector<std::string> getStringListAttribute(std::string
id);
135 std::unordered_map<uint, ExecutionDevice::pointer>
mDevices;
144 std::unordered_map<uint, std::pair<DataObject::pointer, uint64_t>>
mLastProcessed;
146 void validateInputPortExists(
uint portID);
147 void validateOutputPortExists(
uint portID);
153 std::unordered_map<std::string, std::shared_ptr<Attribute>>
mAttributes;
161 int m_maximumNrOfFrames = -1;
166 template<
class DataType>
172 template<
class DataType>
177 template<
class DataType>
182 mLastProcessed[portID] = std::make_pair(data, data->getTimestamp());
183 auto convertedData = std::dynamic_pointer_cast<DataType>(data);
186 throw BadCastException(data->getNameOfClass(), DataType::getStaticNameOfClass());
189 for(
auto&& lastFrame : data->getLastFrame())
191 for(
auto&& frameData : data->getFrameData())
194 return convertedData;
197 template<
class DataType>
201 std::shared_ptr<DataType> returnData = DataType::New();
210 template<
class DataType>
214 return port->getNextFrame<
DataType>();