Newer
Older
Import / research / pipeline / Modules / RoutingModule.cpp
@John Ryland John Ryland on 22 Dec 2020 534 bytes add new projects


class RoutingModule : public SimpleModule {
public:
    RoutingModule() { }
    
//    bool supportsOutputType(Format type) { return outputFormat() == type; }
   
    void process( const Frame &frame )
    {
        dispatch( routes[Format(frame.id())], Process, &frame );
    }
    
    void connectTo( Module *next, const Frame &f )
    { 
        setRoute( next->inputFormat(), next );
    }

private:
    void setRoute( Format t, Module* m )
    {
        routes[Format(t)] = m;
    }
    
    map<Format, Module*> routes;
};