Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-11-09 10:28:04

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 <gp_XYZ.hxx>
0023 #include <NCollection_Sequence.hxx>
0024 #include <NCollection_HSequence.hxx>
0025 #include <gp_Pnt.hxx>
0026 #include <gp_Dir.hxx>
0027 #include <gp_Vec.hxx>
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 void Read(StdObjMgt_ReadData& theReadData) override;
0040 
0041     //! Write persistent data to a file.
0042     Standard_EXPORT void Write(StdObjMgt_WriteData& theWriteData) const override;
0043 
0044     //! Gets persistent objects
0045     void PChildren(SequenceOfPersistent& theChildren) const override
0046     {
0047       theChildren.Append(this->myPreviuos);
0048       theChildren.Append(this->myNext);
0049     }
0050 
0051     //! Returns persistent type name
0052     const char* PName() const override
0053     {
0054       throw Standard_NotImplemented("ShapePersistent_HSequence::node::PName - not implemented");
0055     }
0056 
0057     const Handle(node)& Previuos() const { return myPreviuos; }
0058 
0059     const Handle(node)& Next() const { return myNext; }
0060 
0061     const ItemType& Item() const { return myItem; }
0062 
0063   private:
0064     Handle(node) myPreviuos;
0065     Handle(node) myNext;
0066     ItemType     myItem;
0067   };
0068 
0069   template <class SequenceClass>
0070   class instance : public StdObjMgt_Persistent
0071   {
0072   public:
0073     typedef node<SequenceClass> Node;
0074 
0075   public:
0076     //! Empty constructor.
0077     instance()
0078         : mySize(0)
0079     {
0080     }
0081 
0082     //! Read persistent data from a file.
0083     Standard_EXPORT void Read(StdObjMgt_ReadData& theReadData) override;
0084 
0085     //! Write persistent data to a file.
0086     Standard_EXPORT void Write(StdObjMgt_WriteData& theWriteData) const override;
0087 
0088     //! Gets persistent objects
0089     void PChildren(SequenceOfPersistent& theChildren) const override
0090     {
0091       theChildren.Append(this->myFirst);
0092       theChildren.Append(this->myLast);
0093     }
0094 
0095     //! Returns persistent type name
0096     const char* PName() const override
0097     {
0098       throw Standard_NotImplemented("ShapePersistent_HSequence::instance::PName - not implemented");
0099     }
0100 
0101     //! Import transient object from the persistent data.
0102     Standard_EXPORT occ::handle<SequenceClass> Import() const;
0103 
0104   private:
0105     occ::handle<Node> myFirst;
0106     occ::handle<Node> myLast;
0107     int               mySize;
0108   };
0109 
0110 public:
0111   typedef instance<NCollection_HSequence<gp_XYZ>> XYZ;
0112   typedef instance<NCollection_HSequence<gp_Pnt>> Pnt;
0113   typedef instance<NCollection_HSequence<gp_Dir>> Dir;
0114   typedef instance<NCollection_HSequence<gp_Vec>> Vec;
0115 };
0116 
0117 //=======================================================================
0118 // XYZ
0119 //=======================================================================
0120 template <>
0121 const char* ShapePersistent_HSequence::instance<NCollection_HSequence<gp_XYZ>>::PName() const;
0122 
0123 template <>
0124 const char* ShapePersistent_HSequence::node<NCollection_HSequence<gp_XYZ>>::PName() const;
0125 
0126 //=======================================================================
0127 // Pnt
0128 //=======================================================================
0129 template <>
0130 const char* ShapePersistent_HSequence::instance<NCollection_HSequence<gp_Pnt>>::PName() const;
0131 
0132 template <>
0133 const char* ShapePersistent_HSequence::node<NCollection_HSequence<gp_Pnt>>::PName() const;
0134 
0135 //=======================================================================
0136 // Dir
0137 //=======================================================================
0138 template <>
0139 const char* ShapePersistent_HSequence::instance<NCollection_HSequence<gp_Dir>>::PName() const;
0140 
0141 template <>
0142 const char* ShapePersistent_HSequence::node<NCollection_HSequence<gp_Dir>>::PName() const;
0143 
0144 //=======================================================================
0145 // Vec
0146 //=======================================================================
0147 template <>
0148 const char* ShapePersistent_HSequence::instance<NCollection_HSequence<gp_Vec>>::PName() const;
0149 
0150 template <>
0151 const char* ShapePersistent_HSequence::node<NCollection_HSequence<gp_Vec>>::PName() const;
0152 
0153 #endif