Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-13 09:18:08

0001 // Created on: 2007-05-29
0002 // Created by: Vlad Romashko
0003 // Copyright (c) 2007-2014 OPEN CASCADE SAS
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _TDataStd_BooleanArray_HeaderFile
0017 #define _TDataStd_BooleanArray_HeaderFile
0018 
0019 #include <Standard.hxx>
0020 
0021 #include <NCollection_Array1.hxx>
0022 #include <NCollection_HArray1.hxx>
0023 #include <Standard_Integer.hxx>
0024 #include <TDF_Attribute.hxx>
0025 #include <Standard_OStream.hxx>
0026 #include <Standard_GUID.hxx>
0027 class TDF_Label;
0028 class TDF_RelocationTable;
0029 
0030 //! An array of boolean values.
0031 class TDataStd_BooleanArray : public TDF_Attribute
0032 {
0033 
0034 public:
0035   //! Static methods
0036   //! ==============
0037   //! Returns an ID for array.
0038   Standard_EXPORT static const Standard_GUID& GetID();
0039 
0040   //! Finds or creates an attribute with internal boolean array.
0041   Standard_EXPORT static occ::handle<TDataStd_BooleanArray> Set(const TDF_Label& label,
0042                                                                 const int        lower,
0043                                                                 const int        upper);
0044 
0045   //! Finds or creates an attribute with the array using explicit user defined <guid>.
0046   Standard_EXPORT static occ::handle<TDataStd_BooleanArray> Set(const TDF_Label&     label,
0047                                                                 const Standard_GUID& theGuid,
0048                                                                 const int            lower,
0049                                                                 const int            upper);
0050 
0051   //! Initialize the inner array with bounds from <lower> to <upper>
0052   Standard_EXPORT void Init(const int lower, const int upper);
0053 
0054   //! Sets the <Index>th element of the array to <Value>
0055   //! OutOfRange exception is raised if <Index> doesn't respect Lower and Upper bounds of the
0056   //! internal array.
0057   Standard_EXPORT void SetValue(const int index, const bool value);
0058 
0059   //! Sets the explicit GUID (user defined) for the attribute.
0060   Standard_EXPORT void SetID(const Standard_GUID& theGuid) override;
0061 
0062   //! Sets default GUID for the attribute.
0063   Standard_EXPORT void SetID() override;
0064 
0065   //! Return the value of the <Index>th element of the array.
0066   Standard_EXPORT bool Value(const int Index) const;
0067 
0068   bool operator()(const int Index) const { return Value(Index); }
0069 
0070   //! Returns the lower boundary of the array.
0071   Standard_EXPORT int Lower() const;
0072 
0073   //! Returns the upper boundary of the array.
0074   Standard_EXPORT int Upper() const;
0075 
0076   //! Returns the number of elements in the array.
0077   Standard_EXPORT int Length() const;
0078 
0079   Standard_EXPORT const occ::handle<NCollection_HArray1<uint8_t>>& InternalArray() const;
0080 
0081   Standard_EXPORT void SetInternalArray(const occ::handle<NCollection_HArray1<uint8_t>>& values);
0082 
0083   Standard_EXPORT TDataStd_BooleanArray();
0084 
0085   Standard_EXPORT const Standard_GUID& ID() const override;
0086 
0087   Standard_EXPORT void Restore(const occ::handle<TDF_Attribute>& with) override;
0088 
0089   Standard_EXPORT occ::handle<TDF_Attribute> NewEmpty() const override;
0090 
0091   Standard_EXPORT void Paste(const occ::handle<TDF_Attribute>&       into,
0092                              const occ::handle<TDF_RelocationTable>& RT) const override;
0093 
0094   Standard_EXPORT Standard_OStream& Dump(Standard_OStream& OS) const override;
0095 
0096   //! Dumps the content of me into the stream
0097   Standard_EXPORT void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const override;
0098 
0099   DEFINE_STANDARD_RTTIEXT(TDataStd_BooleanArray, TDF_Attribute)
0100 
0101 private:
0102   occ::handle<NCollection_HArray1<uint8_t>> myValues;
0103   int                                       myLower;
0104   int                                       myUpper;
0105   Standard_GUID                             myID;
0106 };
0107 
0108 #endif // _TDataStd_BooleanArray_HeaderFile