2 // File Aspect_GenId.cxx
6 //-Copyright MatraDatavision 1991,1992
10 //-Design Declaration des variables specifiques aux identificateurs
12 //-Warning Un identificateur est un entier.
21 #include <Aspect_GenId.ixx>
25 //-Global data definitions
33 Aspect_GenId::Aspect_GenId ():
35 MyCount (INT_MAX/2 + 1),
36 MyLength (INT_MAX/2 + 1),
38 MyUpperBound (INT_MAX/2),
43 Aspect_GenId::Aspect_GenId (const Standard_Integer Low, const Standard_Integer Up):MyFreeIds () {
48 MyLength = MyUpperBound - MyLowerBound + 1;
52 Aspect_IdentDefinitionError::Raise
53 ("GenId Create Error: Low > Up");
57 Standard_Integer Aspect_GenId::Available () const {
63 void Aspect_GenId::Free () {
70 void Aspect_GenId::Free (const Standard_Integer Id) {
72 if ( (Id >= MyLowerBound) && (Id <= MyUpperBound) )
73 MyFreeIds.Prepend (Id);
77 Standard_Integer Aspect_GenId::Lower () const {
79 return (MyLowerBound);
83 Standard_Integer Aspect_GenId::Next () {
86 Aspect_IdentDefinitionError::Raise
87 ("GenId Next Error: Available == 0");
91 if (! MyFreeIds.IsEmpty ()) {
92 Id = MyFreeIds.First ();
93 MyFreeIds.RemoveFirst ();
97 Id = MyLowerBound + MyLength - MyCount - 1;
104 Standard_Integer Aspect_GenId::Upper () const {
106 return (MyUpperBound);
110 //void Aspect_GenId::Assign (const Aspect_GenId& Other) {
112 // MyLowerBound = Other.Lower ();
113 // MyUpperBound = Other.Upper ();