Open CASCADE Technology Reference Manual 8.0.0
Loading...
Searching...
No Matches
Public Member Functions
TDF_Label Class Reference

This class provides basic operations to define a label in a data structure. A label is a feature in the feature hierarchy. A label is always connected to a Data from TDF. To a label is attached attributes containing the software components information. More...

#include <TDF_Label.hxx>

Public Member Functions

 TDF_Label ()
 Constructs an empty label object.
 
void Nullify ()
 Nullifies the label.
 
occ::handle< TDF_DataData () const
 Returns the Data owning <me>.
 
int Tag () const
 Returns the tag of the label. This is the integer assigned randomly to a label in a data framework. This integer is used to identify this label in an entry.
 
const TDF_Label Father () const
 Returns the label father. This label may be null if the label is root.
 
bool IsNull () const
 Returns True if the <aLabel> is null, i.e. it has not been included in the data framework.
 
void Imported (const bool aStatus) const
 Sets or unsets <me> and all its descendants as imported label, according to <aStatus>.
 
bool IsImported () const
 Returns True if the <aLabel> is imported.
 
bool IsEqual (const TDF_Label &aLabel) const
 Returns True if the <aLabel> is equal to me (same LabelNode*).
 
bool operator== (const TDF_Label &aLabel) const
 
bool IsDifferent (const TDF_Label &aLabel) const
 
bool operator!= (const TDF_Label &aLabel) const
 
bool IsRoot () const
 
bool IsAttribute (const Standard_GUID &anID) const
 Returns true if <me> owns an attribute with <anID> as ID.
 
void AddAttribute (const occ::handle< TDF_Attribute > &anAttribute, const bool append=true) const
 Adds an Attribute to the current label. Raises if there is already one.
 
void ForgetAttribute (const occ::handle< TDF_Attribute > &anAttribute) const
 Forgets an Attribute from the current label, setting its forgotten status true and its valid status false. Raises if the attribute is not in the structure.
 
bool ForgetAttribute (const Standard_GUID &aguid) const
 Forgets the Attribute of GUID <aguid> from the current label. If the attribute doesn't exist returns False. Otherwise returns True.
 
void ForgetAllAttributes (const bool clearChildren=true) const
 Forgets all the attributes. Does it on also on the sub-labels if <clearChildren> is set to true. Of course, this method is compatible with Transaction & Delta mechanisms.
 
void ResumeAttribute (const occ::handle< TDF_Attribute > &anAttribute) const
 Undo Forget action, setting its forgotten status false and its valid status true. Raises if the attribute is not in the structure.
 
bool FindAttribute (const Standard_GUID &anID, occ::handle< TDF_Attribute > &anAttribute) const
 Finds an attribute of the current label, according to <anID>. If anAttribute is not a valid one, false is returned.
 
template<class T >
bool FindAttribute (const Standard_GUID &theID, occ::handle< T > &theAttr) const
 Safe variant of FindAttribute() for arbitrary type of argument.
 
bool FindAttribute (const Standard_GUID &anID, const int aTransaction, occ::handle< TDF_Attribute > &anAttribute) const
 Finds an attribute of the current label, according to <anID> and <aTransaction>. This attribute has/had to be a valid one for the given transaction index. So, this attribute is not necessarily a valid one.
 
bool MayBeModified () const
 Returns true if <me> or a DESCENDANT of <me> owns attributes not yet available in transaction 0. It means at least one of their attributes is new, modified or deleted.
 
bool AttributesModified () const
 Returns true if <me> owns attributes not yet available in transaction 0. It means at least one attribute is new, modified or deleted.
 
bool HasAttribute () const
 Returns true if this label has at least one attribute.
 
int NbAttributes () const
 Returns the number of attributes.
 
int Depth () const
 Returns the depth of the label in the data framework. This corresponds to the number of fathers which this label has, and is used in determining whether a label is root, null or equivalent to another label. Exceptions: Standard_NullObject if this label is null. This is because a null object can have no depth.
 
bool IsDescendant (const TDF_Label &aLabel) const
 Returns True if <me> is a descendant of <aLabel>. Attention: every label is its own descendant.
 
const TDF_Label Root () const
 Returns the root label Root of the data structure. This has a depth of 0. Exceptions: Standard_NullObject if this label is null. This is because a null object can have no depth.
 
bool HasChild () const
 Returns true if this label has at least one child.
 
int NbChildren () const
 Returns the number of children.
 
TDF_Label FindChild (const int aTag, const bool create=true) const
 Finds a child label having <aTag> as tag. Creates The tag aTag identifies the label which will be the parent. If create is true and no child label is found, a new one is created. Example: //creating a label with tag 10 at Root TDF_Label lab1 = aDF->Root().FindChild(10); //creating labels 7 and 2 on label 10 TDF_Label lab2 = lab1.FindChild(7); TDF_Label lab3 = lab1.FindChild(2);.
 
TDF_Label NewChild () const
 Create a new child label of me using automatic delivery tags provided by TagSource.
 
int Transaction () const
 Returns the current transaction index.
 
bool HasLowerNode (const TDF_Label &otherLabel) const
 Returns true if node address of <me> is lower than <otherLabel> one. Used to quickly sort labels (not on entry criterion).
 
bool HasGreaterNode (const TDF_Label &otherLabel) const
 Returns true if node address of <me> is greater than <otherLabel> one. Used to quickly sort labels (not on entry criterion).
 
Standard_OStreamDump (Standard_OStream &anOS) const
 Dumps the minimum information about <me> on <aStream>.
 
Standard_OStreamoperator<< (Standard_OStream &anOS) const
 
void ExtendedDump (Standard_OStream &anOS, const TDF_IDFilter &aFilter, NCollection_IndexedMap< occ::handle< TDF_Attribute > > &aMap) const
 Dumps the label on <aStream> and its attributes rank in <aMap> if their IDs are kept by <IDFilter>.
 
void EntryDump (Standard_OStream &anOS) const
 Dumps the label entry.
 

Detailed Description

This class provides basic operations to define a label in a data structure. A label is a feature in the feature hierarchy. A label is always connected to a Data from TDF. To a label is attached attributes containing the software components information.

Label information:

It is possible to know the tag, the father, the depth in the tree of the label, if the label is root, null or equal to another label.

Comfort methods: Some methods useful on a label.

Attributes:

It is possible to get an attribute in accordance to an ID, or the yougest previous version of a current attribute.

Constructor & Destructor Documentation

◆ TDF_Label()

TDF_Label::TDF_Label ( )

Constructs an empty label object.

Member Function Documentation

◆ AddAttribute()

void TDF_Label::AddAttribute ( const occ::handle< TDF_Attribute > & anAttribute,
const bool append = true ) const

Adds an Attribute to the current label. Raises if there is already one.

◆ AttributesModified()

bool TDF_Label::AttributesModified ( ) const

Returns true if <me> owns attributes not yet available in transaction 0. It means at least one attribute is new, modified or deleted.

◆ Data()

occ::handle< TDF_Data > TDF_Label::Data ( ) const

Returns the Data owning <me>.

◆ Depth()

int TDF_Label::Depth ( ) const

Returns the depth of the label in the data framework. This corresponds to the number of fathers which this label has, and is used in determining whether a label is root, null or equivalent to another label. Exceptions: Standard_NullObject if this label is null. This is because a null object can have no depth.

◆ Dump()

Standard_OStream & TDF_Label::Dump ( Standard_OStream & anOS) const

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

◆ EntryDump()

void TDF_Label::EntryDump ( Standard_OStream & anOS) const

Dumps the label entry.

◆ ExtendedDump()

void TDF_Label::ExtendedDump ( Standard_OStream & anOS,
const TDF_IDFilter & aFilter,
NCollection_IndexedMap< occ::handle< TDF_Attribute > > & aMap ) const

Dumps the label on <aStream> and its attributes rank in <aMap> if their IDs are kept by <IDFilter>.

◆ Father()

const TDF_Label TDF_Label::Father ( ) const

Returns the label father. This label may be null if the label is root.

◆ FindAttribute() [1/3]

bool TDF_Label::FindAttribute ( const Standard_GUID & anID,
const int aTransaction,
occ::handle< TDF_Attribute > & anAttribute ) const

Finds an attribute of the current label, according to <anID> and <aTransaction>. This attribute has/had to be a valid one for the given transaction index. So, this attribute is not necessarily a valid one.

The method returns True if found, False otherwise.

A removed attribute cannot be found nor a backuped attribute of a removed one.

◆ FindAttribute() [2/3]

bool TDF_Label::FindAttribute ( const Standard_GUID & anID,
occ::handle< TDF_Attribute > & anAttribute ) const

Finds an attribute of the current label, according to <anID>. If anAttribute is not a valid one, false is returned.

The method returns True if found, False otherwise.

A removed attribute cannot be found.

◆ FindAttribute() [3/3]

template<class T >
bool TDF_Label::FindAttribute ( const Standard_GUID & theID,
occ::handle< T > & theAttr ) const
inline

Safe variant of FindAttribute() for arbitrary type of argument.

◆ FindChild()

TDF_Label TDF_Label::FindChild ( const int aTag,
const bool create = true ) const

Finds a child label having <aTag> as tag. Creates The tag aTag identifies the label which will be the parent. If create is true and no child label is found, a new one is created. Example: //creating a label with tag 10 at Root TDF_Label lab1 = aDF->Root().FindChild(10); //creating labels 7 and 2 on label 10 TDF_Label lab2 = lab1.FindChild(7); TDF_Label lab3 = lab1.FindChild(2);.

◆ ForgetAllAttributes()

void TDF_Label::ForgetAllAttributes ( const bool clearChildren = true) const

Forgets all the attributes. Does it on also on the sub-labels if <clearChildren> is set to true. Of course, this method is compatible with Transaction & Delta mechanisms.

◆ ForgetAttribute() [1/2]

void TDF_Label::ForgetAttribute ( const occ::handle< TDF_Attribute > & anAttribute) const

Forgets an Attribute from the current label, setting its forgotten status true and its valid status false. Raises if the attribute is not in the structure.

◆ ForgetAttribute() [2/2]

bool TDF_Label::ForgetAttribute ( const Standard_GUID & aguid) const

Forgets the Attribute of GUID <aguid> from the current label. If the attribute doesn't exist returns False. Otherwise returns True.

◆ HasAttribute()

bool TDF_Label::HasAttribute ( ) const

Returns true if this label has at least one attribute.

◆ HasChild()

bool TDF_Label::HasChild ( ) const

Returns true if this label has at least one child.

◆ HasGreaterNode()

bool TDF_Label::HasGreaterNode ( const TDF_Label & otherLabel) const

Returns true if node address of <me> is greater than <otherLabel> one. Used to quickly sort labels (not on entry criterion).

-C++: inline

◆ HasLowerNode()

bool TDF_Label::HasLowerNode ( const TDF_Label & otherLabel) const

Returns true if node address of <me> is lower than <otherLabel> one. Used to quickly sort labels (not on entry criterion).

-C++: inline

◆ Imported()

void TDF_Label::Imported ( const bool aStatus) const

Sets or unsets <me> and all its descendants as imported label, according to <aStatus>.

◆ IsAttribute()

bool TDF_Label::IsAttribute ( const Standard_GUID & anID) const

Returns true if <me> owns an attribute with <anID> as ID.

◆ IsDescendant()

bool TDF_Label::IsDescendant ( const TDF_Label & aLabel) const

Returns True if <me> is a descendant of <aLabel>. Attention: every label is its own descendant.

◆ IsDifferent()

bool TDF_Label::IsDifferent ( const TDF_Label & aLabel) const

◆ IsEqual()

bool TDF_Label::IsEqual ( const TDF_Label & aLabel) const

Returns True if the <aLabel> is equal to me (same LabelNode*).

◆ IsImported()

bool TDF_Label::IsImported ( ) const

Returns True if the <aLabel> is imported.

◆ IsNull()

bool TDF_Label::IsNull ( ) const

Returns True if the <aLabel> is null, i.e. it has not been included in the data framework.

◆ IsRoot()

bool TDF_Label::IsRoot ( ) const

◆ MayBeModified()

bool TDF_Label::MayBeModified ( ) const

Returns true if <me> or a DESCENDANT of <me> owns attributes not yet available in transaction 0. It means at least one of their attributes is new, modified or deleted.

◆ NbAttributes()

int TDF_Label::NbAttributes ( ) const

Returns the number of attributes.

◆ NbChildren()

int TDF_Label::NbChildren ( ) const

Returns the number of children.

◆ NewChild()

TDF_Label TDF_Label::NewChild ( ) const

Create a new child label of me using automatic delivery tags provided by TagSource.

◆ Nullify()

void TDF_Label::Nullify ( )

Nullifies the label.

◆ operator!=()

bool TDF_Label::operator!= ( const TDF_Label & aLabel) const
inline

◆ operator<<()

Standard_OStream & TDF_Label::operator<< ( Standard_OStream & anOS) const
inline

◆ operator==()

bool TDF_Label::operator== ( const TDF_Label & aLabel) const
inline

◆ ResumeAttribute()

void TDF_Label::ResumeAttribute ( const occ::handle< TDF_Attribute > & anAttribute) const

Undo Forget action, setting its forgotten status false and its valid status true. Raises if the attribute is not in the structure.

◆ Root()

const TDF_Label TDF_Label::Root ( ) const

Returns the root label Root of the data structure. This has a depth of 0. Exceptions: Standard_NullObject if this label is null. This is because a null object can have no depth.

◆ Tag()

int TDF_Label::Tag ( ) const

Returns the tag of the label. This is the integer assigned randomly to a label in a data framework. This integer is used to identify this label in an entry.

◆ Transaction()

int TDF_Label::Transaction ( ) const

Returns the current transaction index.


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