Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:05:23

0001 // Created on: 1993-02-26
0002 // Created by: Remi LEQUETTE
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _TopLoc_SListOfItemLocation_HeaderFile
0018 #define _TopLoc_SListOfItemLocation_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <Standard_Macro.hxx>
0025 class TopLoc_SListNodeOfItemLocation;
0026 class TopLoc_ItemLocation;
0027 
0028 
0029 //! An SListOfItemLocation is a LISP like list of Items.
0030 //! An SListOfItemLocation is :
0031 //! . Empty.
0032 //! . Or it has a Value and a  Tail  which is an other SListOfItemLocation.
0033 //!
0034 //! The Tail of an empty list is an empty list.
0035 //! SListOfItemLocation are  shared.  It  means   that they  can  be
0036 //! modified through other lists.
0037 //! SListOfItemLocation may  be used  as Iterators. They  have Next,
0038 //! More, and value methods. To iterate on the content
0039 //! of the list S just do.
0040 //!
0041 //! SListOfItemLocation Iterator;
0042 //! for (Iterator = S; Iterator.More(); Iterator.Next())
0043 //! X = Iterator.Value();
0044 class TopLoc_SListOfItemLocation 
0045 {
0046 public:
0047 
0048   DEFINE_STANDARD_ALLOC
0049 
0050   //! Creates an empty List.
0051   TopLoc_SListOfItemLocation() {}
0052   
0053   //! Creates a List with <anItem> as value  and <aTail> as tail.
0054   Standard_EXPORT TopLoc_SListOfItemLocation(const TopLoc_ItemLocation& anItem, const TopLoc_SListOfItemLocation& aTail);
0055   
0056   //! Creates a list from an other one. The lists  are shared.
0057   TopLoc_SListOfItemLocation(const TopLoc_SListOfItemLocation& Other)
0058   : myNode(Other.myNode)
0059   {
0060   }
0061   
0062   //! Sets  a list  from  an  other  one. The  lists are
0063   //! shared. The list itself is returned.
0064   Standard_EXPORT TopLoc_SListOfItemLocation& Assign (const TopLoc_SListOfItemLocation& Other);
0065 
0066   //! Assignment
0067   TopLoc_SListOfItemLocation& operator = (const TopLoc_SListOfItemLocation& Other)
0068   {
0069     return Assign(Other);
0070   }
0071   
0072   //! Move constructor
0073   TopLoc_SListOfItemLocation (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
0074     : myNode(std::move (theOther.myNode))
0075   {
0076   }
0077 
0078   //! Move operator
0079   TopLoc_SListOfItemLocation& operator= (TopLoc_SListOfItemLocation&& theOther) Standard_Noexcept
0080   {
0081     myNode = std::move (theOther.myNode);
0082     return *this;
0083   }
0084 
0085   //! Returne true if this list is empty
0086   Standard_Boolean IsEmpty() const
0087   {
0088     return myNode.IsNull();
0089   }
0090   
0091   //! Sets the list to be empty.
0092   void Clear()
0093   {
0094     myNode.Nullify();
0095   }
0096 
0097   //! Destructor
0098   ~TopLoc_SListOfItemLocation()
0099   {
0100     Clear();
0101   }
0102   
0103   //! Returns the current value of the list. An error is
0104   //! raised  if the list is empty.
0105   Standard_EXPORT const TopLoc_ItemLocation& Value() const;
0106   
0107   //! Returns the current tail of  the list. On an empty
0108   //! list the tail is the list itself.
0109   Standard_EXPORT const TopLoc_SListOfItemLocation& Tail() const;
0110   
0111   //! Replaces the list by a list with <anItem> as Value
0112   //! and the  list <me> as  tail.
0113   void Construct(const TopLoc_ItemLocation& anItem)
0114   {
0115     Assign(TopLoc_SListOfItemLocation(anItem, *this));
0116   }
0117   
0118   //! Replaces the list <me> by its tail.
0119   void ToTail()
0120   {
0121     Assign(Tail());
0122   }
0123   
0124   //! Returns True if the iterator  has a current value.
0125   //! This is !IsEmpty()
0126   Standard_Boolean More() const
0127   {
0128     return !IsEmpty();
0129   }
0130   
0131   //! Moves the iterator to the next object in the list.
0132   //! If the iterator is empty it will  stay empty. This is ToTail()
0133   void Next()
0134   {
0135     ToTail();
0136   }
0137 
0138 private:
0139   Handle(TopLoc_SListNodeOfItemLocation) myNode;
0140 };
0141 
0142 #endif // _TopLoc_SListOfItemLocation_HeaderFile