Clone of mesa.
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

bin.h 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. /*
  2. * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
  3. * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice including the dates of first publication and
  13. * either this permission notice or a reference to
  14. * http://oss.sgi.com/projects/FreeB/
  15. * shall be included in all copies or substantial portions of the Software.
  16. *
  17. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
  18. * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  20. * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  21. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
  22. * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  23. * SOFTWARE.
  24. *
  25. * Except as contained in this notice, the name of Silicon Graphics, Inc.
  26. * shall not be used in advertising or otherwise to promote the sale, use or
  27. * other dealings in this Software without prior written authorization from
  28. * Silicon Graphics, Inc.
  29. */
  30. /*
  31. * bin.h
  32. *
  33. */
  34. #ifndef __glubin_h_
  35. #define __glubin_h_
  36. #include "myassert.h"
  37. #include "arc.h"
  38. #include "defines.h"
  39. class Bin
  40. { /* a linked list of jordan arcs */
  41. private:
  42. Arc_ptr head;/*first arc on list */
  43. Arc_ptr current; /* current arc on list */
  44. public:
  45. Bin();
  46. ~Bin();
  47. inline Arc_ptr firstarc( void );
  48. inline Arc_ptr nextarc( void );
  49. inline Arc_ptr removearc( void );
  50. inline int isnonempty( void ) { return (head ? 1 : 0); }
  51. inline void addarc( Arc_ptr );
  52. void remove_this_arc( Arc_ptr );
  53. int numarcs( void );
  54. void adopt( void );
  55. void markall( void );
  56. void show( const char * );
  57. void listBezier( void );
  58. };
  59. /*----------------------------------------------------------------------------
  60. * Bin::addarc - add an Arc_ptr to head of linked list of Arc_ptr
  61. *----------------------------------------------------------------------------
  62. */
  63. inline void
  64. Bin::addarc( Arc_ptr jarc )
  65. {
  66. jarc->link = head;
  67. head = jarc;
  68. }
  69. /*----------------------------------------------------------------------------
  70. * Bin::removearc - remove first Arc_ptr from bin
  71. *----------------------------------------------------------------------------
  72. */
  73. inline Arc_ptr
  74. Bin::removearc( void )
  75. {
  76. Arc_ptr jarc = head;
  77. if( jarc ) head = jarc->link;
  78. return jarc;
  79. }
  80. /*----------------------------------------------------------------------------
  81. * BinIter::nextarc - return current arc in bin and advance pointer to next arc
  82. *----------------------------------------------------------------------------
  83. */
  84. inline Arc_ptr
  85. Bin::nextarc( void )
  86. {
  87. Arc_ptr jarc = current;
  88. #ifdef DEBUG
  89. assert( jarc->check() != 0 );
  90. #endif
  91. if( jarc ) current = jarc->link;
  92. return jarc;
  93. }
  94. /*----------------------------------------------------------------------------
  95. * BinIter::firstarc - set current arc to first arc of bin advance to next arc
  96. *----------------------------------------------------------------------------
  97. */
  98. inline Arc_ptr
  99. Bin::firstarc( void )
  100. {
  101. current = head;
  102. return nextarc( );
  103. }
  104. #endif /* __glubin_h_ */