part.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. Copyright (c) 2010, Florian Reuter
  3. All rights reserved.
  4. Redistribution and use in source and binary forms, with or without
  5. modification, are permitted provided that the following conditions
  6. are met:
  7. * Redistributions of source code must retain the above copyright
  8. notice, this list of conditions and the following disclaimer.
  9. * Redistributions in binary form must reproduce the above copyright
  10. notice, this list of conditions and the following disclaimer in
  11. the documentation and/or other materials provided with the
  12. distribution.
  13. * Neither the name of Florian Reuter nor the names of its contributors
  14. may be used to endorse or promote products derived from this
  15. software without specific prior written permission.
  16. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  17. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  18. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  19. FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  20. COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  21. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  22. BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  23. LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  24. CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
  25. STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  26. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
  27. OF THE POSSIBILITY OF SUCH DAMAGE.
  28. */
  29. /** @file opc/part.h
  30. */
  31. #include <opc/config.h>
  32. #ifndef OPC_PART_H
  33. #define OPC_PART_H
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif
  37. /**
  38. Handle to an OPC part created by \ref opcPartOpen.
  39. \see opcPartOpen.
  40. */
  41. typedef xmlChar* opcPart;
  42. /**
  43. Represents an invalid (resp. NULL) part.
  44. In releations OPC_PART_INVALID also represents the root part.
  45. \hideinitializer
  46. */
  47. #define OPC_PART_INVALID NULL
  48. /**
  49. Find a part in a \ container by \c absolutePath and/or \c type.
  50. Currently no flags are supported.
  51. */
  52. opcPart opcPartFind(opcContainer *container,
  53. const xmlChar *absolutePath,
  54. const xmlChar *type,
  55. int flags);
  56. /**
  57. Creates a part in a \ container with \c absolutePath and \c type.
  58. Currently no flags are supported.
  59. */
  60. opcPart opcPartCreate(opcContainer *container,
  61. const xmlChar *absolutePath,
  62. const xmlChar *type,
  63. int flags);
  64. /**
  65. Returns the type of the container.
  66. The string is interned and must not be freed.
  67. */
  68. const xmlChar *opcPartGetType(opcContainer *c, opcPart part);
  69. /**
  70. Returns the type of the container.
  71. If \c override_only then the return value will be NULL for parts not having an override type.
  72. The string is interned and must not be freed.
  73. */
  74. const xmlChar *opcPartGetTypeEx(opcContainer *c, opcPart part, opc_bool_t override_only);
  75. /**
  76. Deleted that part \c absolutePath in the \c container.
  77. */
  78. opc_error_t opcPartDelete(opcContainer *container, const xmlChar *absolutePath);
  79. /**
  80. Get the first part.
  81. \code
  82. for(opcPart part=opcPartGetFirst(c);OPC_PART_INVALID!=part;part=opcPartGetNext(c, part)) {
  83. printf("%s; \n", part, opcPartGetType(c, part));
  84. }
  85. \endcode
  86. */
  87. opcPart opcPartGetFirst(opcContainer *container);
  88. /**
  89. Get the next part.
  90. \see opcPartGetFirst
  91. */
  92. opcPart opcPartGetNext(opcContainer *container, opcPart part);
  93. /**
  94. Returns the size in bytes of the \c part.
  95. */
  96. opc_ofs_t opcPartGetSize(opcContainer *c, opcPart part);
  97. #ifdef __cplusplus
  98. } /* extern "C" */
  99. #endif
  100. #endif /* OPC_PART_H */