dl_list_cell.C 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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: dl_list_cell.cc /main/4 1996/06/11 17:24:22 cde-hal $
  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. #include "object/dl_list_cell.h"
  50. dl_list_cell::dl_list_cell(c_code_t c_id) : composite(c_id)
  51. {
  52. v_forward_ptr.become(ground);
  53. v_backward_ptr.become(ground);
  54. }
  55. dl_list_cell::dl_list_cell(const dl_list_cell& x) :
  56. composite(x),
  57. v_backward_ptr(x.v_backward_ptr),
  58. v_forward_ptr(x.v_forward_ptr)
  59. {
  60. }
  61. dl_list_cell::~dl_list_cell()
  62. {
  63. }
  64. void dl_list_cell::set_backward_ptr(const oid_t& x)
  65. {
  66. v_backward_ptr.become(x);
  67. set_mode(UPDATE, true);
  68. }
  69. void dl_list_cell::set_forward_ptr(const oid_t& x)
  70. {
  71. v_forward_ptr.become(x);
  72. set_mode(UPDATE, true);
  73. }
  74. oid_t& dl_list_cell::get_backward_ptr()
  75. {
  76. return v_backward_ptr;
  77. }
  78. oid_t& dl_list_cell::get_forward_ptr()
  79. {
  80. return v_forward_ptr;
  81. }
  82. /*
  83. boolean dl_list_cell::value_LS(root& x, boolean safe) const
  84. {
  85. if ( safe == true &&
  86. ( f_oid.ccode() != DL_LIST_CELL_CODE ||
  87. x.my_oid().ccode() != DL_LIST_CELL_CODE
  88. )
  89. )
  90. return false;
  91. dl_list_cell &y = *(dl_list_cell*)&x;
  92. if ( v_backward_ptr.ls(y.v_backward_ptr) == true ||
  93. ( v_backward_ptr.eq(y.v_backward_ptr) == true &&
  94. v_forward_ptr.ls(y.v_forward_ptr) == true
  95. )
  96. )
  97. return true;
  98. else
  99. return false;
  100. }
  101. boolean dl_list_cell::value_EQ(root& x, boolean safe) const
  102. {
  103. if ( safe == true &&
  104. ( f_oid.ccode() != DL_LIST_CELL_CODE ||
  105. x.my_oid().ccode() != DL_LIST_CELL_CODE
  106. )
  107. )
  108. return false;
  109. dl_list_cell &y = *(dl_list_cell*)&x;
  110. if ( v_backward_ptr.eq(y.v_backward_ptr) == true )
  111. return true;
  112. else
  113. return false;
  114. }
  115. */
  116. io_status dl_list_cell::asciiOut(ostream& out)
  117. {
  118. out << "OID_T:\n";
  119. my_oid().asciiOut(out);
  120. out << "\n";
  121. v_backward_ptr.asciiOut(out);
  122. out << "\n";
  123. v_forward_ptr.asciiOut(out);
  124. return done;
  125. }
  126. io_status dl_list_cell::asciiIn(istream& in)
  127. {
  128. v_backward_ptr.asciiIn(in);
  129. v_forward_ptr.asciiIn(in);
  130. set_mode(UPDATE, true);
  131. return done;
  132. }
  133. int dl_list_cell::cdr_sizeof()
  134. {
  135. return composite::cdr_sizeof() + v_backward_ptr.cdr_sizeof() +
  136. v_forward_ptr.cdr_sizeof();
  137. }
  138. io_status dl_list_cell::cdrOut(buffer& buf)
  139. {
  140. composite::cdrOut(buf);
  141. v_backward_ptr.cdrOut(buf);
  142. v_forward_ptr.cdrOut(buf);
  143. return done;
  144. }
  145. io_status dl_list_cell::cdrIn(buffer& buf)
  146. {
  147. composite::cdrIn(buf);
  148. v_backward_ptr.cdrIn(buf);
  149. v_forward_ptr.cdrIn(buf);
  150. return done;
  151. }
  152. MMDB_BODIES(dl_list_cell)
  153. HANDLER_BODIES(dl_list_cell)