gefiler.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. //
  2. //////////////////////////////////////////////////////////////////////////////
  3. //
  4. // Copyright 2015 Autodesk, Inc. All rights reserved.
  5. //
  6. // Use of this software is subject to the terms of the Autodesk license
  7. // agreement provided at the time of installation or download, or which
  8. // otherwise accompanies this software in either electronic or hard copy form.
  9. //
  10. //////////////////////////////////////////////////////////////////////////////
  11. //
  12. // Description:
  13. //
  14. // This file implements the class AcGeFiler, which defines the
  15. // abstract interface for serialization requirements of ge entities.
  16. // An application that requires input/output of the definition of
  17. // ge entities in a format defined by the application should provide
  18. // an implementation of this class. An instance of this class is
  19. // provided as an argument to the entity serialization functions,
  20. // thus allowing the input/output format to be controlled by the
  21. // client of gelib. An example of usage would be as follows.
  22. //
  23. // AcRfDwgFiler format;
  24. // AcGeVersion dbVersion;
  25. // AcGeLine3d newLine;
  26. // if (acmeGetGelibImageVersion(entity, dbVersion) == AcMe::eOk)
  27. // {
  28. // AcGeDwgIO::read(format, dbVersion, newLine)
  29. // AcGeDwgIO::write(format, newLine)
  30. // }
  31. //
  32. #ifndef AC_GEFILER_H
  33. #define AC_GEFILER_H
  34. #include "AdAChar.h"
  35. #include "AcString.h"
  36. #include "gegbl.h"
  37. #include "acdb.h"
  38. #pragma pack (push, 8)
  39. class AcDbDwgFiler;
  40. class
  41. GE_DLLEXPIMPORT ADESK_NO_VTABLE
  42. AcGeFiler
  43. {
  44. protected:
  45. AcGeFiler();
  46. public:
  47. // Read/write functions.
  48. //
  49. virtual
  50. Acad::ErrorStatus readBoolean(Adesk::Boolean*) = 0;
  51. virtual
  52. Acad::ErrorStatus writeBoolean(Adesk::Boolean) = 0;
  53. virtual
  54. Acad::ErrorStatus readBool(bool*) = 0;
  55. virtual
  56. Acad::ErrorStatus writeBool(bool) = 0;
  57. virtual
  58. Acad::ErrorStatus readSignedByte(char *) = 0;
  59. virtual
  60. Acad::ErrorStatus writeSignedByte(char) = 0;
  61. virtual
  62. Acad::ErrorStatus readString(AcString &) = 0;
  63. virtual
  64. Acad::ErrorStatus writeString(const AcString &) = 0;
  65. virtual
  66. Acad::ErrorStatus readShort(short*) = 0;
  67. virtual
  68. Acad::ErrorStatus writeShort(short) = 0;
  69. virtual
  70. Acad::ErrorStatus readLong(Adesk::Int32*) = 0;
  71. virtual
  72. Acad::ErrorStatus writeLong(Adesk::Int32) = 0;
  73. // Unicode: this is assumed to be a binary value, not a text character!
  74. virtual
  75. Acad::ErrorStatus readUChar(unsigned char*) = 0;
  76. virtual
  77. Acad::ErrorStatus writeUChar(unsigned char) = 0;
  78. virtual
  79. Acad::ErrorStatus readUShort(unsigned short*) = 0;
  80. virtual
  81. Acad::ErrorStatus writeUShort(unsigned short) = 0;
  82. virtual
  83. Acad::ErrorStatus readULong(Adesk::UInt32*) = 0;
  84. virtual
  85. Acad::ErrorStatus writeULong(Adesk::UInt32) = 0;
  86. virtual
  87. Acad::ErrorStatus readDouble(double*) = 0;
  88. virtual
  89. Acad::ErrorStatus writeDouble(double) = 0;
  90. virtual
  91. Acad::ErrorStatus readPoint2d(AcGePoint2d*) = 0;
  92. virtual
  93. Acad::ErrorStatus writePoint2d(const AcGePoint2d&) = 0;
  94. virtual
  95. Acad::ErrorStatus readPoint3d(AcGePoint3d*) = 0;
  96. virtual
  97. Acad::ErrorStatus writePoint3d(const AcGePoint3d&) = 0;
  98. virtual
  99. Acad::ErrorStatus readVector2d(AcGeVector2d*) = 0;
  100. virtual
  101. Acad::ErrorStatus writeVector2d(const AcGeVector2d&) = 0;
  102. virtual
  103. Acad::ErrorStatus readVector3d(AcGeVector3d*) = 0;
  104. virtual
  105. Acad::ErrorStatus writeVector3d(const AcGeVector3d&) = 0;
  106. // This method must be implemented in order to read/write
  107. // external curves and surfaces (and nurb surfaces).
  108. virtual
  109. AcDbDwgFiler* dwgFiler();
  110. virtual
  111. Acad::ErrorStatus readBytes(void*, Adesk::UInt32) = 0;
  112. virtual
  113. Acad::ErrorStatus writeBytes(const void*, Adesk::UInt32) = 0;
  114. };
  115. inline
  116. AcDbDwgFiler* AcGeFiler::dwgFiler()
  117. {
  118. return NULL;
  119. }
  120. #pragma pack (pop)
  121. #endif