oid_list.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * $XConsortium: oid_list.h /main/5 1996/07/18 14:43:51 drk $
  25. *
  26. * Copyright (c) 1993 HAL Computer Systems International, Ltd.
  27. * All rights reserved. Unpublished -- rights reserved under
  28. * the Copyright Laws of the United States. USE OF A COPYRIGHT
  29. * NOTICE IS PRECAUTIONARY ONLY AND DOES NOT IMPLY PUBLICATION
  30. * OR DISCLOSURE.
  31. *
  32. * THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE
  33. * SECRETS OF HAL COMPUTER SYSTEMS INTERNATIONAL, LTD. USE,
  34. * DISCLOSURE, OR REPRODUCTION IS PROHIBITED WITHOUT THE
  35. * PRIOR EXPRESS WRITTEN PERMISSION OF HAL COMPUTER SYSTEMS
  36. * INTERNATIONAL, LTD.
  37. *
  38. * RESTRICTED RIGHTS LEGEND
  39. * Use, duplication, or disclosure by the Government is subject
  40. * to the restrictions as set forth in subparagraph (c)(l)(ii)
  41. * of the Rights in Technical Data and Computer Software clause
  42. * at DFARS 252.227-7013.
  43. *
  44. * HAL COMPUTER SYSTEMS INTERNATIONAL, LTD.
  45. * 1315 Dell Avenue
  46. * Campbell, CA 95008
  47. *
  48. */
  49. #ifndef _oid_list_h
  50. #define _oid_list_h 1
  51. #include "utility/ostring.h"
  52. #include "dstr/dlist.h"
  53. #include "dstr/dlist_void_ptr_cell.h"
  54. #include "object/oid.h"
  55. #include "object/composite.h"
  56. #include "storage/page_storage.h"
  57. #include "storage/chunks_index.h"
  58. /***************************************
  59. * Primitive string class.
  60. ****************************************/
  61. class oid_list: public composite
  62. {
  63. protected:
  64. Boolean f_internal_index;
  65. chunks_index* chk_index;
  66. union {
  67. mmdb_pos_t loc;
  68. ostring* p;
  69. } list_ptr;
  70. protected:
  71. // init the list (memory resident) with sz dummy oid_ts
  72. void init_data_member(int sz);
  73. public:
  74. void init_persistent_info(persistent_info* x);
  75. oid_list(oid_list&);
  76. oid_list(c_code_t = OID_LIST_CODE);
  77. oid_list(int num_oids, c_code_t);
  78. virtual ~oid_list();
  79. // expand the list to include extra x oids.
  80. // handle both the memory and disk list.
  81. Boolean expand_space(int x);
  82. void build_internal_index(); // set up an index on the list
  83. void reqest_build_internal_index();
  84. // request building an internal
  85. // index in the operator()
  86. MMDB_SIGNATURES(oid_list);
  87. virtual oid_t operator()(int);
  88. // insert a component
  89. virtual Boolean insert_component(const oid_t&);
  90. // update a component
  91. virtual Boolean update_component(int index, const oid_t&);
  92. // remove a component
  93. virtual Boolean remove_component(const oid_t&);
  94. // print function
  95. virtual io_status asciiOut(ostream&) ;
  96. virtual io_status asciiIn(istream&) ;
  97. // compacted disk representation In and Out functions
  98. virtual int cdr_sizeof();
  99. virtual io_status cdrOut(buffer&);
  100. virtual io_status cdrIn(buffer&);
  101. friend class oid_list_handler;
  102. };
  103. typedef oid_list* oid_listPtr;
  104. /*
  105. #endif
  106. #ifndef _oid_list_handler_h
  107. #define _oid_list_handler_h 1
  108. */
  109. class oid_list_handler : public handler
  110. {
  111. public:
  112. oid_list_handler(int num_oids, storagePtr = 0);
  113. oid_list_handler(const oid_t&, storagePtr = 0);
  114. virtual ~oid_list_handler();
  115. oid_list* operator ->();
  116. };
  117. #endif