#include <audio_codec.h>
Public 型 | |
enum | BitMask { MASK_1 = 0x00000001, MASK_2 = 0x00000003, MASK_3 = 0x00000007, MASK_4 = 0x0000000F, MASK_5 = 0x0000001F, MASK_6 = 0x0000003F, MASK_7 = 0x0000007F, MASK_8 = 0x000000FF, MASK_9 = 0x000001FF, MASK_10 = 0x000003FF, MASK_11 = 0x000007FF, MASK_12 = 0x00000FFF, MASK_13 = 0x00001FFF, MASK_14 = 0x00003FFF, MASK_15 = 0x00007FFF, MASK_16 = 0x0000FFFF, MASK_17 = 0x0001FFFF, MASK_18 = 0x0003FFFF, MASK_19 = 0x0007FFFF, MASK_20 = 0x000FFFFF, MASK_21 = 0x001FFFFF, MASK_22 = 0x003FFFFF, MASK_23 = 0x007FFFFF, MASK_24 = 0x00FFFFFF, MASK_25 = 0x01FFFFFF, MASK_26 = 0x03FFFFFF, MASK_27 = 0x07FFFFFF, MASK_28 = 0x0FFFFFFF, MASK_29 = 0x1FFFFFFF, MASK_30 = 0x3FFFFFFF, MASK_31 = 0x7FFFFFFF, MASK_32 = 0xFFFFFFFF } |
typedef std::map< char, int > | CharToIntCont |
typedef std::vector< char > | IntToCharCont |
Public メソッド | |
const CharToIntCont & | charToIntMap () const |
get character to interger map object | |
const IntToCharCont & | intToCharMap () const |
get integer to character map object | |
bool | encodeInt64ToStr (const boost::int64_t &ival, const int len, std::string &to) const |
encode decimal (64bit) integer to the encoded string. | |
bool | decodeStrToInt64 (const std::string &from, boost::int64_t *to) const |
decode the message string to the decimal (64bit) integer | |
char | encodePercentageToChar (const double &value) const |
encode % value to 1 character | |
double | decodeCharToPercentage (const char ch) const |
decode 1 character to the real number [0,1] | |
bool | encodePosVelToStr5 (const Vector2D &pos, const Vector2D &vel, std::string &to) const |
encode position and velocity to 5 characters. | |
bool | decodeStr5ToPosVel (const std::string &from, Vector2D *pos, Vector2D *vel) const |
decode 5 characters to position and velocity | |
bool | encodePosToStr3 (const Vector2D &pos, std::string &to) const |
encode position to 3 characters. | |
bool | decodeStr3ToPos (const std::string &from, Vector2D *pos) const |
decode 3 characters to and position | |
bool | encodeUnumPosToStr4 (const int unum, const Vector2D &pos, std::string &to) const |
encode uniform number and position to 4 characters. | |
bool | decodeStr4ToUnumPos (const std::string &from, int *unum, Vector2D *pos) const |
decode 4 characters to uniform number and position | |
std::string | encodeCoordToStr2 (const double &xy, const double &norm_factor) const |
encode coordinate value( x or y ) to 2 characters. | |
double | decodeStr2ToCoord (const char ch1, const char ch2, const double &norm_factor) const |
decode 2 characters to coordinate value( x or y ) | |
std::string | encodePosToStr4 (const Vector2D &pos) const |
encode position value to 4 characters with 0.1 step | |
Vector2D | decodeStr4ToPos (const std::string &from) const |
decode 4 characters to position value | |
char | encodeSpeedToChar (const double &xy) const |
encode speed value to 1 character. | |
double | decodeCharToSpeed (const char ch) const |
decode 1 character to speed value | |
Static Public メソッド | |
static const AudioCodec & | i () |
singleton interface | |
static char | unum2hex (const int unum) |
convert decimal uniform number to hex number | |
static int | hex2unum (const char hex) |
convert hex number character to decimal uniform number. | |
Static Public 変数 | |
static const double | ERROR_VALUE |
constant error value (= std::numeric_limits< double >::max()) | |
static const double | X_NORM_FACTOR |
x normalize factor (field length) to limit inputed x | |
static const double | Y_NORM_FACTOR |
y normalze factor (field width) to limit inputed y | |
static const double | SPEED_NORM_FACTOR |
speed normalize factor to limit inputed speed range | |
static const double | COORD_STEP_L2 |
used by encodeCoordToStr2/decodeStr2ToCoord | |
static const double | SPEED_STEP_L1 |
used by encodeSpeedToChar/decodeCharToSpeed | |
static const std::string | CHAR_SET |
available character set | |
static const int | CHAR_SIZE |
size of CHAR_SET |
const AudioCodec & rcsc::AudioCodec::i | ( | ) | [static] |
singleton interface
const CharToIntCont& rcsc::AudioCodec::charToIntMap | ( | ) | const [inline] |
get character to interger map object
const IntToCharCont& rcsc::AudioCodec::intToCharMap | ( | ) | const [inline] |
get integer to character map object
bool rcsc::AudioCodec::encodeInt64ToStr | ( | const boost::int64_t & | ival, | |
const int | len, | |||
std::string & | to | |||
) | const |
encode decimal (64bit) integer to the encoded string.
ival | input value | |
len | desired string length | |
to | reference to the result instance |
bool rcsc::AudioCodec::decodeStrToInt64 | ( | const std::string & | from, | |
boost::int64_t * | to | |||
) | const |
decode the message string to the decimal (64bit) integer
from | input message string | |
to | pointer to the result instance |
char rcsc::AudioCodec::encodePercentageToChar | ( | const double & | value | ) | const |
encode % value to 1 character
value | real number [0,1] |
double rcsc::AudioCodec::decodeCharToPercentage | ( | const char | ch | ) | const |
decode 1 character to the real number [0,1]
ch | character to be decoded |
bool rcsc::AudioCodec::encodePosVelToStr5 | ( | const Vector2D & | pos, | |
const Vector2D & | vel, | |||
std::string & | to | |||
) | const |
encode position and velocity to 5 characters.
pos | position value to be encoded | |
vel | velocity value to be encoded | |
to | reference to the result variable |
bool rcsc::AudioCodec::decodeStr5ToPosVel | ( | const std::string & | from, | |
Vector2D * | pos, | |||
Vector2D * | vel | |||
) | const |
decode 5 characters to position and velocity
from | string to be decoded | |
pos | variable pointer to store the decoded position value | |
vel | variable pointer to store the decoded velocity value |
bool rcsc::AudioCodec::encodePosToStr3 | ( | const Vector2D & | pos, | |
std::string & | to | |||
) | const |
encode position to 3 characters.
pos | position value to be encoded | |
to | reference to the result variable |
bool rcsc::AudioCodec::decodeStr3ToPos | ( | const std::string & | from, | |
Vector2D * | pos | |||
) | const |
decode 3 characters to and position
from | string to be decoded | |
pos | pointer to the result variable |
bool rcsc::AudioCodec::encodeUnumPosToStr4 | ( | const int | unum, | |
const Vector2D & | pos, | |||
std::string & | to | |||
) | const |
encode uniform number and position to 4 characters.
unum | uniform number | |
pos | position value to be encoded | |
to | reference to the result variable |
bool rcsc::AudioCodec::decodeStr4ToUnumPos | ( | const std::string & | from, | |
int * | unum, | |||
Vector2D * | pos | |||
) | const |
decode 4 characters to uniform number and position
from | string to be decoded | |
unum | pointer to the result variable | |
pos | pointer to the result variable |
std::string rcsc::AudioCodec::encodeCoordToStr2 | ( | const double & | xy, | |
const double & | norm_factor | |||
) | const |
encode coordinate value( x or y ) to 2 characters.
xy | coordinate value to be encoded, X or Y. This value should be within [-norm_factor, norm_factor] | |
norm_factor | normalize factor for xy |
norm_factor must be same as the value used by decodeCoordL2() norm_factor will be changed depending on the type of target coordinate value, i.e. field length or field width.
double rcsc::AudioCodec::decodeStr2ToCoord | ( | const char | ch1, | |
const char | ch2, | |||
const double & | norm_factor | |||
) | const |
decode 2 characters to coordinate value( x or y )
ch1 | first character to be decoded | |
ch2 | second character to be decoded | |
norm_factor | normalize factor for coordinate value |
std::string rcsc::AudioCodec::encodePosToStr4 | ( | const Vector2D & | pos | ) | const |
encode position value to 4 characters with 0.1 step
pos | position value to be encoded |
Vector2D rcsc::AudioCodec::decodeStr4ToPos | ( | const std::string & | from | ) | const |
decode 4 characters to position value
from | message string to be decoded |
char rcsc::AudioCodec::encodeSpeedToChar | ( | const double & | xy | ) | const |
encode speed value to 1 character.
xy | velocity element to be encoded, X or Y |
double rcsc::AudioCodec::decodeCharToSpeed | ( | const char | ch | ) | const |
decode 1 character to speed value
ch | character to be decoded |
char rcsc::AudioCodec::unum2hex | ( | const int | unum | ) | [static] |
convert decimal uniform number to hex number
unum | decimal uniform number, that must be within [1, 11] |
int rcsc::AudioCodec::hex2unum | ( | const char | hex | ) | [static] |
convert hex number character to decimal uniform number.
hex | hex number character, that must be within [0, B], case sensitive! |