PEPPHER Compostion Tool Prototype - Vector


template <typename T>
class Vector : public IContainer<T>
{

//-- Friend --//

    friend std::ostream& operator<< (std::ostream& output, Vector<T>& vec);

//-- Constructors and Destructor --//

    Vector();

    Vector(const Vector& vec);
    
    Vector(T * const ptr, int size, ContainerBehavior _behav= INSIDE_COMPONENT_CONTAINER);

    explicit Vector(size_type num, const T& val = T());

    virtual ~Vector();

//-- Member classes --//

    class iterator;

    class proxy_elem;

//-- Methods related to StarPU memory management and implementation of the IContainer interface --//
   
    void acquireRead() const;
    
    void acquireReadWrite();
    
    void release_acquire();
    
    bool supportPartitioning();
    
    T* getRawType();
    
    starpu_data_handle_t registerWithStarPU();
    
    void unregisterWithStarPU(bool update=true);
    
    int totalPartitions(int dimension = 1);
    
    starpu_data_handle_t registerSubWithStarPU(int partSizes[], int dimensions);

    starpu_data_handle_t registerPartitions(int _parts);
    
    starpu_data_handle_t getSubHandle(int parts[], int dimensions);

//-- Operators --//

    T& operator[](const size_type index);
    
    const T& operator[](const size_type index) const;
    
    // Based on copy ellission, copy-and-swap idiom, and other optimizations
    Vector<T>& operator=(Vector<T> other);

    bool operator==(const Vector<T>& c1);
    
    bool operator!=(const Vector<T>& c1);

//-- STL vector regular interface --//

    iterator begin();
    
    iterator end();

    size_type capacity() const;

    size_type size() const;

    size_type max_size() const;

    void resize(size_type num, T val = T());

    bool empty() const;

    void reserve(size_type size);

    proxy_elem at(size_type loc);
    
    const T& at(size_type loc) const;

    proxy_elem back();
    
    const T& back() const;

    proxy_elem front();
    
    const T& front() const;

    void assign( size_type num, const T& val );

    void clear();

    iterator erase( iterator loc );
    
    iterator erase( iterator start, iterator end );

    iterator insert( iterator loc, const T& val );
    
    void insert( iterator loc, size_type num, const T& val );

    void pop_back();

    void push_back(const T& val);

    void swap(Vector<T>& from);

//-- Additions to interface --//

    void flush();

    // Does not care about device data, use with care
    T& operator()(const size_type index);

};