BitOutputStream.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /*
  2. * Copyright (C) 2007-2018 Siemens AG
  3. *
  4. * This program is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published
  6. * by the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /*******************************************************************
  18. *
  19. * @author Daniel.Peintner.EXT@siemens.com
  20. * @version 2017-03-02
  21. * @contact Richard.Kuntschke@siemens.com
  22. *
  23. * <p>Code generated by EXIdizer</p>
  24. * <p>Schema: V2G_CI_MsgDef.xsd</p>
  25. *
  26. *
  27. ********************************************************************/
  28. /**
  29. * \file BitOutputStream.h
  30. * \brief Bit Output Stream
  31. *
  32. * Write bits and bytes to an underlying output stream.
  33. *
  34. */
  35. #ifndef BIT_OUTPUT_STREAM_H
  36. #define BIT_OUTPUT_STREAM_H
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40. #include <stdint.h>
  41. #include "EXITypes.h"
  42. /**
  43. * \brief Write bits
  44. *
  45. * Write the n least significant bits of parameter b starting
  46. * with the most significant, i.e. from left to right.
  47. *
  48. * \param stream Output Stream
  49. * \param nbits Number of bits
  50. * \param bits value
  51. * \return Error-Code <> 0
  52. *
  53. */
  54. int writeBits(bitstream_t* stream, size_t nbits, uint32_t bits);
  55. /**
  56. * \brief Flush output
  57. *
  58. * If there are some unwritten bits, pad them if necessary and
  59. * write them out. Note that this method does flush the
  60. * underlying stream.
  61. *
  62. * \param stream Output Stream
  63. * \return Error-Code <> 0
  64. *
  65. */
  66. int flush(bitstream_t* stream);
  67. #ifdef __cplusplus
  68. }
  69. #endif
  70. #endif