Protocol++® (Protocolpp®)
v5.6.2
|
Public Member Functions | |
jarray () | |
Standard constructor for jarray class. | |
jarray (uint32_t size) | |
jarray (std::initializer_list< T > init) | |
jarray (uint32_t size, T value, endian_t format=BIG) | |
jarray (const jarray< T > &rhs, endian_t format=BIG) | |
jarray (const std::string &rhs, endian_t format=BIG, bool encoded=false) | |
jarray (const std::vector< T > &rhs, endian_t format=BIG) | |
jarray (const T *rhs, uint32_t size, endian_t format=BIG) | |
jarray (const std::shared_ptr< jarray< T >> &rhs, endian_t format=BIG) | |
template<typename TT > | |
jarray (jarray< TT > &rhs, endian_t format=BIG) | |
~jarray ()=default | |
Standard deconstructor for jarray. | |
uint32_t | get_size () |
bool | empty () |
jarray< T > | split (uint32_t elements) |
jarray< T > | extract (uint32_t index, uint32_t elements) |
void | push_back (T rhs) |
void | pop_back () |
void | resize (uint32_t newsize) |
void | append (jarray< T > rhs) |
void | append (T *rhs, uint32_t rhs_size) |
void | append (std::initializer_list< T > rhs) |
void | insert (uint32_t index, jarray< T > &rhs) |
void | update (uint32_t index, jarray< T > &rhs) |
void | erase (uint32_t index, uint32_t elements) |
void | intersect (jarray< T > &rhs) |
void | reverse () |
Method to reverse the elements of the array. | |
T * | get_ptr () |
const T * | get_ptr () const |
std::shared_ptr< jarray< T > > | get_shared () |
const std::shared_ptr< jarray< T > > | get_shared () const |
std::string | to_string (bool printable=false, int indent=10, bool xml=false) |
std::string | debug (jarray< T > &expect, int indent=10) |
bool | operator== (jarray< T > &rhs) |
bool | operator== (const jarray< T > &rhs) const |
bool | operator!= (jarray< T > &rhs) |
bool | operator!= (const jarray< T > &rhs) const |
void | operator^= (jarray< T > &rhs) |
void | operator|= (jarray< T > &rhs) |
void | operator&= (jarray< T > &rhs) |
void | operator*= (jarray< T > &rhs) |
void | operator+= (jarray< T > &rhs) |
T & | operator[] (uint32_t index) |
const T & | operator[] (uint32_t index) const |
endian_t | get_format () |
void | serase () |
Method to scrub array in memory. | |
|
explicit |
Constructor for jarray initialized to size
size | - size to initialize the array to |
jarray::jarray | ( | std::initializer_list< T > | init | ) |
Constructor for jarray initialized to size with value
init | - initializer list in curly braces myarr<uint8_t> {0x10, 0x1E}; |
Constructor for jarray initialized to size with value
size | - size to initialize the array to |
value | - value to initialize the array to |
format | - endianness of the constructed array (BIG, LITTLE) |
Copy Constructor for jarray
rhs | - array to copy |
format | - endianness of the constructed array (BIG, LITTLE) |
|
explicit |
Constructor for jarray from a string
rhs | - string to populate the array with |
format | - endianness of the constructed array (BIG, LITTLE) |
encoded | - Input string has already been encoded as HEX characters instead of being a simple string. For example, if the input string had been encoded as bytes each character in the string would be equal to something like '0x6C' or '0xAE'. If the input was a simple string each character would represent a single value such that the string "123ABC" is really "1", "2" "3", "A", "B", "C" and needs to be converted and grouped into HEX such that the resulting array has "0x12", "0x3A", and "0xBC". The Crypto++ library uses encoded strings. Set encoded to true to read in ASCII characters |
|
explicit |
Constructor for jarray from a standard vector
rhs | - vector to initialize the array with |
format | - endianness of the constructed array (BIG, LITTLE) |
Constructor for jarray from a uint8_t raw pointer and size
rhs | - byte pointer to initialize the array with |
size | - length of the data to convert |
format | - endianness of the constructed array (BIG, LITTLE) |
|
explicit |
Constructor for jarray from a shared pointer
rhs | - byte pointer to initialize the array with |
format | - endianness of the constructed array (BIG, LITTLE) |
|
explicit |
Constructor for jarray from one type to another
rhs | - initial array to convert. Conversion is to type of array that is being constructed. Example: jarray<uint32_t> oldarray("AABBCCDD");
jarray<uint8_t> newarray(oldarray, LITTLE);
newarray.to_sting();
"DDCCBBAA"
@ LITTLE Little endian with formatting as b[0]b[1]b[2]b[3]. Definition: jenum.h:1212 |
format | - endianness of the constructed array (BIG, LITTLE) |
void jarray::append | ( | jarray< T > | rhs | ) |
Method to add the array rhs to the current array
rhs | - array to add to this array |
void jarray::append | ( | std::initializer_list< T > | rhs | ) |
Method to add the array rhs to the current array
rhs | - initializer list to add to this array |
void jarray::append | ( | T * | rhs, |
uint32_t | rhs_size | ||
) |
Method to add the array rhs to the current array
rhs | - pointer to array to add to this array |
rhs_size | - length of the array pointed to by rhs |
std::string jarray::debug | ( | jarray< T > & | expect, |
int | indent = 10 |
||
) |
Method to compare arrays side by side for debug as shown below prints to std::err
expect | - Expected data to print |
indent | - default indentation for pretty printing |
bool jarray::empty |
Method to determine if the array is empty
void jarray::erase | ( | uint32_t | index, |
uint32_t | elements | ||
) |
Method to remove the elements from the array starting at index and continuing for size. The original array is reduced by the number of elements requested
index | - location to start erasing elements |
elements | - number of elements to remove from this array |
jarray< T > jarray::extract | ( | uint32_t | index, |
uint32_t | elements | ||
) |
Method to extract the number of elements from the array starting at the start value
index | - index to start the extraction |
elements | - number of elements to split from the array |
endian_t jarray::get_format |
Method to return endianness format of this array
T * jarray::get_ptr |
Method to return the pointer to the underlying data object of the array
const T * jarray::get_ptr |
Method to return the pointer to the underlying data object of the array
std::shared_ptr< jarray< T > > jarray::get_shared |
Method to return the shared pointer of the array
const std::shared_ptr< jarray< T > > jarray::get_shared |
Method to return the shared pointer of the array
uint32_t jarray::get_size |
Method to retrieve size of this array
void jarray::insert | ( | uint32_t | index, |
jarray< T > & | rhs | ||
) |
Method to insert the array rhs into this array starting at index The array is resized to accomodate this array plus the new array No elements of the original array are overwritten
index | - location to start the insertion |
rhs | - array to insert into this array |
void jarray::intersect | ( | jarray< T > & | rhs | ) |
Method to intersect two arrays and return the shared valeus in both arrays
rhs | - array to intersect with this array (retains shared values) |
bool jarray::operator!= | ( | const jarray< T > & | rhs | ) | const |
Method to compare two different arrays. First compares array size then iterates through all array values and compares them for inequality
rhs | - array to compare with this array |
bool jarray::operator!= | ( | jarray< T > & | rhs | ) |
Method to compare two different arrays. First compares array size then iterates through all array values and compares them for inequality
rhs | - array to compare with this array |
void jarray::operator&= | ( | jarray< T > & | rhs | ) |
Method to AND two different arrays
rhs | - array to AND with this array |
void jarray::operator*= | ( | jarray< T > & | rhs | ) |
Method to MULTIPLY two different arrays
rhs | - array to MULTIPLY with this array |
void jarray::operator+= | ( | jarray< T > & | rhs | ) |
Method to ADD two different arrays
rhs | - array to ADD with this array |
bool jarray::operator== | ( | const jarray< T > & | rhs | ) | const |
Method to compare two different arrays. First compares array size then iterates through all array values and compares them for equality
rhs | - array to compare with this array |
bool jarray::operator== | ( | jarray< T > & | rhs | ) |
Method to compare two different arrays. First compares array size then iterates through all array values and compares them for equality
rhs | - array to compare with this array |
T & jarray::operator[] | ( | uint32_t | index | ) |
Method to return array value at index
index | - location of array element to return |
const T & jarray::operator[] | ( | uint32_t | index | ) | const |
Method to return const array value at index
index | - location of array element to return |
void jarray::operator^= | ( | jarray< T > & | rhs | ) |
Method to XOR two different arrays
rhs | - array to XOR with this array |
void jarray::operator|= | ( | jarray< T > & | rhs | ) |
Method to OR two different arrays
rhs | - array to OR with this array |
void jarray::pop_back |
Method to removed the last element from the array. The element is destroyed in the process
void jarray::push_back | ( | T | rhs | ) |
Method to add a single element to the end of the array
rhs | - element to add to this array |
void jarray::resize | ( | uint32_t | newsize | ) |
Method to change the array size
newsize | - either shrink or expand the array to the new size |
jarray< T > jarray::split | ( | uint32_t | elements | ) |
Method to split the number of elements from the front of the array and return it to the caller. The original array is reduced by the number of elements split from it
elements | - number of elements to split from the array |
std::string jarray::to_string | ( | bool | printable = false , |
int | indent = 10 , |
||
bool | xml = false |
||
) |
Method to convert this array into a string representation for printing purposes. Output is formatted either as a single, long string of HEX characters if 'printable' is false or is a pretty printed 16-bytes across with underscores as follows if 'printable' is true
printable | - if false, output is a single string of HEX characters. If true, enables pretty_printing of the array with formatting |
indent | - default indentation for pretty printing ignored if printable is false |
xml | - Print as an XML data object as found below * 22223333444455556666777788889999 * 2222333344445555666677778888 * |
void jarray::update | ( | uint32_t | index, |
jarray< T > & | rhs | ||
) |
Method to update the array rhs into this array starting at index The array is resized to accomodate this array plus the new array Elements of the original array starting at index and extending for the length of rhs are overwritten with the new values
index | - location to start the update |
rhs | - array to update this array with |