/**************************************************************/
/**  C++ code Copyright (C) Nick V. King <nking@eworld.com>  **/
/**************************************************************/

#ifndef T_ARRAY_MACH
#define T_ARRAY_MACH

#include <defines.h>
#include <stdarg.h>

#include <binned_edr.h>
#include <timeclass.h>
  struct time_index  
  { public:
      int n; 
      timeclass t; 
      time_index(void) : n(0), t(0) { }
  };
typedef struct time_index time_index;

#define DECLARE_ARRAY_TYPE(type)											\
																			\
class big_array_##type														\
{																			\
	uint32 _size;															\
	type##* _tpp;															\
 																			\
public:																		\
	big_array_##type##(const uint32);										\
	~big_array_##type##(void);												\
	inline void auto_resize(void) {};										\
	inline void no_auto_resize(void) {};									\
	void set_value(const type);												\
	void resize(const uint32);												\
	type##& operator[](const uint32) const;									\
	inline uint32 size(void) const { return _size; }						\
};																			\
																			\
class big_multi_array_##type												\
{																			\
protected:																	\
	int _n_dimensions;														\
	int* _dimensions;														\
	big_array_##type _array;												\
																			\
public:																		\
	big_multi_array_##type##(const uint, ...);								\
	~big_multi_array_##type##(void);										\
	void set_value(const type);												\
	void freeze(void) {};													\
	type##& element(const uint, ...) const;									\
};																			\
																			\
class big_2_array_##type : public big_multi_array_##type					\
{																			\
public:																		\
	big_2_array_##type(const uint, const uint);								\
	type##& element(const uint, const uint) const;							\
};																			\
																			\
class big_4_array_##type : public big_multi_array_##type					\
{																			\
public:																		\
	big_4_array_##type##(const uint, const uint, const uint, const uint);	\
	type##& element(const uint, const uint, const uint, const uint) const;	\
};

DECLARE_ARRAY_TYPE(octet)
DECLARE_ARRAY_TYPE(binned_edr)
DECLARE_ARRAY_TYPE(time_index)
DECLARE_ARRAY_TYPE(int16)
DECLARE_ARRAY_TYPE(uint16)
DECLARE_ARRAY_TYPE(uint32)

#endif

/***********/
/**  End  **/
/***********/