1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-29 14:00:49 +03:00

0024742: Remove rarely used collection classes: SList

Generic "TCollection_SList" class and nested "TCollection_SListNode" class moved (as non-generic) to the "TopLoc" package (the only place where they were instantiated).
Names of these classes changed to "TopLoc_SListOfItemLocation" and "TopLoc_SListNodeOfItemLocation".

"NCollection_SList" class removed as unused (along with NCollection_DefineSList.hxx).
This commit is contained in:
dln
2014-04-08 14:21:26 +04:00
committed by abv
parent 3125ebb6f3
commit bd2de3965e
19 changed files with 120 additions and 586 deletions

View File

@@ -22,7 +22,7 @@
-- Adding of modifying classes
-- - Sequence, HSequence
-- - Set, HSet
-- - List, SList
-- - List
-- - Stack
-- - BasicMap, BasicMapIterator
-- - Map, DataMap, DoubleMap, IndexedMap, IndexedDataMap
@@ -58,9 +58,6 @@ is
generic class List, ListNode, ListIterator;
---Purpose: A single list handled by value.
generic class SList,SListNode;
---Purpose: A LISP like sharable list.
class BaseSequence;
class SeqNode;
pointer SeqNodePtr to SeqNode from TCollection;

View File

@@ -1,202 +0,0 @@
-- Created on: 1993-02-26
-- Created by: Remi LEQUETTE
-- Copyright (c) 1993-1999 Matra Datavision
-- Copyright (c) 1999-2014 OPEN CASCADE SAS
--
-- This file is part of Open CASCADE Technology software library.
--
-- This library is free software; you can redistribute it and/or modify it under
-- the terms of the GNU Lesser General Public License version 2.1 as published
-- by the Free Software Foundation, with special exception defined in the file
-- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
-- distribution for complete text of the license and disclaimer of any warranty.
--
-- Alternatively, this file may be used under the terms of Open CASCADE
-- commercial license or contractual agreement.
generic class SList from TCollection (Item as any)
---Purpose: An SList is a LISP like list of Items.
-- An SList is :
-- . Empty.
-- . Or it has a Value and a Tail which is an other SList.
--
-- The Tail of an empty list is an empty list.
-- SList are shared. It means that they can be
-- modified through other lists.
-- SList may be used as Iterators. They have Next,
-- More, and value methods. To iterate on the content
-- of the list S just do.
--
-- SList Iterator;
-- for (Iterator = S; Iterator.More(); Iterator.Next())
-- X = Iterator.Value();
--
-- Memory usage is automatically managed for SLists
-- (using reference counts).
---Example:
-- If S1 and S2 are SLists :
-- if S1.Value() is X.
--
-- And the following is done :
-- S2 = S1;
-- S2.SetValue(Y);
--
-- S1.Value() becomes also Y. So SList must be used
-- with care. Mainly the SetValue() method is
-- dangerous.
raises
NoSuchObject from Standard
class SListNode from TCollection
inherits TShared from MMgt
is
Create(I : Item; aTail : SList from TCollection) returns mutable SListNode from TCollection;
---C++:inline
Count(me) returns Integer;
---C++:inline
---C++: return &
Tail(me) returns SList from TCollection;
---C++:inline
---C++: return &
Value(me) returns Item;
---C++:inline
---C++: return &
fields
myTail : SList from TCollection;
myValue : Item;
end;
is
Create returns SList from TCollection;
---Purpose: Creates an empty List.
Create(anItem : Item; aTail : SList from TCollection)
returns SList from TCollection;
---Purpose: Creates a List with <anItem> as value and <aTail> as tail.
Create(Other : SList from TCollection)
returns SList from TCollection;
---Purpose: Creates a list from an other one. The lists are shared.
Assign(me : in out; Other : SList from TCollection)
returns SList from TCollection
---Level: Public
---Purpose: Sets a list from an other one. The lists are
-- shared. The list itself is returned.
---C++: alias operator =
---C++: return &
is static;
IsEmpty(me) returns Boolean
---Level: Public
---C++: inline
is static;
Clear(me : in out)
---Level: Public
---Purpose: Sets the list to be empty.
---C++: alias ~
is static;
Value(me) returns any Item
---Level: Public
---Purpose: Returns the current value of the list. An error is
-- raised if the list is empty.
---C++: return const &
raises
NoSuchObject from Standard
is static;
ChangeValue(me : in out) returns any Item
---Level: Public
---Purpose: Returns the current value of the list. An error is
-- raised if the list is empty. This value may be
-- modified. A method modifying the value can be
-- called. The value will be modified in the list.
---Example: AList.ChangeValue().Modify()
---C++: return &
raises
NoSuchObject from Standard
is static;
SetValue(me : in out; anItem : Item)
---Level: Public
---Purpose: Changes the current value in the list. An error is
-- raised if the list is empty.
raises
NoSuchObject from Standard
is static;
Tail(me) returns SList from TCollection
---Level: Public
---Purpose: Returns the current tail of the list. On an empty
-- list the tail is the list itself.
---C++: return const &
is static;
ChangeTail(me : in out) returns SList from TCollection
---Level: Public
---Purpose: Returns the current tail of the list. This tail
-- may be modified. A method modifying the tail can
-- be called. The tail will be modified in the list.
---Example: AList.ChangeTail().Modify()
---C++: return &
is static;
SetTail(me : in out; aList : SList from TCollection)
---Level: Public
---Purpose: Changes the current tail in the list. On an empty
-- list SetTail is Assign.
is static;
Construct(me : in out; anItem : Item)
---Level: Public
---Purpose: Replaces the list by a list with <anItem> as Value
-- and the list <me> as tail.
---C++: inline
is static;
Constructed(me; anItem : Item) returns SList from TCollection
---Level: Public
---Purpose: Returns a new list with <anItem> as Value an the
-- list <me> as tail.
---C++: inline
is static;
ToTail(me : in out)
---Level: Public
---Purpose: Replaces the list <me> by its tail.
---C++: inline
is static;
Initialize(me : in out; aList : SList from TCollection)
---Level: Public
---Purpose: Sets the iterator to iterate on the content of
-- <aList>. This is Assign().
---C++: inline
is static;
More(me) returns Boolean
---Level: Public
---Purpose: Returns True if the iterator has a current value.
-- This is !IsEmpty()
---C++: inline
is static;
Next(me : in out)
---Level: Public
---Purpose: Moves the iterator to the next object in the list.
-- If the iterator is empty it will stay empty. This is ToTail()
---C++: inline
is static;
fields
myNode : SListNode from TCollection;
end SList;

View File

@@ -1,143 +0,0 @@
// Created on: 1993-02-26
// Created by: Remi LEQUETTE
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <Standard_NoSuchObject.hxx>
//=======================================================================
//function : TCollection_SList
//purpose :
//=======================================================================
TCollection_SList::TCollection_SList()
{}
//=======================================================================
//function : TCollection_SList
//purpose :
//=======================================================================
TCollection_SList::TCollection_SList(const Item& anItem,
const TCollection_SList& aTail) :
myNode(new TCollection_SListNode(anItem,aTail))
{}
//=======================================================================
//function : TCollection_SList
//purpose :
//=======================================================================
TCollection_SList::TCollection_SList(const TCollection_SList& Other) :
myNode(Other.myNode)
{
}
//=======================================================================
//function : Assign
//purpose :
//=======================================================================
TCollection_SList& TCollection_SList::Assign(const TCollection_SList& Other)
{
if (this == &Other) return *this;
Clear();
myNode = Other.myNode;
return *this;
}
//=======================================================================
//function : Clear
//purpose :
//=======================================================================
void TCollection_SList::Clear()
{
if (!myNode.IsNull()) {
myNode.Nullify();
}
}
//=======================================================================
//function : Value
//purpose :
//=======================================================================
const Item& TCollection_SList::Value() const
{
Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value");
return myNode->Value();
}
//=======================================================================
//function : ChangeValue
//purpose :
//=======================================================================
Item& TCollection_SList::ChangeValue()
{
Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value");
return myNode->Value();
}
//=======================================================================
//function : SetValue
//purpose :
//=======================================================================
void TCollection_SList::SetValue(const Item& anItem)
{
Standard_NoSuchObject_Raise_if(myNode.IsNull(),"TCollection_SList::Value");
myNode->Value() = anItem;
}
//=======================================================================
//function : Tail
//purpose :
//=======================================================================
const TCollection_SList& TCollection_SList::Tail() const
{
if (!myNode.IsNull())
return myNode->Tail();
else
return *this;
}
//=======================================================================
//function : ChangeTail
//purpose :
//=======================================================================
TCollection_SList& TCollection_SList::ChangeTail()
{
if (!myNode.IsNull())
return myNode->Tail();
else
return *this;
}
//=======================================================================
//function : SetTail
//purpose :
//=======================================================================
void TCollection_SList::SetTail(const TCollection_SList& aList)
{
if (!myNode.IsNull())
myNode->Tail() = aList;
else
Assign(aList);
}

View File

@@ -1,90 +0,0 @@
// Created on: 1993-02-26
// Created by: Remi LEQUETTE
// Copyright (c) 1993-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
//=======================================================================
//function : IsEmpty
//purpose :
//=======================================================================
inline Standard_Boolean TCollection_SList::IsEmpty() const
{
return myNode.IsNull();
}
//=======================================================================
//function : Construct
//purpose :
//=======================================================================
//=======================================================================
//function : Construct
//purpose :
//=======================================================================
inline void TCollection_SList::Construct(const Item& anItem)
{
Assign(TCollection_SList(anItem,*this));
}
//=======================================================================
//function : Constructed
//purpose :
//=======================================================================
inline TCollection_SList TCollection_SList::Constructed(const Item& anItem) const
{
return TCollection_SList(anItem,*this);
}
//=======================================================================
//function : ToTail
//purpose :
//=======================================================================
inline void TCollection_SList::ToTail()
{
Assign(Tail());
}
//=======================================================================
//function : Initialize
//purpose :
//=======================================================================
inline void TCollection_SList::Initialize(const TCollection_SList& aList)
{
Assign(aList);
}
//=======================================================================
//function : More
//purpose :
//=======================================================================
inline Standard_Boolean TCollection_SList::More() const
{
return !IsEmpty();
}
//=======================================================================
//function : Next
//purpose :
//=======================================================================
inline void TCollection_SList::Next()
{
ToTail();
}

View File

@@ -1,13 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.

View File

@@ -1,29 +0,0 @@
// Copyright (c) 1998-1999 Matra Datavision
// Copyright (c) 1999-2014 OPEN CASCADE SAS
//
// This file is part of Open CASCADE Technology software library.
//
// This library is free software; you can redistribute it and/or modify it under
// the terms of the GNU Lesser General Public License version 2.1 as published
// by the Free Software Foundation, with special exception defined in the file
// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
// distribution for complete text of the license and disclaimer of any warranty.
//
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
inline TCollection_SListNode::TCollection_SListNode(const Item& I, const TCollection_SList& T)
: myTail(T),myValue(I)
{
}
inline TCollection_SList& TCollection_SListNode::Tail() const
{
return (TCollection_SList&)myTail;
}
inline Item& TCollection_SListNode::Value() const
{
return (Item&)myValue;
}