/* * Copyright (C) 2007-2010 Siemens AG * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see . */ /******************************************************************* * * @author Daniel.Peintner.EXT@siemens.com * @version 0.3 * @contact Joerg.Heuer@siemens.com * ********************************************************************/ #ifdef __cplusplus extern "C" { #endif #include #include "EXITypes.h" #ifndef BIT_ENCODER_CHANNEL_H #define BIT_ENCODER_CHANNEL_H /** * Encode a single boolean value. A false value is encoded as bit 0 and true * value is encode as bit 1. */ int encodeBoolean(bitstream_t* stream, int b); /** * Encode n-bit unsigned integer. The n least significant bits of parameter * b starting with the most significant, i.e. from left to right. */ int encodeNBitUnsignedInteger(bitstream_t* stream, size_t nbits, uint8_t val); /** * Encode an arbitrary precision non negative integer using a sequence of * octets. The most significant bit of the last octet is set to zero to * indicate sequence termination. Only seven bits per octet are used to * store the integer's value. */ int encodeUnsignedInteger32(bitstream_t* stream, uint32_t n); /** * Encode an arbitrary precision non negative integer using a sequence of * octets. The most significant bit of the last octet is set to zero to * indicate sequence termination. Only seven bits per octet are used to * store the integer's value. */ int encodeUnsignedInteger64(bitstream_t* stream, uint64_t n); /** * Encode an arbitrary precision integer using a sign bit followed by a * sequence of octets. The most significant bit of the last octet is set to * zero to indicate sequence termination. Only seven bits per octet are used * to store the integer's value. */ int encodeInteger32(bitstream_t* stream, int32_t n); /** * Encode an arbitrary precision integer using a sign bit followed by a * sequence of octets. The most significant bit of the last octet is set to * zero to indicate sequence termination. Only seven bits per octet are used * to store the integer's value. */ int encodeInteger64(bitstream_t* stream, int64_t n); /** * Encode a Float datatype as two consecutive Integers. * The first Integer represents the mantissa of the floating point * number and the second Integer represents the base-10 exponent * of the floating point number. */ int encodeFloat(bitstream_t* stream, float_me_t* f); /** * Encode a length prefixed sequence of characters. */ int encodeString(bitstream_t* stream, string_ucs_t* string); /** * Encode a length prefixed sequence of characters in the sense of string tables */ int encodeStringValue(bitstream_t* stream, string_ucs_t* string); /** * Encode a sequence of characters according to a given length. * Each character is represented by its UCS [ISO/IEC 10646] * code point encoded as an Unsigned Integer */ int encodeCharacters(bitstream_t* stream, uint32_t* chars, size_t len); /** * Encode a binary value as a length-prefixed sequence of octets. */ int encodeBinary(bitstream_t* stream, bytes_t* bytes); /** * Flush underlying bit output stream */ int encodeFinish(bitstream_t* stream); #endif #ifdef __cplusplus } #endif