Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
HierarchyItem Class Reference

Represents a single component in the library in hierarchy view. More...

#include <hierarchyitem.h>

Inheritance diagram for HierarchyItem:

Public Types

enum  ObjectType {
  ROOT = 0 , COMPONENT , BUSDEFINITION , ABSDEFINITION ,
  COMDEFINITION , APIDEFINITION , HW_DESIGN , SW_DESIGN ,
  SYS_DESIGN , CATALOG
}
 Defines the type of the hierarchy item. More...
 

Signals

void errorMessage (QString const &msg)
 Send an error message to be printed to user.
 
void noticeMessage (QString const &msg)
 Send a notification to be printed to user.
 

Public Member Functions

 HierarchyItem (LibraryInterface *handler, HierarchyItem *parent, VLNV const &vlnv, KactusAttribute::Implementation implementation=KactusAttribute::KTS_IMPLEMENTATION_COUNT, QString const &viewName=QString())
 
 HierarchyItem (LibraryInterface *handler, QObject *parent)
 
virtual ~HierarchyItem ()=default
 The destructor.
 
HierarchyItemchild (int index) const
 
void cleanUp ()
 
void clear ()
 
QSharedPointer< Component const > component () const
 
bool contains (const VLNV &vlnv) const
 
void createChild (const VLNV &vlnv)
 
QVector< HierarchyItem * > findItems (const VLNV &vlnv)
 
void getChildItems (QList< VLNV > &itemList) const
 
void getChildren (QList< VLNV > &childList, const VLNV &owner) const
 
KactusAttribute::Implementation getImplementation () const
 
int getIndexOf (HierarchyItem *item)
 
int getNumberOfChildren () const
 
int getOwners (QList< VLNV > &list, const VLNV &vlnvToSearch) const
 
QString getViewName () const
 
VLNV const & getVLNV () const
 
QVector< VLNV > getVLNVs () const
 
bool hasChildren () const
 
bool hasParent (const VLNV &vlnv)
 
int instanceCount () const
 
bool isDuplicate () const
 
bool isHierarchical () const
 
bool isRoot () const
 
bool isValid () const
 
HierarchyItemparent () const
 
bool parentIsRoot () const
 
int referenceCount (const VLNV &vlnv) const
 
int removeItems (const VLNV &vlnv)
 
int row ()
 
void setDuplicate (bool isDuplicate)
 
void setValidity (bool valid)
 
ObjectType type () const
 
void updateItems (const VLNV &vlnv)
 

Protected Member Functions

int countInstances (const VLNV &componentVLNV)
 

Detailed Description

Represents a single component in the library in hierarchy view.

Definition at line 38 of file hierarchyitem.h.

Member Enumeration Documentation

◆ ObjectType

Defines the type of the hierarchy item.

Enumerator
ROOT 
COMPONENT 
BUSDEFINITION 
ABSDEFINITION 
COMDEFINITION 
APIDEFINITION 
HW_DESIGN 
SW_DESIGN 
SYS_DESIGN 
CATALOG 

Definition at line 45 of file hierarchyitem.h.

Constructor & Destructor Documentation

◆ HierarchyItem() [1/2]

HierarchyItem::HierarchyItem ( LibraryInterface * handler,
HierarchyItem * parent,
VLNV const & vlnv,
KactusAttribute::Implementation implementation = KactusAttribute::KTS_IMPLEMENTATION_COUNT,
QString const & viewName = QString() )

The constructor

Parameters
[in]handlerThe instance that manages the library.
[in]parentThe owner of this object.
[in]vlnvThe vlnv to construct the item for.
[in]implementationThe implementation attribute needed by designs.
[in]viewNameThe name of the view the design belongs to.

◆ HierarchyItem() [2/2]

HierarchyItem::HierarchyItem ( LibraryInterface * handler,
QObject * parent )

The constructor for the root item.

This constructor should only be used to create the root item and no other hierarchy items.

Parameters
[in]handlerThe instance that manages the library.
[in]parentThe owner of this item.

◆ ~HierarchyItem()

virtual HierarchyItem::~HierarchyItem ( )
virtualdefault

The destructor.

Member Function Documentation

◆ child()

HierarchyItem * HierarchyItem::child ( int index) const

Get pointer to the child item with given index.

If child with given index does not exist then return null pointer.

Parameters
[in]indexRow number of the child that's pointer is wanted.
Returns
HierarchyItem*

◆ cleanUp()

void HierarchyItem::cleanUp ( )

Removes the child items that are contained in one or several other components.

Note: This function should be called only for the root item.

Returns
void

◆ clear()

void HierarchyItem::clear ( )

Remove all children from item.

◆ component()

QSharedPointer< Component const > HierarchyItem::component ( ) const

Get pointer to the component that this item represents

Returns
QSharedPointer<Component> The component model.

◆ contains()

bool HierarchyItem::contains ( const VLNV & vlnv) const

Checks if the component or one of it's sub-components contains the vlnv.

Parameters
[in]vlnvThe vlnv that is searched in hierarchy.
Returns
bool True if the vlnv is found.

◆ countInstances()

int HierarchyItem::countInstances ( const VLNV & componentVLNV)
protected

Count the number of instances for the given vlnv.

Parameters
[in]componentVLNVThe vlnv of the component that's instance count is counted.
Returns
The number of instantiation times.

◆ createChild()

void HierarchyItem::createChild ( const VLNV & vlnv)

Create a child for the HierarchyItem that represents the given VLNV.

This function should only be called for the root item to create the tree.

Parameters
[in]vlnvIdentifies the component to represent.

◆ errorMessage

void HierarchyItem::errorMessage ( QString const & msg)
signal

Send an error message to be printed to user.

◆ findItems()

QVector< HierarchyItem * > HierarchyItem::findItems ( const VLNV & vlnv)

Find the hierarchyItems that represent the given vlnv.

Parameters
[in]vlnvIdentifies the items.
Returns
QList<HierarchyItem*> contains pointers to the hierarchy items.

◆ getChildItems()

void HierarchyItem::getChildItems ( QList< VLNV > & itemList) const

Get the vlnvs of the items that are this item's children.

Parameters
[in]itemListThe list where the vlnvs are appended to.

◆ getChildren()

void HierarchyItem::getChildren ( QList< VLNV > & childList,
const VLNV & owner ) const

Get the child items of given object.

This function must only be called to the root item.

Parameters
[in]childListThe list where the vlnvs of the children are appended.
[in]ownerIdentifies the object that's children are searched.

◆ getImplementation()

KactusAttribute::Implementation HierarchyItem::getImplementation ( ) const

Get the implementation of this item.

Note: This function can only be called for items of type component.

Returns
KactusAttribute::Implementation Specifies the implementation.

◆ getIndexOf()

int HierarchyItem::getIndexOf ( HierarchyItem * item)

Get the index of specified item.

Parameters
[in]itemThe HierarchyItem that's row number is requested.
Returns
The row number of given item. Returns -1 if item is not found.

◆ getNumberOfChildren()

int HierarchyItem::getNumberOfChildren ( ) const

Get the number of children this item has.

Returns
The number of child items this item has.

◆ getOwners()

int HierarchyItem::getOwners ( QList< VLNV > & list,
const VLNV & vlnvToSearch ) const

Get list of objects that have instantiated the given vlnv.

This function makes sure each owner is appended to the list only once.

Parameters
[out]listQList where owner vlnvs is appended.
[in]vlnvToSearchThe vlnv to that's parents are wanted.
Returns
Number of unique owners found.

◆ getViewName()

QString HierarchyItem::getViewName ( ) const

Get the name of the view the design belongs to.

If type() is other than design an empty string is returned.

Returns
QString containing the view name.

◆ getVLNV()

VLNV const & HierarchyItem::getVLNV ( ) const

Get the vlnv of this item.

Returns
VLNV of the component this item represents.

◆ getVLNVs()

QVector< VLNV > HierarchyItem::getVLNVs ( ) const

Get the list of vlnvs this item and it's parents contain.

Returns
QList<VLNV> contains the list of vlnvs

◆ hasChildren()

bool HierarchyItem::hasChildren ( ) const

Check if this item has children or not.

Returns
True if at least one child item exists.

◆ hasParent()

bool HierarchyItem::hasParent ( const VLNV & vlnv)

Checks if the item has parent on some hierarchy-level with given vlnv.

Function does not just search the direct parent but the whole parent-chain up to the root item.

Parameters
[in]vlnvIdentifies the parent to search.
Returns
bool True if parent with given vlnv is found.

◆ instanceCount()

int HierarchyItem::instanceCount ( ) const

Count how many times this component has been instantiated in a containing design.

For items that are not components this function returns -1

Returns
The instance count in the containing design.

◆ isDuplicate()

bool HierarchyItem::isDuplicate ( ) const

Check if this item is instantiated in some item or not.

Returns
bool true if item is contained as some item's child.

◆ isHierarchical()

bool HierarchyItem::isHierarchical ( ) const

Checks if the component this item represents is hierarchical or not.

Returns
bool true if the component is hierarchical.

◆ isRoot()

bool HierarchyItem::isRoot ( ) const

Check if this is the root item or not.

Returns
bool True if this is the root item.

◆ isValid()

bool HierarchyItem::isValid ( ) const

Check if this item is valid or not.

Returns
True if item is valid.

◆ noticeMessage

void HierarchyItem::noticeMessage ( QString const & msg)
signal

Send a notification to be printed to user.

◆ parent()

HierarchyItem * HierarchyItem::parent ( ) const

Get the parent of this item.

Returns
The parent of this item

◆ parentIsRoot()

bool HierarchyItem::parentIsRoot ( ) const

Check if the parent of this item is the root item.

Returns
bool true if the parent item is root item. If this is the root or parent is normal item then returns false.

◆ referenceCount()

int HierarchyItem::referenceCount ( const VLNV & vlnv) const

Count how many instances of given vlnv is found under this item.

This function does not check if the same owner is counted multiple times if same sub-component is instantiated in several components. If count that contains only unique owners then you should use getOwners().

Parameters
[in]vlnvIdentifies the component that's instances are searched.
Returns
Number of found instances.

◆ removeItems()

int HierarchyItem::removeItems ( const VLNV & vlnv)

Remove the child items with given vlnv.

Parameters
[in]vlnvIdentifies the items to remove.
Returns
Amount of child items removed from this item.

◆ row()

int HierarchyItem::row ( )

Get the row number of this item on this item's parent.

Returns
The row number.

◆ setDuplicate()

void HierarchyItem::setDuplicate ( bool isDuplicate)

Set the duplicate value for this item.

Parameters
[in]isDuplicateIf true then this item is set as duplicate.

◆ setValidity()

void HierarchyItem::setValidity ( bool valid)

Set the validity of this item.

Parameters
[in]validSets the valid value of the item.

◆ type()

ObjectType HierarchyItem::type ( ) const

Get the type of this hierarchy item.

Returns
ObjectType defines the type of the item.

◆ updateItems()

void HierarchyItem::updateItems ( const VLNV & vlnv)

Update hierarchy items with given vlnv.

Parameters
[in]vlnvIdentifies the objects to update.

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