PEPPHER Composition Tool Prototype - IContainer

#ifndef I_CONTAINER_H
#define I_CONTAINER_H

#include < starpu.h >

template <typename T >
class IContainer
{

public:

        // register data with StarPU
        virtual starpu_data_handle_t registerWithStarPU() = 0; // Should give the main handle

        // un-register data with StarPU
        virtual void unregisterWithStarPU(bool update=true) = 0;

        // return the raw pointer to the payload data
        virtual T* getRawType() = 0;

        // check whether a container support partitioning. return false, default behavior...
        virtual bool supportPartitioning() {
           return false; 
        }

        // call registerWithStarPU(), default behavior...
        virtual starpu_data_handle_t registerSubWithStarPU(int partSizes[], int dimensions) {
           return registerWithStarPU();  
        }

        // call registerWithStarPU(), default behavior...
        virtual starpu_data_handle_t getSubHandle(int parts[], int dimensions) {
           return registerWithStarPU(); 
        }

        // return total number of partition on a dimension (only for matrix, there are 2 dimensions)
        virtual int totalPartitions(int dimension = 1) {
           return 1; 
        }

        // return size of a container on a dimension (only for matrix, there are 2 dimensions)
        virtual int size(int dimension = 1) { return 1; }
	
        // get most recent data back on main memory for readwrite purpose.
        virtual void flush()=0;

protected:
        // the destructor is protected non-virtual as we dont want to allow delete on 
        // pointers of InContainer (i.e. no polyphorphic behavior).
        ~IContainer() {}

};

#endif