#import <Foundation/Foundation.h>
#include <pbio/ProcessingBlock.h>
#import <ProcessingBlock.h>

#import "TryCatch.mm"
#include <fstream>


@implementation ProcessingBlock

-(nonnull instancetype) init: (void*) pb{
    ptr = pb;
    return self;
}

-(void) dealloc{
    delete static_cast<pbio::ProcessingBlock*>(ptr);
}

-(void) process: (Context* _Nonnull) data{
    pbio::ProcessingBlock& block = *(static_cast<pbio::ProcessingBlock*>(ptr));
    pbio::Context& dataCtx = *(static_cast<pbio::Context*>(data.ptr));
    block(dataCtx);
}


@end
