Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

types.h 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
  2. *
  3. * This is free software; you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation; either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This software is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this software; if not, write to the Free Software
  15. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
  16. * USA.
  17. */
  18. #ifndef __RDR_TYPES_H__
  19. #define __RDR_TYPES_H__
  20. #include <stdint.h>
  21. namespace rdr {
  22. class U8Array {
  23. public:
  24. U8Array() : buf(0) {}
  25. U8Array(uint8_t* a) : buf(a) {} // note: assumes ownership
  26. U8Array(int len) : buf(new uint8_t[len]) {}
  27. ~U8Array() { delete [] buf; }
  28. // Get the buffer pointer & clear it (i.e. caller takes ownership)
  29. uint8_t* takeBuf() { uint8_t* tmp = buf; buf = 0; return tmp; }
  30. uint8_t* buf;
  31. };
  32. class U16Array {
  33. public:
  34. U16Array() : buf(0) {}
  35. U16Array(uint16_t* a) : buf(a) {} // note: assumes ownership
  36. U16Array(int len) : buf(new uint16_t[len]) {}
  37. ~U16Array() { delete [] buf; }
  38. uint16_t* takeBuf() { uint16_t* tmp = buf; buf = 0; return tmp; }
  39. uint16_t* buf;
  40. };
  41. class U32Array {
  42. public:
  43. U32Array() : buf(0) {}
  44. U32Array(uint32_t* a) : buf(a) {} // note: assumes ownership
  45. U32Array(int len) : buf(new uint32_t[len]) {}
  46. ~U32Array() { delete [] buf; }
  47. uint32_t* takeBuf() { uint32_t* tmp = buf; buf = 0; return tmp; }
  48. uint32_t* buf;
  49. };
  50. class S32Array {
  51. public:
  52. S32Array() : buf(0) {}
  53. S32Array(int32_t* a) : buf(a) {} // note: assumes ownership
  54. S32Array(int len) : buf(new int32_t[len]) {}
  55. ~S32Array() { delete [] buf; }
  56. int32_t* takeBuf() { int32_t* tmp = buf; buf = 0; return tmp; }
  57. int32_t* buf;
  58. };
  59. } // end of namespace rdr
  60. #endif