Goby3  3.1.5a
2024.05.23
dccl_constants.h File Reference
#include <bitset>
#include <cmath>
#include <iomanip>
#include <limits>
#include <sstream>
#include <string>
#include <vector>
#include "goby/acomms/acomms_constants.h"
#include "goby/acomms/dccl.h"

Go to the source code of this file.

Namespaces

 goby
 The global namespace for the Goby project.
 
 goby::moos
 
 goby::moos::transitional
 

Enumerations

enum  goby::moos::transitional::DCCLType {
  goby::moos::transitional::dccl_static, goby::moos::transitional::dccl_bool, goby::moos::transitional::dccl_int, goby::moos::transitional::dccl_float,
  goby::moos::transitional::dccl_enum, goby::moos::transitional::dccl_string, goby::moos::transitional::dccl_hex
}
 Enumeration of DCCL types used for sending messages. dccl_enum and dccl_string primarily map to cpp_string, dccl_bool to cpp_bool, dccl_int to cpp_long, dccl_float to cpp_double. More...
 
enum  goby::moos::transitional::DCCLCppType {
  goby::moos::transitional::cpp_notype, goby::moos::transitional::cpp_bool, goby::moos::transitional::cpp_string, goby::moos::transitional::cpp_long,
  goby::moos::transitional::cpp_double
}
 Enumeration of C++ types used in DCCL. More...
 
enum  { goby::moos::transitional::POWER2_BITS_IN_BYTE = 3 }
 
enum  { goby::moos::transitional::POWER2_NIBS_IN_BYTE = 1 }
 
enum  goby::moos::transitional::DCCLHeaderPart {
  goby::moos::transitional::HEAD_CCL_ID = 0, goby::moos::transitional::HEAD_DCCL_ID = 1, goby::moos::transitional::HEAD_TIME = 2, goby::moos::transitional::HEAD_SRC_ID = 3,
  goby::moos::transitional::HEAD_DEST_ID = 4, goby::moos::transitional::HEAD_MULTIMESSAGE_FLAG = 5, goby::moos::transitional::HEAD_BROADCAST_FLAG = 6, goby::moos::transitional::HEAD_UNUSED = 7
}
 
enum  goby::moos::transitional::DCCLHeaderBits {
  goby::moos::transitional::HEAD_CCL_ID_SIZE = 8, goby::moos::transitional::HEAD_DCCL_ID_SIZE = 9, goby::moos::transitional::HEAD_TIME_SIZE = 17, goby::moos::transitional::HEAD_SRC_ID_SIZE = 5,
  goby::moos::transitional::HEAD_DEST_ID_SIZE = 5, goby::moos::transitional::HEAD_FLAG_SIZE = 1, goby::moos::transitional::HEAD_UNUSED_SIZE = 2
}
 

Functions

unsigned goby::moos::transitional::bits2bytes (unsigned bits)
 
unsigned goby::moos::transitional::bytes2bits (unsigned bytes)
 
unsigned goby::moos::transitional::bytes2nibs (unsigned bytes)
 
unsigned goby::moos::transitional::nibs2bytes (unsigned nibs)
 
std::string goby::moos::transitional::type_to_string (DCCLType type)
 
std::string goby::moos::transitional::type_to_protobuf_type (DCCLType type)
 
std::string goby::moos::transitional::type_to_string (DCCLCppType type)
 
std::string goby::moos::transitional::to_str (DCCLHeaderPart p)
 
Binary encoding
bool goby::moos::transitional::char_array2hex_string (const unsigned char *c, std::string &s, const unsigned int n)
 converts a char (byte) array into a hex string More...
 
bool goby::moos::transitional::hex_string2char_array (unsigned char *c, const std::string &s, const unsigned int n)
 turns a string of hex chars ABCDEF into a character array reading each byte 0xAB,0xCD, 0xEF, etc. More...
 
std::string goby::moos::transitional::long2binary_string (unsigned long l, unsigned short bits)
 return a string represented the binary value of l for bits number of bits which reads MSB -> LSB More...
 
std::string goby::moos::transitional::binary_string2hex_string (const std::string &bs)
 converts a binary string ("1000101010101010") into a hex string ("8AAA") More...
 
std::string goby::moos::transitional::hex_string2binary_string (const std::string &bs)
 converts a hex string ("8AAA") into a binary string ("1000101010101010") More...
 
template<typename T >
bool goby::moos::transitional::hex_string2number (const std::string &s, T &t)
 attempts to convert a hex string into a numerical representation (of type T) More...
 
template<typename T >
bool goby::moos::transitional::number2hex_string (std::string &s, const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string More...
 
template<typename T >
std::string goby::moos::transitional::number2hex_string (const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string assuming success More...
 
Binary encoding
bool goby::moos::transitional::char_array2hex_string (const unsigned char *c, std::string &s, const unsigned int n)
 converts a char (byte) array into a hex string More...
 
bool goby::moos::transitional::hex_string2char_array (unsigned char *c, const std::string &s, const unsigned int n)
 turns a string of hex chars ABCDEF into a character array reading each byte 0xAB,0xCD, 0xEF, etc. More...
 
std::string goby::moos::transitional::long2binary_string (unsigned long l, unsigned short bits)
 return a string represented the binary value of l for bits number of bits which reads MSB -> LSB More...
 
std::string goby::moos::transitional::binary_string2hex_string (const std::string &bs)
 converts a binary string ("1000101010101010") into a hex string ("8AAA") More...
 
std::string goby::moos::transitional::hex_string2binary_string (const std::string &bs)
 converts a hex string ("8AAA") into a binary string ("1000101010101010") More...
 
template<typename T >
bool goby::moos::transitional::hex_string2number (const std::string &s, T &t)
 attempts to convert a hex string into a numerical representation (of type T) More...
 
template<typename T >
bool goby::moos::transitional::number2hex_string (std::string &s, const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string More...
 
template<typename T >
std::string goby::moos::transitional::number2hex_string (const T &t, unsigned int width=2)
 converts a decimal number of type T into a hex string assuming success More...
 

Variables

const unsigned goby::moos::transitional::DCCL_NUM_HEADER_BYTES = 6
 
const unsigned goby::moos::transitional::DCCL_NUM_HEADER_PARTS = 8
 
const std::string goby::moos::transitional::DCCL_HEADER_NAMES []