RaftLib icon indicating copy to clipboard operation
RaftLib copied to clipboard

Suggestion : Dynamic Pipelines

Open yashhema opened this issue 7 years ago • 1 comments

Hello, I have pipeline defined in textfile like OperationA para1 para2|OperationB para1 para2 para3|OperationC para1 where OperationA takes 2 input parameters , OperationB takes 3 parameters

(I have already defined these operations as functions, all these functions have same returntype )

Can someone provide me pointers, how can I read this from text and create a pipeline dynamically in code for this.

(The operation names can vary , depending upon whats defined in text file)

yashhema avatar Feb 10 '18 21:02 yashhema

Hi there, just another user here.

You might put all the possible operations in a std::map, then create a generic class that inherits from raft::kernel. That class could accept a method that will be any of the operations and then accept also a list of parameters.

The logic can be something like this:

// Define all possible operations
map m
loop possibleOperations
{
   m.insert("operationLabel", operationMethod)
}

// Parse text file
verctor v
loop readOperations
{
   new GenericKernel gk
   gk->setMethod(m.at(currentOperationLabel))
   loop parameters
   {
       gk->addParameter(parameter)
   }
   v.insert(gk)
}

// Build stream
raft::map m
GenericKernel prev = v(1)
loop v(from 2nd)
{
   m += prev >> curr
   prev = curr;  
}

Just an idea, hope it helps, Cheers...

mr-j0nes avatar Apr 25 '18 09:04 mr-j0nes