// -*-c++-*- #ifndef __HPCXX_ARRAYS_H_ #define __HPCXX_ARRAYS_H_ #include #include #include "Constants.h" #include #include "HPCxx_String.h" template class HPCxx_Array { private: int len; T *value; int rel; int type; // indicates data type of T HPCxx_String FQNofObject; // required for String[] and Obj[] // 10 boolean array // 11 byte array // 12 short array // 13 int array // 14 long array // 15 float array // 16 double array // 17 char array // 18 array of references (HPCxx_String, TestObj, ...) public: HPCxx_Array() : value(NULL), len(0), rel(0), type(0), FQNofObject(NULL) {} HPCxx_Array(T *v, int l, int r = 1, int type = 10 ) : value(v), len(l), rel(r) {} HPCxx_Array(HPCxx_Array &source); HPCxx_Array& operator=(HPCxx_Array &source); void displayArray(); ~HPCxx_Array() ; int length() { return len; } int getType() { return type; } void setRelease() { rel = 1; } void setUnrelease() { rel = 0; } T* getValue() { return value; } T& operator[](int index) { return value[index]; } const T& operator[](int index) const { return value[index]; } friend void hpcxx_pack(HPCxx_Buffer &buffer, HPCxx_Array *r, int count); friend void hpcxx_unpack(HPCxx_Buffer &buffer, HPCxx_Array *r, int count); }; template void hpcxx_pack(HPCxx_Buffer &buffer, HPCxx_Array *r, int count); template void hpcxx_unpack(HPCxx_Buffer &buffer, HPCxx_Array *r, int count); #define HPCxx_Array1 HPCxx_Array #endif // __HPCXX_ARRAYS_H_