Open CASCADE Technology  7.3.0
Public Member Functions | Static Public Member Functions

TDataStd_TreeNode Class Reference

Allows you to define an explicit tree of labels which you can also edit. Without this class, the data structure cannot be fully edited. This service is required if for presentation purposes, you want to create an application with a tree which allows you to organize and link data as a function of application features. More...

#include <TDataStd_TreeNode.hxx>

Inheritance diagram for TDataStd_TreeNode:
Inheritance graph
[legend]

Public Member Functions

 TDataStd_TreeNode ()
 
Standard_Boolean Append (const Handle< TDataStd_TreeNode > &Child)
 Insert the TreeNode <Child> as last child of <me>. If the insertion is successful <me> becomes the Father of <Child>. More...
 
Standard_Boolean Prepend (const Handle< TDataStd_TreeNode > &Child)
 Insert the the TreeNode <Child> as first child of <me>. If the insertion is successful <me> becomes the Father of <Child> More...
 
Standard_Boolean InsertBefore (const Handle< TDataStd_TreeNode > &Node)
 Inserts the TreeNode <Node> before <me>. If insertion is successful <me> and <Node> belongs to the same Father. More...
 
Standard_Boolean InsertAfter (const Handle< TDataStd_TreeNode > &Node)
 Inserts the TreeNode <Node> after <me>. If insertion is successful <me> and <Node> belongs to the same Father. More...
 
Standard_Boolean Remove ()
 Removes this tree node attribute from its father node. The result is that this attribute becomes a root node. More...
 
Standard_Integer Depth () const
 Returns the depth of this tree node in the overall tree node structure. In other words, the number of father tree nodes of this one is returned. More...
 
Standard_Integer NbChildren (const Standard_Boolean allLevels=Standard_False) const
 Returns the number of child nodes. If <allLevels> is true, the method counts children of all levels (children of children ...) More...
 
Standard_Boolean IsAscendant (const Handle< TDataStd_TreeNode > &of) const
 Returns true if this tree node attribute is an ascendant of of. In other words, if it is a father or the father of a father of of. More...
 
Standard_Boolean IsDescendant (const Handle< TDataStd_TreeNode > &of) const
 Returns true if this tree node attribute is a descendant of of. In other words, if it is a child or the child of a child of of. More...
 
Standard_Boolean IsRoot () const
 Returns true if this tree node attribute is the ultimate father in the tree. More...
 
Handle< TDataStd_TreeNodeRoot () const
 Returns the ultimate father of this tree node attribute. More...
 
Standard_Boolean IsFather (const Handle< TDataStd_TreeNode > &of) const
 Returns true if this tree node attribute is a father of of. More...
 
Standard_Boolean IsChild (const Handle< TDataStd_TreeNode > &of) const
 Returns true if this tree node attribute is a child of of. More...
 
Standard_Boolean HasFather () const
 Returns true if this tree node attribute has a father tree node. More...
 
Handle< TDataStd_TreeNodeFather () const
 Returns the father TreeNode of <me>. Null if root. More...
 
Standard_Boolean HasNext () const
 Returns true if this tree node attribute has a next tree node. More...
 
Handle< TDataStd_TreeNodeNext () const
 Returns the next tree node in this tree node attribute. Warning This tree node is null if it is the last one in this tree node attribute.Returns the next TreeNode of <me>. Null if last. More...
 
Standard_Boolean HasPrevious () const
 Returns true if this tree node attribute has a previous tree node. More...
 
Handle< TDataStd_TreeNodePrevious () const
 Returns the previous tree node of this tree node attribute. Warning This tree node is null if it is the first one in this tree node attribute. More...
 
Standard_Boolean HasFirst () const
 Returns true if this tree node attribute has a first child tree node. More...
 
Handle< TDataStd_TreeNodeFirst () const
 Returns the first child tree node in this tree node object. More...
 
Standard_Boolean HasLast () const
 Returns true if this tree node attribute has a last child tree node. More...
 
Handle< TDataStd_TreeNodeLast ()
 Returns the last child tree node in this tree node object. More...
 
Handle< TDataStd_TreeNodeFindLast ()
 Returns the last child tree node in this tree node object.

<>to set fields More...
 
void SetTreeID (const Standard_GUID &explicitID)
 
void SetFather (const Handle< TDataStd_TreeNode > &F)
 
void SetNext (const Handle< TDataStd_TreeNode > &F)
 
void SetPrevious (const Handle< TDataStd_TreeNode > &F)
 
void SetFirst (const Handle< TDataStd_TreeNode > &F)
 
void SetLast (const Handle< TDataStd_TreeNode > &F)
 <>TreeNode callback: More...
 
virtual void AfterAddition () override
 Connect the TreeNode to its father child list. More...
 
virtual void BeforeForget () override
 Disconnect the TreeNode from its Father child list. More...
 
virtual void AfterResume () override
 Reconnect the TreeNode to its father child list. More...
 
virtual Standard_Boolean BeforeUndo (const Handle< TDF_AttributeDelta > &anAttDelta, const Standard_Boolean forceIt=Standard_False) override
 Disconnect the TreeNode, if necessary. More...
 
virtual Standard_Boolean AfterUndo (const Handle< TDF_AttributeDelta > &anAttDelta, const Standard_Boolean forceIt=Standard_False) override
 Reconnect the TreeNode, if necessary.

<>Implementation of Attribute methods: More...
 
const Standard_GUIDID () const override
 Returns the tree ID (default or explicit one depending onthe Set method used). More...
 
virtual void Restore (const Handle< TDF_Attribute > &with) override
 Restores the backuped contents from <anAttribute> into this one. It is used when aborting a transaction. More...
 
virtual void Paste (const Handle< TDF_Attribute > &into, const Handle< TDF_RelocationTable > &RT) const override
 This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method may paste the contents of <me> into <intoAttribute>. More...
 
virtual Handle< TDF_AttributeNewEmpty () const override
 Returns an new empty attribute from the good end type. It is used by the copy algorithm. More...
 
virtual void References (const Handle< TDF_DataSet > &aDataSet) const override
 Adds the first level referenced attributes and labels to <aDataSet>. More...
 
virtual Standard_OStreamDump (Standard_OStream &anOS) const override
 Dumps the minimum information about <me> on <aStream>. More...
 
- Public Member Functions inherited from TDF_Attribute
virtual void SetID (const Standard_GUID &)
 Sets specific ID of the attribute (supports several attributes of one type at the same label feature). More...
 
virtual void SetID ()
 Sets default ID defined in nested class (to be used for attributes having User ID feature). More...
 
const TDF_Label Label () const
 Returns the label to which the attribute is attached. If the label is not included in a DF, the label is null. See Label. Warning If the label is not included in a data framework, it is null. This function should not be redefined inline. More...
 
Standard_Integer Transaction () const
 Returns the transaction index in which the attribute has been created or modified. More...
 
Standard_Integer UntilTransaction () const
 Returns the upper transaction index until which the attribute is/was valid. This number may vary. A removed attribute validity range is reduced to its transaction index. More...
 
Standard_Boolean IsValid () const
 Returns true if the attribute is valid; i.e. not a backuped or removed one. More...
 
Standard_Boolean IsNew () const
 Returns true if the attribute has no backup. More...
 
Standard_Boolean IsForgotten () const
 Returns true if the attribute forgotten status is set. More...
 
Standard_Boolean IsAttribute (const Standard_GUID &anID) const
 Returns true if it exists an associated attribute of <me> with <anID> as ID. More...
 
Standard_Boolean FindAttribute (const Standard_GUID &anID, Handle< TDF_Attribute > &anAttribute) const
 Finds an associated attribute of <me>, according to <anID>. the returned <anAttribute> is a valid one. The method returns True if found, False otherwise. A removed attribute cannot be found using this method. More...
 
template<class T >
Standard_Boolean FindAttribute (const Standard_GUID &theID, Handle< T > &theAttr) const
 Safe variant for arbitrary type of argument. More...
 
void AddAttribute (const Handle< TDF_Attribute > &other) const
 Adds an Attribute <other> to the label of <me>.Raises if there is already one of the same GUID fhan <other>. More...
 
Standard_Boolean ForgetAttribute (const Standard_GUID &aguid) const
 Forgets the Attribute of GUID <aguid> associated to the label of <me>. Be carefull that if <me> is the attribute of <guid>, <me> will have a null label after this call. If the attribute doesn't exist returns False. Otherwise returns True. More...
 
void ForgetAllAttributes (const Standard_Boolean clearChildren=Standard_True) const
 Forgets all the attributes attached to the label of <me>. Does it on the sub-labels if <clearChildren> is set to true. Of course, this method is compatible with Transaction & Delta mecanisms. Be carefull that if <me> will have a null label after this call. More...
 
virtual void BeforeRemoval ()
 Something to do before removing an Attribute from a label. More...
 
virtual Standard_Boolean AfterRetrieval (const Standard_Boolean forceIt=Standard_False)
 Something to do AFTER creation of an attribute by persistent-transient translation. The returned status says if AfterUndo has been performed (true) or if this callback must be called once again further (false). If <forceIt> is set to true, the method MUST perform and return true. Does nothing by default and returns true. More...
 
virtual void BeforeCommitTransaction ()
 A callback. By default does nothing. It is called by TDF_Data::CommitTransaction() method. More...
 
void Backup ()
 Backups the attribute. The backuped attribute is flagged "Backuped" and not "Valid". More...
 
Standard_Boolean IsBackuped () const
 Returns true if the attribute backup status is set. This status is set/unset by the Backup() method. More...
 
virtual Handle< TDF_AttributeBackupCopy () const
 Copies the attribute contents into a new other attribute. It is used by Backup(). More...
 
virtual Handle< TDF_DeltaOnAdditionDeltaOnAddition () const
 Makes an AttributeDelta because <me> appeared. The only known use of a redefinition of this method is to return a null handle (no delta). More...
 
virtual Handle< TDF_DeltaOnForgetDeltaOnForget () const
 Makes an AttributeDelta because <me> has been forgotten. More...
 
virtual Handle< TDF_DeltaOnResumeDeltaOnResume () const
 Makes an AttributeDelta because <me> has been resumed. More...
 
virtual Handle< TDF_DeltaOnModificationDeltaOnModification (const Handle< TDF_Attribute > &anOldAttribute) const
 Makes a DeltaOnModification between <me> and <anOldAttribute. More...
 
virtual void DeltaOnModification (const Handle< TDF_DeltaOnModification > &aDelta)
 Applies a DeltaOnModification to <me>. More...
 
virtual Handle< TDF_DeltaOnRemovalDeltaOnRemoval () const
 Makes a DeltaOnRemoval on <me> because <me> has disappeared from the DS. More...
 
Standard_OStreamoperator<< (Standard_OStream &anOS) const
 
virtual void ExtendedDump (Standard_OStream &anOS, const TDF_IDFilter &aFilter, TDF_AttributeIndexedMap &aMap) const
 Dumps the attribute content on <aStream>, using <aMap> like this: if an attribute is not in the map, first put add it to the map and then dump it. Use the map rank instead of dumping each attribute field. More...
 
void Forget (const Standard_Integer aTransaction)
 Forgets the attribute. <aTransaction> is the current transaction in which the forget is done. A forgotten attribute is also flagged not "Valid". More...
 
- Public Member Functions inherited from Standard_Transient
 Standard_Transient ()
 Empty constructor. More...
 
 Standard_Transient (const Standard_Transient &)
 Copy constructor – does nothing. More...
 
Standard_Transientoperator= (const Standard_Transient &)
 Assignment operator, needed to avoid copying reference counter. More...
 
virtual ~Standard_Transient ()
 Destructor must be virtual. More...
 
virtual void Delete () const
 Memory deallocator for transient classes. More...
 
virtual const opencascade::handle< Standard_Type > & DynamicType () const
 Returns a type descriptor about this object. More...
 
Standard_Boolean IsInstance (const opencascade::handle< Standard_Type > &theType) const
 Returns a true value if this is an instance of Type. More...
 
Standard_Boolean IsInstance (const Standard_CString theTypeName) const
 Returns a true value if this is an instance of TypeName. More...
 
Standard_Boolean IsKind (const opencascade::handle< Standard_Type > &theType) const
 Returns true if this is an instance of Type or an instance of any class that inherits from Type. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_Boolean IsKind (const Standard_CString theTypeName) const
 Returns true if this is an instance of TypeName or an instance of any class that inherits from TypeName. Note that multiple inheritance is not supported by OCCT RTTI mechanism. More...
 
Standard_TransientThis () const
 Returns non-const pointer to this object (like const_cast). For protection against creating handle to objects allocated in stack or call from constructor, it will raise exception Standard_ProgramError if reference counter is zero. More...
 
Standard_Integer GetRefCount () const
 Get the reference counter of this object. More...
 
void IncrementRefCounter () const
 Increments the reference counter of this object. More...
 
Standard_Integer DecrementRefCounter () const
 Decrements the reference counter of this object; returns the decremented value. More...
 

Static Public Member Functions

static Standard_Boolean Find (const TDF_Label &L, Handle< TDataStd_TreeNode > &T)
 <>class methods working on the node Returns true if the tree node T is found on the label L. Otherwise, false is returned. More...
 
static Handle< TDataStd_TreeNodeSet (const TDF_Label &L)
 Finds or Creates a TreeNode attribute on the label <L> with the default tree ID, returned by the method <GetDefaultTreeID>. Returns the created/found TreeNode attribute. More...
 
static Handle< TDataStd_TreeNodeSet (const TDF_Label &L, const Standard_GUID &ExplicitTreeID)
 Finds or Creates a TreeNode attribute on the label <L>, with an explicit tree ID. <ExplicitTreeID> is the ID returned by <TDF_Attribute::ID> method. Returns the found/created TreeNode attribute. More...
 
static const Standard_GUIDGetDefaultTreeID ()
 returns a default tree ID. this ID is used by the <Set> method without explicit tree ID.

<>Instance methods: More...
 
- Static Public Member Functions inherited from Standard_Transient
static const char * get_type_name ()
 Returns a type descriptor about this object. More...
 
static const opencascade::handle< Standard_Type > & get_type_descriptor ()
 Returns type descriptor of Standard_Transient class. More...
 

Additional Inherited Members

- Public Types inherited from Standard_Transient
typedef void base_type
 Returns a type descriptor about this object. More...
 
- Protected Member Functions inherited from TDF_Attribute
 TDF_Attribute ()
 Initializes fields. More...
 

Detailed Description

Allows you to define an explicit tree of labels which you can also edit. Without this class, the data structure cannot be fully edited. This service is required if for presentation purposes, you want to create an application with a tree which allows you to organize and link data as a function of application features.

Constructor & Destructor Documentation

◆ TDataStd_TreeNode()

TDataStd_TreeNode::TDataStd_TreeNode ( )

Member Function Documentation

◆ AfterAddition()

virtual void TDataStd_TreeNode::AfterAddition ( )
overridevirtual

Connect the TreeNode to its father child list.

Reimplemented from TDF_Attribute.

◆ AfterResume()

virtual void TDataStd_TreeNode::AfterResume ( )
overridevirtual

Reconnect the TreeNode to its father child list.

Reimplemented from TDF_Attribute.

◆ AfterUndo()

virtual Standard_Boolean TDataStd_TreeNode::AfterUndo ( const Handle< TDF_AttributeDelta > &  anAttDelta,
const Standard_Boolean  forceIt = Standard_False 
)
overridevirtual

Reconnect the TreeNode, if necessary.

<>Implementation of Attribute methods:

Reimplemented from TDF_Attribute.

◆ Append()

Standard_Boolean TDataStd_TreeNode::Append ( const Handle< TDataStd_TreeNode > &  Child)

Insert the TreeNode <Child> as last child of <me>. If the insertion is successful <me> becomes the Father of <Child>.

◆ BeforeForget()

virtual void TDataStd_TreeNode::BeforeForget ( )
overridevirtual

Disconnect the TreeNode from its Father child list.

Reimplemented from TDF_Attribute.

◆ BeforeUndo()

virtual Standard_Boolean TDataStd_TreeNode::BeforeUndo ( const Handle< TDF_AttributeDelta > &  anAttDelta,
const Standard_Boolean  forceIt = Standard_False 
)
overridevirtual

Disconnect the TreeNode, if necessary.

Reimplemented from TDF_Attribute.

◆ Depth()

Standard_Integer TDataStd_TreeNode::Depth ( ) const

Returns the depth of this tree node in the overall tree node structure. In other words, the number of father tree nodes of this one is returned.

◆ Dump()

virtual Standard_OStream& TDataStd_TreeNode::Dump ( Standard_OStream anOS) const
overridevirtual

Dumps the minimum information about <me> on <aStream>.

Reimplemented from TDF_Attribute.

◆ Father()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::Father ( ) const

Returns the father TreeNode of <me>. Null if root.

◆ Find()

static Standard_Boolean TDataStd_TreeNode::Find ( const TDF_Label L,
Handle< TDataStd_TreeNode > &  T 
)
static

<>class methods working on the node Returns true if the tree node T is found on the label L. Otherwise, false is returned.

◆ FindLast()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::FindLast ( )

Returns the last child tree node in this tree node object.

<>to set fields

◆ First()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::First ( ) const

Returns the first child tree node in this tree node object.

◆ GetDefaultTreeID()

static const Standard_GUID& TDataStd_TreeNode::GetDefaultTreeID ( )
static

returns a default tree ID. this ID is used by the <Set> method without explicit tree ID.

<>Instance methods:

◆ HasFather()

Standard_Boolean TDataStd_TreeNode::HasFather ( ) const

Returns true if this tree node attribute has a father tree node.

◆ HasFirst()

Standard_Boolean TDataStd_TreeNode::HasFirst ( ) const

Returns true if this tree node attribute has a first child tree node.

◆ HasLast()

Standard_Boolean TDataStd_TreeNode::HasLast ( ) const

Returns true if this tree node attribute has a last child tree node.

◆ HasNext()

Standard_Boolean TDataStd_TreeNode::HasNext ( ) const

Returns true if this tree node attribute has a next tree node.

◆ HasPrevious()

Standard_Boolean TDataStd_TreeNode::HasPrevious ( ) const

Returns true if this tree node attribute has a previous tree node.

◆ ID()

const Standard_GUID& TDataStd_TreeNode::ID ( ) const
overridevirtual

Returns the tree ID (default or explicit one depending onthe Set method used).

Implements TDF_Attribute.

◆ InsertAfter()

Standard_Boolean TDataStd_TreeNode::InsertAfter ( const Handle< TDataStd_TreeNode > &  Node)

Inserts the TreeNode <Node> after <me>. If insertion is successful <me> and <Node> belongs to the same Father.

◆ InsertBefore()

Standard_Boolean TDataStd_TreeNode::InsertBefore ( const Handle< TDataStd_TreeNode > &  Node)

Inserts the TreeNode <Node> before <me>. If insertion is successful <me> and <Node> belongs to the same Father.

◆ IsAscendant()

Standard_Boolean TDataStd_TreeNode::IsAscendant ( const Handle< TDataStd_TreeNode > &  of) const

Returns true if this tree node attribute is an ascendant of of. In other words, if it is a father or the father of a father of of.

◆ IsChild()

Standard_Boolean TDataStd_TreeNode::IsChild ( const Handle< TDataStd_TreeNode > &  of) const

Returns true if this tree node attribute is a child of of.

◆ IsDescendant()

Standard_Boolean TDataStd_TreeNode::IsDescendant ( const Handle< TDataStd_TreeNode > &  of) const

Returns true if this tree node attribute is a descendant of of. In other words, if it is a child or the child of a child of of.

◆ IsFather()

Standard_Boolean TDataStd_TreeNode::IsFather ( const Handle< TDataStd_TreeNode > &  of) const

Returns true if this tree node attribute is a father of of.

◆ IsRoot()

Standard_Boolean TDataStd_TreeNode::IsRoot ( ) const

Returns true if this tree node attribute is the ultimate father in the tree.

◆ Last()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::Last ( )

Returns the last child tree node in this tree node object.

◆ NbChildren()

Standard_Integer TDataStd_TreeNode::NbChildren ( const Standard_Boolean  allLevels = Standard_False) const

Returns the number of child nodes. If <allLevels> is true, the method counts children of all levels (children of children ...)

◆ NewEmpty()

virtual Handle< TDF_Attribute > TDataStd_TreeNode::NewEmpty ( ) const
overridevirtual

Returns an new empty attribute from the good end type. It is used by the copy algorithm.

Implements TDF_Attribute.

◆ Next()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::Next ( ) const

Returns the next tree node in this tree node attribute. Warning This tree node is null if it is the last one in this tree node attribute.Returns the next TreeNode of <me>. Null if last.

◆ Paste()

virtual void TDataStd_TreeNode::Paste ( const Handle< TDF_Attribute > &  intoAttribute,
const Handle< TDF_RelocationTable > &  aRelocationTable 
) const
overridevirtual

This method is different from the "Copy" one, because it is used when copying an attribute from a source structure into a target structure. This method may paste the contents of <me> into <intoAttribute>.

The given pasted attribute can be full or empty of its contents. But don't make a NEW! Just set the contents!

It is possible to use <aRelocationTable> to get/set the relocation value of a source attribute.

Implements TDF_Attribute.

◆ Prepend()

Standard_Boolean TDataStd_TreeNode::Prepend ( const Handle< TDataStd_TreeNode > &  Child)

Insert the the TreeNode <Child> as first child of <me>. If the insertion is successful <me> becomes the Father of <Child>

◆ Previous()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::Previous ( ) const

Returns the previous tree node of this tree node attribute. Warning This tree node is null if it is the first one in this tree node attribute.

◆ References()

virtual void TDataStd_TreeNode::References ( const Handle< TDF_DataSet > &  aDataSet) const
overridevirtual

Adds the first level referenced attributes and labels to <aDataSet>.

For this, use the AddLabel or AddAttribute of DataSet.

If there is none, do not implement the method.

Reimplemented from TDF_Attribute.

◆ Remove()

Standard_Boolean TDataStd_TreeNode::Remove ( )

Removes this tree node attribute from its father node. The result is that this attribute becomes a root node.

◆ Restore()

virtual void TDataStd_TreeNode::Restore ( const Handle< TDF_Attribute > &  anAttribute)
overridevirtual

Restores the backuped contents from <anAttribute> into this one. It is used when aborting a transaction.

Implements TDF_Attribute.

◆ Root()

Handle< TDataStd_TreeNode > TDataStd_TreeNode::Root ( ) const

Returns the ultimate father of this tree node attribute.

◆ Set() [1/2]

static Handle< TDataStd_TreeNode > TDataStd_TreeNode::Set ( const TDF_Label L)
static

Finds or Creates a TreeNode attribute on the label <L> with the default tree ID, returned by the method <GetDefaultTreeID>. Returns the created/found TreeNode attribute.

◆ Set() [2/2]

static Handle< TDataStd_TreeNode > TDataStd_TreeNode::Set ( const TDF_Label L,
const Standard_GUID ExplicitTreeID 
)
static

Finds or Creates a TreeNode attribute on the label <L>, with an explicit tree ID. <ExplicitTreeID> is the ID returned by <TDF_Attribute::ID> method. Returns the found/created TreeNode attribute.

◆ SetFather()

void TDataStd_TreeNode::SetFather ( const Handle< TDataStd_TreeNode > &  F)

◆ SetFirst()

void TDataStd_TreeNode::SetFirst ( const Handle< TDataStd_TreeNode > &  F)

◆ SetLast()

void TDataStd_TreeNode::SetLast ( const Handle< TDataStd_TreeNode > &  F)

<>TreeNode callback:

◆ SetNext()

void TDataStd_TreeNode::SetNext ( const Handle< TDataStd_TreeNode > &  F)

◆ SetPrevious()

void TDataStd_TreeNode::SetPrevious ( const Handle< TDataStd_TreeNode > &  F)

◆ SetTreeID()

void TDataStd_TreeNode::SetTreeID ( const Standard_GUID explicitID)

The documentation for this class was generated from the following file: