General utility functions
The functions mentioned below are accessible by including the file
"udcs.h" and preceding the function names by 'Udcs::' . These
functions are part of the Udcs class, but are static, so they don't
need an actual instantiation of the class.
string& read_str(FILE* fd, string& ret);
read_str reads a raw character string from the file descriptor fd until
it hits a NULL character, then returns the string (see Microsoft standard
library) object in ret.
void setbit(unsigned char* map, unsigned __int64 bit_idx);
setbit sets the bit_idx'th bit in array map to 1 without modifying
any others.
void clearbit(unsigned char*map, unsigned __int64
bit_idx);
clearbit sets the bit_idx'th bit in array map to 0 without modifying
any others.
bool isbitset(unsigned char byte, unsigned char bit);
isbitset checks whether the bit'th bit of byte is set. If it is, returns
true, otherwise false.
bool isbitset(unsigned char* map, unsigned __int64 bit_idx);
isbitset checks whether the bit_idx'th bit of array map is set. If it
is, returns true, otherwise false.
float size_of(unsigned char pdp_flag);
returns the byte size of a sample, according to the PDP_FLAG_ISXXXX
flag system.
unsigned __int64 byte_size_of_samples(unsigned __int64 sample_count,
unsigned char type_flag);
returns the total byte size of sample_count number
of samples, according to the PDP_FLAG_ISXXXX flag system.
static unsigned __int64 bit_size_of(unsigned char pdp_flag);
returns the number of bits that a data type describe by pdp_flag (according
to the PDP_FLAG_ISXXXX flag system) would need.
static unsigned int size_of_valid_map(UdcsChannel* c);
returns what should be the size of the valid_map according the
c->data_type and c->sample_count.
static bool toFile_help_write_str(string& str, FILE* fd);
writes the contents of string object 'str' into the file descriptor
fd. returns true on success
|