1 // Created on: 1992-05-14
2 // Created by: NW,JPB,CAL
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and / or modify it
9 // under the terms of the GNU Lesser General Public version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
19 //-Design Declaration des variables specifiques aux identificateurs
21 //-Warning Un identificateur est un entier.
30 #include <Aspect_GenId.ixx>
34 //-Global data definitions
42 Aspect_GenId::Aspect_GenId ():
44 MyCount (INT_MAX/2 + 1),
45 MyLength (INT_MAX/2 + 1),
47 MyUpperBound (INT_MAX/2),
52 Aspect_GenId::Aspect_GenId (const Standard_Integer Low, const Standard_Integer Up):MyFreeIds () {
57 MyLength = MyUpperBound - MyLowerBound + 1;
61 Aspect_IdentDefinitionError::Raise
62 ("GenId Create Error: Low > Up");
66 Standard_Integer Aspect_GenId::Available () const {
72 void Aspect_GenId::Free () {
79 void Aspect_GenId::Free (const Standard_Integer Id) {
81 if ( (Id >= MyLowerBound) && (Id <= MyUpperBound) )
82 MyFreeIds.Prepend (Id);
86 Standard_Integer Aspect_GenId::Lower () const {
88 return (MyLowerBound);
92 Standard_Integer Aspect_GenId::Next () {
95 Aspect_IdentDefinitionError::Raise
96 ("GenId Next Error: Available == 0");
100 if (! MyFreeIds.IsEmpty ()) {
101 Id = MyFreeIds.First ();
102 MyFreeIds.RemoveFirst ();
106 Id = MyLowerBound + MyLength - MyCount - 1;
113 Standard_Integer Aspect_GenId::Upper () const {
115 return (MyUpperBound);
119 //void Aspect_GenId::Assign (const Aspect_GenId& Other) {
121 // MyLowerBound = Other.Lower ();
122 // MyUpperBound = Other.Upper ();