1 // Created on: 1992-05-14
2 // Created by: NW,JPB,CAL
3 // Copyright (c) 1992-1999 Matra Datavision
4 // Copyright (c) 1999-2012 OPEN CASCADE SAS
6 // The content of this file is subject to the Open CASCADE Technology Public
7 // License Version 6.5 (the "License"). You may not use the content of this file
8 // except in compliance with the License. Please obtain a copy of the License
9 // at http://www.opencascade.org and read it completely before using this file.
11 // The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 // main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 // The Original Code and all software distributed under the License is
15 // distributed on an "AS IS" basis, without warranty of any kind, and the
16 // Initial Developer hereby disclaims all such warranties, including without
17 // limitation, any warranties of merchantability, fitness for a particular
18 // purpose or non-infringement. Please see the License for the specific terms
19 // and conditions governing the rights and limitations under the License.
26 //-Design Declaration des variables specifiques aux identificateurs
28 //-Warning Un identificateur est un entier.
37 #include <Aspect_GenId.ixx>
41 //-Global data definitions
49 Aspect_GenId::Aspect_GenId ():
51 MyCount (INT_MAX/2 + 1),
52 MyLength (INT_MAX/2 + 1),
54 MyUpperBound (INT_MAX/2),
59 Aspect_GenId::Aspect_GenId (const Standard_Integer Low, const Standard_Integer Up):MyFreeIds () {
64 MyLength = MyUpperBound - MyLowerBound + 1;
68 Aspect_IdentDefinitionError::Raise
69 ("GenId Create Error: Low > Up");
73 Standard_Integer Aspect_GenId::Available () const {
79 void Aspect_GenId::Free () {
86 void Aspect_GenId::Free (const Standard_Integer Id) {
88 if ( (Id >= MyLowerBound) && (Id <= MyUpperBound) )
89 MyFreeIds.Prepend (Id);
93 Standard_Integer Aspect_GenId::Lower () const {
95 return (MyLowerBound);
99 Standard_Integer Aspect_GenId::Next () {
102 Aspect_IdentDefinitionError::Raise
103 ("GenId Next Error: Available == 0");
107 if (! MyFreeIds.IsEmpty ()) {
108 Id = MyFreeIds.First ();
109 MyFreeIds.RemoveFirst ();
113 Id = MyLowerBound + MyLength - MyCount - 1;
120 Standard_Integer Aspect_GenId::Upper () const {
122 return (MyUpperBound);
126 //void Aspect_GenId::Assign (const Aspect_GenId& Other) {
128 // MyLowerBound = Other.Lower ();
129 // MyUpperBound = Other.Upper ();