21#define HILO(x) (x##_hi << 8 | x##_lo)
22#define HILOHILO(x) (x##_hi_hi << 24 | x##_hi_lo << 16 | x##_lo_hi << 8 | x##_lo_lo)
23#define BCD_TIME_TO_SECONDS(x) ((3600 * ((10*((x##_h & 0xF0)>>4)) + (x##_h & 0xF))) + \
24 (60 * ((10*((x##_m & 0xF0)>>4)) + (x##_m & 0xF))) + \
25 ((10*((x##_s & 0xF0)>>4)) + (x##_s & 0xF)))
41 void assign(
const unsigned char*data,
int size,
bool doCopy=
true);
54 template <
typename T>
const T*
getData(
int offset)
const {
return (T*)(
data_->data+offset+
off); }
76 {
return u_int16_t((
data[index] << 8) |
data[index+1]); }
78 {
return u_int32_t((
data[index] << 24) | (
data[index+1] << 16) | (
data[index+2] << 8) |
data[index+3]); }
111 virtual void Delete()
override;
118 virtual void Delete()
override;
139time_t
getTime(
unsigned char date_hi,
unsigned char date_lo,
unsigned char timehr,
unsigned char timemi,
unsigned char timese);
140time_t
getDuration(
unsigned char timehr,
unsigned char timemi,
unsigned char timese);
141inline unsigned char bcdToDec(
unsigned char b) {
return (
unsigned char)(((b >> 4) & 0x0F) * 10 + (b & 0x0F)); }
147 CRC32(
const char *d,
int len, u_int32_t CRCvalue=0xFFFFFFFF);
149 static bool isValid(
const char *d,
int len, u_int32_t CRCvalue=0xFFFFFFFF) {
return crc32(d, len, CRCvalue) == 0; }
150 static u_int32_t
crc32(
const char *d,
int len, u_int32_t CRCvalue);
static bool isValid(const char *d, int len, u_int32_t CRCvalue=0xFFFFFFFF)
CRC32(const char *d, int len, u_int32_t CRCvalue=0xFFFFFFFF)
static u_int32_t crc_table[256]
static u_int32_t crc32(const char *d, int len, u_int32_t CRCvalue)
virtual void Delete() override
virtual ~DataForeignData() override
virtual void assign(const unsigned char *data, int size) override
virtual void Delete() override
virtual ~DataOwnData() override
virtual void assign(const unsigned char *data, int size) override
const unsigned char * data
u_int16_t TwoBytes(const int index) const
virtual void assign(const unsigned char *data, int size)=0
u_int32_t FourBytes(const int index) const
const T * getData() const
unsigned char operator[](const int index) const
void assign(const unsigned char *data, int size, bool doCopy=true)
void setPointerAndOffset(const T *&p, int &offset) const
CharArray operator+(const int offset) const
u_int32_t FourBytes(const int index) const
const unsigned char * getData(int offset) const
const unsigned char * getData() const
void addOffset(int offset)
u_int16_t TwoBytes(const int index) const
bool operator==(const char *string) const
const T * getData(int offset) const
CharArray & operator=(const CharArray &source)
bool checkSize(int offset)
unsigned char bcdToDec(unsigned char b)
time_t getTime(unsigned char date_hi, unsigned char date_lo, unsigned char timehr, unsigned char timemi, unsigned char timese)
time_t getDuration(unsigned char timehr, unsigned char timemi, unsigned char timese)