Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:57

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 
0015 #ifndef _ShapePersistent_HSequence_HeaderFile
0016 #define _ShapePersistent_HSequence_HeaderFile
0017 
0018 #include <Standard_NotImplemented.hxx>
0019 
0020 #include <StdObjMgt_Persistent.hxx>
0021 #include <StdObject_gp_Vectors.hxx>
0022 
0023 #include <TColgp_HSequenceOfXYZ.hxx>
0024 #include <TColgp_HSequenceOfPnt.hxx>
0025 #include <TColgp_HSequenceOfDir.hxx>
0026 #include <TColgp_HSequenceOfVec.hxx>
0027 
0028 
0029 class ShapePersistent_HSequence
0030 {
0031   template <class SequenceClass>
0032   class node : public StdObjMgt_Persistent
0033   {
0034   public:
0035     typedef typename SequenceClass::value_type ItemType;
0036 
0037   public:
0038     //! Read persistent data from a file.
0039     Standard_EXPORT virtual void Read (StdObjMgt_ReadData& theReadData);
0040 
0041     //! Write persistent data to a file.
0042     Standard_EXPORT virtual void Write (StdObjMgt_WriteData& theWriteData) const;
0043 
0044     //! Gets persistent objects
0045     virtual void PChildren (SequenceOfPersistent& theChildren) const
0046     {
0047       theChildren.Append(this->myPreviuos);
0048       theChildren.Append(this->myNext);
0049     }
0050 
0051     //! Returns persistent type name
0052     virtual Standard_CString PName() const
0053     {
0054       Standard_NotImplemented::Raise("ShapePersistent_HSequence::node::PName - not implemented");
0055       return "";
0056     }
0057 
0058     const Handle(node)& Previuos() const  { return myPreviuos; } 
0059     const Handle(node)& Next()     const  { return myNext; } 
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("ShapePersistent_HSequence::instance::PName - not implemented");
0098       return "";
0099     }
0100 
0101     //! Import transient object from the persistent data.
0102     Standard_EXPORT Handle(SequenceClass) Import() const;
0103 
0104   private:
0105     Handle(Node)     myFirst;
0106     Handle(Node)     myLast;
0107     Standard_Integer mySize;
0108   };
0109 
0110 public:
0111   typedef instance<TColgp_HSequenceOfXYZ> XYZ;
0112   typedef instance<TColgp_HSequenceOfPnt> Pnt;
0113   typedef instance<TColgp_HSequenceOfDir> Dir;
0114   typedef instance<TColgp_HSequenceOfVec> Vec;
0115 };
0116 
0117 //=======================================================================
0118 // XYZ 
0119 //=======================================================================
0120 template<>
0121 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfXYZ>
0122   ::PName() const;
0123 
0124 template<>
0125 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfXYZ>
0126   ::PName() const;
0127 
0128 //=======================================================================
0129 // Pnt 
0130 //=======================================================================
0131 template<>
0132 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfPnt>
0133   ::PName() const;
0134 
0135 template<>
0136 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfPnt>
0137   ::PName() const;
0138 
0139 //=======================================================================
0140 // Dir 
0141 //=======================================================================
0142 template<>
0143 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfDir>
0144   ::PName() const;
0145 
0146 template<>
0147 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfDir>
0148   ::PName() const;
0149 
0150 //=======================================================================
0151 // Vec 
0152 //=======================================================================
0153 template<>
0154 Standard_CString ShapePersistent_HSequence::instance<TColgp_HSequenceOfVec>
0155   ::PName() const;
0156 
0157 template<>
0158 Standard_CString ShapePersistent_HSequence::node<TColgp_HSequenceOfVec>
0159   ::PName() const;
0160 
0161 #endif