Skip to content

Instantly share code, notes, and snippets.

@matzew
Created August 17, 2012 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matzew/3379392 to your computer and use it in GitHub Desktop.
Save matzew/3379392 to your computer and use it in GitHub Desktop.
Pipeline and Pipe BASIC functionality

For the pipeline, the basic functionality is:

@interface AGPipeline : NSObject

// class factory methods to create the pipeline object
+(id) pipelineWithPipe:(NSString*) pipe;
+(id) pipelineWithPipes:(NSString*) pipe, ...;
//TODO: define factory method to create a pipeline w/ config object (can be an NSDictionary...)

// pipeline object methods
-(id<AGPipe>) add:(NSString*) pipe;
-(id<AGPipe>) remove:(NSString*) pipe;
-(id<AGPipe>) get:(NSString*) pipe;

@end

For the actual pipe objects:

@protocol AGPipe <NSObject>

-(NSArray*) read;
-(NSArray*) readWithFilter:(id)filterObject;

// for REST adapter the RETURN value can be an NSDictionary (returned from AFNetworking)...
-(id) save:(NSArray*) object;
-(id) remove:(int) id;

@end

The different adapters (e.g. rest adapter) are than implementing the 'pipe' functionality:

@interface AGRestAdapter : NSObject <AGPipe>

@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment