DataCompressor.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /*
  2. * Copyright (c) 2014, Oculus VR, Inc.
  3. * All rights reserved.
  4. *
  5. * This source code is licensed under the BSD-style license found in the
  6. * LICENSE file in the root directory of this source tree. An additional grant
  7. * of patent rights can be found in the PATENTS file in the same directory.
  8. *
  9. */
  10. /// \file DataCompressor.h
  11. /// \brief DataCompressor does compression on a block of data.
  12. /// \details Not very good compression, but it's small and fast so is something you can use per-message at runtime.
  13. ///
  14. #ifndef __DATA_COMPRESSOR_H
  15. #define __DATA_COMPRESSOR_H
  16. #include "RakMemoryOverride.h"
  17. #include "DS_HuffmanEncodingTree.h"
  18. #include "Export.h"
  19. namespace RakNet
  20. {
  21. /// \brief Does compression on a block of data. Not very good compression, but it's small and fast so is something you can compute at runtime.
  22. class RAK_DLL_EXPORT DataCompressor
  23. {
  24. public:
  25. // GetInstance() and DestroyInstance(instance*)
  26. STATIC_FACTORY_DECLARATIONS(DataCompressor)
  27. static void Compress( unsigned char *userData, unsigned sizeInBytes, RakNet::BitStream * output );
  28. static unsigned DecompressAndAllocate( RakNet::BitStream * input, unsigned char **output );
  29. };
  30. } // namespace RakNet
  31. #endif
粤ICP备19079148号