Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-05-13 08:44:31

0001 // Copyright (c) 2015 OPEN CASCADE SAS
0002 //
0003 // This file is part of Open CASCADE Technology software library.
0004 //
0005 // This library is free software; you can redistribute it and/or modify it under
0006 // the terms of the GNU Lesser General Public License version 2.1 as published
0007 // by the Free Software Foundation, with special exception defined in the file
0008 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0009 // distribution for complete text of the license and disclaimer of any warranty.
0010 //
0011 // Alternatively, this file may be used under the terms of Open CASCADE
0012 // commercial license or contractual agreement.
0013 
0014 #ifndef _ShapePersistent_HSequence_HeaderFile
0015 #define _ShapePersistent_HSequence_HeaderFile
0016 
0017 #include <Standard_NotImplemented.hxx>
0018 
0019 #include <StdObjMgt_Persistent.hxx>
0020 #include <StdObject_gp_Vectors.hxx>
0021 
0022 #include <TColgp_HSequenceOfXYZ.hxx>
0023 #include <TColgp_HSequenceOfPnt.hxx>
0024 #include <TColgp_HSequenceOfDir.hxx>
0025 #include <TColgp_HSequenceOfVec.hxx>
0026 
0027 class ShapePersistent_HSequence
0028 {
0029   template <class SequenceClass>
0030   class node : public StdObjMgt_Persistent
0031   {
0032   public:
0033     typedef typename SequenceClass::value_type ItemType;
0034 
0035   public:
0036     //! Read persistent data from a file.
0037     Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData);
0038 
0039     //! Write persistent data to a file.
0040     Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0041 
0042     //! Gets persistent objects
0043     virtual void PChildren(SequenceOfPersistent& theChildren) const
0044     {
0045       theChildren.Append(this->myPreviuos);
0046       theChildren.Append(this->myNext);
0047     }
0048 
0049     //! Returns persistent type name
0050     virtual Standard_CString PName() const
0051     {
0052       Standard_NotImplemented::Raise("ShapePersistent_HSequence::node::PName - not implemented");
0053       return "";
0054     }
0055 
0056     const Handle(node)& Previuos() const { return myPreviuos; }
0057 
0058     const Handle(node)& Next() const { return myNext; }
0059 
0060     const ItemType& Item() const { return myItem; }
0061 
0062   private:
0063     Handle(node) myPreviuos;
0064     Handle(node) myNext;
0065     ItemType     myItem;
0066   };
0067 
0068   template <class SequenceClass>
0069   class instance : public StdObjMgt_Persistent
0070   {
0071   public:
0072     typedef node<SequenceClass> Node;
0073 
0074   public:
0075     //! Empty constructor.
0076     instance()
0077         : mySize(0)
0078     {
0079     }
0080 
0081     //! Read persistent data from a file.
0082     Standard_EXPORT virtual void Read(StdObjMgt_ReadData& theReadData);
0083 
0084     //! Write persistent data to a file.
0085     Standard_EXPORT virtual void Write(StdObjMgt_WriteData& theWriteData) const;
0086 
0087     //! Gets persistent objects
0088     virtual void PChildren(SequenceOfPersistent& theChildren) const
0089     {
0090       theChildren.Append(this->myFirst);
0091       theChildren.Append(this->myLast);
0092     }
0093 
0094     //! Returns persistent type name
0095     virtual Standard_CString PName() const
0096     {
0097       Standard_NotImplemented::Raise(
0098         "ShapePersistent_HSequence::instance::PName - not implemented");
0099       return "";
0100     }
0101 
0102     //! Import transient object from the persistent data.
0103     Standard_EXPORT Handle(SequenceClass) Import() const;
0104 
0105   private:
0106     Handle(Node)     myFirst;
0107     Handle(Node)     myLast;
0108     Standard_Integer mySize;
0109   };
0110 
0111 public:
0112   typedef instance<TColgp_HSequenceOfXYZ> XYZ;
0113   typedef instance<TColgp_HSequenceOfPnt> Pnt;
0114   typedef instance<TColgp_HSequenceOfDir> Dir;
0115   typedef instance<TColgp_HSequenceOfVec> Vec;
0116 };
0117 
0118 //=======================================================================
0119 // XYZ
0120 //=======================================================================
0121 template <>
0122 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfXYZ>::PName() const;
0123 
0124 template <>
0125 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfXYZ>::PName() const;
0126 
0127 //=======================================================================
0128 // Pnt
0129 //=======================================================================
0130 template <>
0131 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfPnt>::PName() const;
0132 
0133 template <>
0134 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfPnt>::PName() const;
0135 
0136 //=======================================================================
0137 // Dir
0138 //=======================================================================
0139 template <>
0140 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfDir>::PName() const;
0141 
0142 template <>
0143 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfDir>::PName() const;
0144 
0145 //=======================================================================
0146 // Vec
0147 //=======================================================================
0148 template <>
0149 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfVec>::PName() const;
0150 
0151 template <>
0152 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfVec>::PName() const;
0153 
0154 #endif