|
|
|||
File indexing completed on 2026-05-07 08:46:29
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 <TColStd_ListOfAsciiString.hxx> 0021 0022 //! Unique item identifier in the hierarchical product structure. 0023 //! A full path to an assembly component in the "part-of" graph starting from 0024 //! the root node. 0025 class XCAFDoc_AssemblyItemId 0026 { 0027 0028 public: 0029 //! Constructs an empty item ID. 0030 Standard_EXPORT XCAFDoc_AssemblyItemId(); 0031 0032 //! Constructs an item ID from a list of strings, where every 0033 //! string is a label entry. 0034 //! \param[in] thePath - list of label entries. 0035 Standard_EXPORT XCAFDoc_AssemblyItemId(const TColStd_ListOfAsciiString& thePath); 0036 0037 //! Constructs an item ID from a formatted path, where label entries 0038 //! are separated by '/' symbol. 0039 //! \param[in] theString - formatted full path. 0040 Standard_EXPORT XCAFDoc_AssemblyItemId(const TCollection_AsciiString& theString); 0041 0042 //! Initializes the item ID from a list of strings, where every 0043 //! string is a label entry. 0044 //! \param[in] thePath - list of label entries. 0045 Standard_EXPORT void Init(const TColStd_ListOfAsciiString& thePath); 0046 0047 //! Initializes the item ID from a formatted path, where label entries 0048 //! are separated by '/' symbol. 0049 //! \param[in] theString - formatted full path. 0050 Standard_EXPORT void Init(const TCollection_AsciiString& theString); 0051 0052 //! Returns true if the full path is empty, otherwise - false. 0053 Standard_EXPORT Standard_Boolean IsNull() const; 0054 0055 //! Clears the full path. 0056 Standard_EXPORT void Nullify(); 0057 0058 //! Checks if this item is a child of the given item. 0059 //! \param[in] theOther - potentially ancestor item. 0060 //! \return true if the item is a child of theOther item, otherwise - false. 0061 Standard_EXPORT Standard_Boolean IsChild(const XCAFDoc_AssemblyItemId& theOther) const; 0062 0063 //! Checks if this item is a direct child of the given item. 0064 //! \param[in] theOther - potentially parent item. 0065 //! \return true if the item is a direct child of theOther item, otherwise - false. 0066 Standard_EXPORT Standard_Boolean IsDirectChild(const XCAFDoc_AssemblyItemId& theOther) const; 0067 0068 //! Checks for item IDs equality. 0069 //! \param[in] theOther - the item ID to check equality with. 0070 //! \return true if this ID is equal to theOther, otherwise - false. 0071 Standard_EXPORT Standard_Boolean IsEqual(const XCAFDoc_AssemblyItemId& theOther) const; 0072 0073 //! Returns the full path as a list of label entries. 0074 Standard_EXPORT const TColStd_ListOfAsciiString& GetPath() const; 0075 0076 //! Returns the full pass as a formatted string. 0077 Standard_EXPORT TCollection_AsciiString ToString() const; 0078 0079 //! Dumps the content of me into the stream 0080 Standard_EXPORT virtual void DumpJson(Standard_OStream& theOStream, 0081 Standard_Integer theDepth = -1) const; 0082 0083 bool operator==(const XCAFDoc_AssemblyItemId& theOther) const { return IsEqual(theOther); } 0084 0085 private: 0086 TColStd_ListOfAsciiString 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 |
|