FileListNodeContext.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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 FileListNodeContext.h
  11. ///
  12. #ifndef __FILE_LIST_NODE_CONTEXT_H
  13. #define __FILE_LIST_NODE_CONTEXT_H
  14. #include "BitStream.h"
  15. struct FileListNodeContext
  16. {
  17. FileListNodeContext() {dataPtr=0; dataLength=0;}
  18. FileListNodeContext(unsigned char o, uint32_t f1, uint32_t f2, uint32_t f3) : op(o), flnc_extraData1(f1), flnc_extraData2(f2), flnc_extraData3(f3) {dataPtr=0; dataLength=0;}
  19. ~FileListNodeContext() {}
  20. unsigned char op;
  21. uint32_t flnc_extraData1;
  22. uint32_t flnc_extraData2;
  23. uint32_t flnc_extraData3;
  24. void *dataPtr;
  25. unsigned int dataLength;
  26. };
  27. inline RakNet::BitStream& operator<<(RakNet::BitStream& out, FileListNodeContext& in)
  28. {
  29. out.Write(in.op);
  30. out.Write(in.flnc_extraData1);
  31. out.Write(in.flnc_extraData2);
  32. out.Write(in.flnc_extraData3);
  33. return out;
  34. }
  35. inline RakNet::BitStream& operator>>(RakNet::BitStream& in, FileListNodeContext& out)
  36. {
  37. in.Read(out.op);
  38. bool success = in.Read(out.flnc_extraData1);
  39. (void) success;
  40. assert(success);
  41. success = in.Read(out.flnc_extraData2);
  42. (void) success;
  43. assert(success);
  44. success = in.Read(out.flnc_extraData3);
  45. (void) success;
  46. assert(success);
  47. return in;
  48. }
  49. #endif
粤ICP备19079148号