You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement a library to make C++ subworker implementation easier. In spirit, this should consist of I/O and Context types, way to declare and register task functions and a simple mainloop function, similarly to #34. Would you sketch the API, @spirali?
The text was updated successfully, but these errors were encountered:
#include<rainsw.h>
use namespacerainsw;// InstanceList = LabeledList<DataInstance>// This function takes a blob and creates a new one same content + '!' at the end.
Result<InstanceList> example_fn(Context &ctx, const InstanceList &inputs)
{
if (inputs.size() != 1) {
returnResult::error("Function expects 1 input object");
}
DataObject &obj = inputs.get(0);
if (!obj.is_blob()) {
returnResult::error("1st argument should be blob");
}
Vector<byte> data;
data.assign(obj.get_ptr(), obj.size());
data.push_back('!');
InstanceList result;
result.push_back(DataObject(data));
return Result<InstanceList>(std::move(result));
}
intmain() {
Subworker subworker;
subworker.add_fn("example", example_fn);
subworker.run();
}
Implement a library to make C++ subworker implementation easier. In spirit, this should consist of I/O and Context types, way to declare and register task functions and a simple mainloop function, similarly to #34. Would you sketch the API, @spirali?
The text was updated successfully, but these errors were encountered: