Back to home page

EIC code displayed by LXR

 
 

    


Warning, file /include/opencascade/TDataStd_IntegerArray.hxx was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 // Created on: 1999-06-16
0002 // Created by: Sergey RUIN
0003 // Copyright (c) 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 _TDataStd_IntegerArray_HeaderFile
0018 #define _TDataStd_IntegerArray_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 
0022 #include <TColStd_HArray1OfInteger.hxx>
0023 #include <TDF_Attribute.hxx>
0024 #include <Standard_Integer.hxx>
0025 #include <Standard_OStream.hxx>
0026 #include <Standard_GUID.hxx>
0027 
0028 class TDF_Label;
0029 class TDF_RelocationTable;
0030 class TDF_DeltaOnModification;
0031 
0032 
0033 class TDataStd_IntegerArray;
0034 DEFINE_STANDARD_HANDLE(TDataStd_IntegerArray, TDF_Attribute)
0035 
0036 //! Contains an array of integers.
0037 class TDataStd_IntegerArray : public TDF_Attribute
0038 {
0039   friend class TDataStd_DeltaOnModificationOfIntArray;
0040   DEFINE_STANDARD_RTTIEXT(TDataStd_IntegerArray, TDF_Attribute)
0041 public:
0042 
0043   //! class methods
0044   //! =============
0045   //! Returns the GUID for arrays of integers.
0046   Standard_EXPORT static const Standard_GUID& GetID();
0047   
0048   //! Finds or creates on the <label> an integer array attribute
0049   //! with the specified <lower> and <upper> boundaries.
0050   //! If <isDelta> == False, DefaultDeltaOnModification is used.
0051   //! If <isDelta> == True, DeltaOnModification of the current attribute is used.
0052   //! If attribute is already set, all input parameters are refused and the found
0053   //! attribute is returned.
0054   Standard_EXPORT static Handle(TDataStd_IntegerArray) Set (const TDF_Label& label, const Standard_Integer lower, 
0055                                                             const Standard_Integer upper, 
0056                                                             const Standard_Boolean isDelta = Standard_False);
0057   
0058   //! Finds, or creates, an IntegerArray attribute with explicit user defined <guid>.
0059   //! The IntegerArray attribute  is  returned.
0060   Standard_EXPORT static Handle(TDataStd_IntegerArray) Set (const TDF_Label& label, const Standard_GUID&   theGuid,
0061                                                             const Standard_Integer lower, const Standard_Integer upper, 
0062                                                             const Standard_Boolean isDelta = Standard_False);
0063 
0064   //! Initialize the inner array with bounds from <lower> to <upper>
0065   Standard_EXPORT void Init (const Standard_Integer lower, const Standard_Integer upper);
0066   
0067   //! Sets  the   <Index>th  element  of   the  array to <Value>
0068   //! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the internal  array.
0069   Standard_EXPORT void SetValue (const Standard_Integer Index, const Standard_Integer Value);
0070   
0071   //! Sets the explicit GUID (user defined) for the attribute.
0072   Standard_EXPORT void SetID( const Standard_GUID&  theGuid) Standard_OVERRIDE;
0073 
0074   //! Sets default GUID for the attribute.
0075   Standard_EXPORT void SetID() Standard_OVERRIDE;
0076 
0077   //! Return the value of  the  <Index>th element of the array
0078   Standard_EXPORT Standard_Integer Value (const Standard_Integer Index) const;
0079 
0080   Standard_Integer operator () (const Standard_Integer Index) const 
0081   {
0082     return Value(Index);
0083   }
0084   
0085   //! Returns the lower boundary of this array of integers.
0086   Standard_EXPORT Standard_Integer Lower() const;
0087   
0088   //! Return the upper boundary of this array of integers.
0089   Standard_EXPORT Standard_Integer Upper() const;
0090   
0091   //! Returns the length of this array of integers in
0092   //! terms of the number of elements it contains.
0093   Standard_EXPORT Standard_Integer Length() const;
0094   
0095   //! Sets the inner array <myValue>  of the IntegerArray attribute to
0096   //! <newArray>. If value of <newArray> differs from <myValue>, Backup performed
0097   //! and myValue refers to new instance of HArray1OfInteger that holds <newArray>
0098   //! values
0099   //! If <isCheckItems> equal True each item of <newArray> will be checked with each
0100   //! item of <myValue> for coincidence (to avoid backup).
0101   Standard_EXPORT void ChangeArray (const Handle(TColStd_HArray1OfInteger)& newArray, const Standard_Boolean isCheckItems = Standard_True);
0102 
0103   //! Return the inner array of the IntegerArray attribute
0104   const Handle(TColStd_HArray1OfInteger)& Array() const { return myValue; }
0105 
0106   Standard_Boolean GetDelta() const { return myIsDelta; }
0107 
0108   //! for  internal  use  only!
0109   void SetDelta (const Standard_Boolean isDelta) { myIsDelta = isDelta; }
0110 
0111   Standard_EXPORT TDataStd_IntegerArray();
0112   
0113   Standard_EXPORT const Standard_GUID& ID() const Standard_OVERRIDE;
0114   
0115   Standard_EXPORT void Restore (const Handle(TDF_Attribute)& With) Standard_OVERRIDE;
0116   
0117   Standard_EXPORT Handle(TDF_Attribute) NewEmpty() const Standard_OVERRIDE;
0118   
0119   //! Note. Uses inside ChangeArray() method
0120   Standard_EXPORT void Paste (const Handle(TDF_Attribute)& Into, const Handle(TDF_RelocationTable)& RT) const Standard_OVERRIDE;
0121   
0122   Standard_EXPORT virtual Standard_OStream& Dump (Standard_OStream& anOS) const Standard_OVERRIDE;
0123   
0124   //! Makes a DeltaOnModification between <me> and
0125   //! <anOldAttribute>.
0126   Standard_EXPORT virtual Handle(TDF_DeltaOnModification) DeltaOnModification (const Handle(TDF_Attribute)& anOldAttribute) const Standard_OVERRIDE;
0127   
0128   //! Dumps the content of me into the stream
0129   Standard_EXPORT virtual void DumpJson (Standard_OStream& theOStream, Standard_Integer theDepth = -1) const Standard_OVERRIDE;
0130 
0131 private:
0132 
0133   void RemoveArray() { myValue.Nullify(); }
0134 
0135 private:
0136 
0137   Handle(TColStd_HArray1OfInteger) myValue;
0138   Standard_Boolean myIsDelta;
0139   Standard_GUID myID;
0140 
0141 
0142 };
0143 
0144 #endif // _TDataStd_IntegerArray_HeaderFile