// // This header file defines the container class openArrayT<> and // its associated iterator. This container class represents an open // array with packed and unpacked dimensions. // #ifndef OPEN_ARRAY_H #define OPEN_ARRAY_H #include "svdpi.h" namespace DPI_OO { template class arrayT; template class arrayIterT { public: arrayIterT(arrayT* arr, int idx) : array(arr), index(idx) {} ~arrayIterT() {} arrayIterT& operator = (const arrayIterT& other) { index = other->get_index(); array = other->get_array(); } arrayIterT& operator + (int plus_val) { index += plus_val; return *this; } arrayIterT& operator ++ () { index ++; return *this; } arrayIterT& operator ++ (int) { index ++; return *this; } ELEM_TYPE* operator * () { return array->operator[] (index); } bool operator != (const arrayIterT& other) { if (this->get_array() != other.get_array() || this->get_index() != other.get_index()) { return true; } return false; } arrayT* get_array() const { return array; } int get_index() const { return index; } private: arrayT* array; int index; }; template class arrayT { public: arrayT(); arrayT(const arrayT& from); ~arrayT(); // Bit select read and write virtual void get_elem_val(int idx, ELEM_TYPE* val) = 0; virtual void set_elem_val(int idx, const ELEM_TYPE* val) = 0; virtual ELEM_TYPE* operator [] (int idx) = 0; virtual ARRAY_TYPE* operator* () = 0; }; }; #endif