|
|
|||
File indexing completed on 2026-11-03 10:32:59
0001 // Created on: 2017-02-16 0002 // Created by: Sergey NIKONOV 0003 // Copyright (c) 2000-2017 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 _XCAFDoc_AssemblyItemId_HeaderFile 0017 #define _XCAFDoc_AssemblyItemId_HeaderFile 0018 0019 #include <Standard_GUID.hxx> 0020 #include <TCollection_AsciiString.hxx> 0021 #include <NCollection_List.hxx> 0022 0023 //! Unique item identifier in the hierarchical product structure. 0024 //! A full path to an assembly component in the "part-of" graph starting from 0025 //! the root node. 0026 class XCAFDoc_AssemblyItemId 0027 { 0028 0029 public: 0030 //! Constructs an empty item ID. 0031 Standard_EXPORT XCAFDoc_AssemblyItemId(); 0032 0033 //! Constructs an item ID from a list of strings, where every 0034 //! string is a label entry. 0035 //! \param[in] thePath - list of label entries. 0036 Standard_EXPORT XCAFDoc_AssemblyItemId(const NCollection_List<TCollection_AsciiString>& thePath); 0037 0038 //! Constructs an item ID from a formatted path, where label entries 0039 //! are separated by '/' symbol. 0040 //! \param[in] theString - formatted full path. 0041 Standard_EXPORT XCAFDoc_AssemblyItemId(const TCollection_AsciiString& theString); 0042 0043 //! Initializes the item ID from a list of strings, where every 0044 //! string is a label entry. 0045 //! \param[in] thePath - list of label entries. 0046 Standard_EXPORT void Init(const NCollection_List<TCollection_AsciiString>& thePath); 0047 0048 //! Initializes the item ID from a formatted path, where label entries 0049 //! are separated by '/' symbol. 0050 //! \param[in] theString - formatted full path. 0051 Standard_EXPORT void Init(const TCollection_AsciiString& theString); 0052 0053 //! Returns true if the full path is empty, otherwise - false. 0054 Standard_EXPORT bool IsNull() const; 0055 0056 //! Clears the full path. 0057 Standard_EXPORT void Nullify(); 0058 0059 //! Checks if this item is a child of the given item. 0060 //! \param[in] theOther - potentially ancestor item. 0061 //! \return true if the item is a child of theOther item, otherwise - false. 0062 Standard_EXPORT bool IsChild(const XCAFDoc_AssemblyItemId& theOther) const; 0063 0064 //! Checks if this item is a direct child of the given item. 0065 //! \param[in] theOther - potentially parent item. 0066 //! \return true if the item is a direct child of theOther item, otherwise - false. 0067 Standard_EXPORT bool IsDirectChild(const XCAFDoc_AssemblyItemId& theOther) const; 0068 0069 //! Checks for item IDs equality. 0070 //! \param[in] theOther - the item ID to check equality with. 0071 //! \return true if this ID is equal to theOther, otherwise - false. 0072 Standard_EXPORT bool IsEqual(const XCAFDoc_AssemblyItemId& theOther) const; 0073 0074 //! Returns the full path as a list of label entries. 0075 Standard_EXPORT const NCollection_List<TCollection_AsciiString>& GetPath() const; 0076 0077 //! Returns the full pass as a formatted string. 0078 Standard_EXPORT TCollection_AsciiString ToString() const; 0079 0080 //! Dumps the content of me into the stream 0081 Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, int theDepth = -1) const; 0082 0083 bool operator==(const XCAFDoc_AssemblyItemId& theOther) const { return IsEqual(theOther); } 0084 0085 private: 0086 NCollection_List<TCollection_AsciiString> myPath; ///< List of label entries 0087 }; 0088 0089 namespace std 0090 { 0091 0092 template <> 0093 struct hash<XCAFDoc_AssemblyItemId> 0094 { 0095 size_t operator()(const XCAFDoc_AssemblyItemId& theAssemblyItemId) const 0096 { 0097 return std::hash<TCollection_AsciiString>{}(theAssemblyItemId.ToString()); 0098 } 0099 }; 0100 0101 } // namespace std 0102 #endif // _XCAFDoc_AssemblyItemId_HeaderFile
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|