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

LibraryHandler is the class that implements the services to manage the IP-XACT library. More...

#include <LibraryHandler.h>

Inheritance diagram for LibraryHandler:
LibraryInterface

Public Slots

void beginSave ()
 
void endSave ()
 
void onCheckLibraryIntegrity () final
 
void onEditItem (VLNV const &vlnv) final
 
void onOpenDesign (VLNV const &vlnv, QString const &viewName) final
 
void onOpenMemoryDesign (VLNV const &vlnv, QString const &activeView)
 
void onOpenSWDesign (VLNV const &vlnv)
 
void onOpenSystemDesign (VLNV const &vlnv)
 
void removeObject (VLNV const &vlnv) final
 
void removeObjects (const QList< VLNV > &vlnvList) final
 
- Public Slots inherited from LibraryInterface
virtual void beginSave ()=0
 
virtual void endSave ()=0
 
virtual void onCheckLibraryIntegrity ()=0
 
virtual void onEditItem (VLNV const &vlnv)=0
 
virtual void onOpenDesign (VLNV const &vlnv, QString const &viewName)=0
 
virtual void removeObject (VLNV const &vlnv)=0
 
virtual void removeObjects (const QList< VLNV > &vlnvList)=0
 

Signals

void addVLNV (VLNV const &vlnv)
 Inform tree model that a vlnv is to be added to the tree.
 
void itemSelected (VLNV const &vlnv)
 Signal that the library item specified by vlnv is selected in one of the views.
 
void openAbsDef (VLNV const &absDefVLNV)
 Signal that user wants to open specified abstraction for editing.
 
void openApiDefinition (VLNV const &vlnv)
 Signal that user wants to open specified API definition for editing.
 
void openBus (VLNV const &busDefVLNV)
 Signal that user wants to open specified bus for editing.
 
void openCatalog (VLNV const &vlnv)
 Signal that user wants to open specified catalog for editing.
 
void openComDefinition (VLNV const &vlnv)
 Signal that user wants to open specified COM definition for editing.
 
void openComponent (VLNV const &vlnv)
 Signal that user wants to open specified component for editing.
 
void openDesign (VLNV const &vlnv, const QString &viewName)
 Signal that user wants to open the specified component for editing.
 
void openMemoryDesign (VLNV const &vlnv, const QString &viewName)
 Signal that user wants to open the memory design of the specified component for editing.
 
void openPlatformComponent (VLNV const &vlnv)
 Signal that user wants to open a platform component.
 
void openSWDesign (VLNV const &vlnv, QString const &viewName)
 Signal that user wants to open the specified software design for editing.
 
void openSystemDesign (VLNV const &vlnv, QString const &viewName)
 Signal that user wants to open a system for editing.
 
void progressStatus ()
 
void removeVLNV (VLNV const &vlnv)
 Inform tree model that a vlnv is to be removed from the tree.
 
void resetModel ()
 Inform both models that the content must be reset.
 
void updatedVLNV (VLNV const &vlnv)
 Inform that object has been updated.
 
- Signals inherited from LibraryInterface
void createAbsDef (VLNV const &busDefVLNV, QString const &directory, bool disableBusDef)
 Signal that user wants to create a new abstraction definition for given bus definition.
 
void itemSelected (VLNV const &vlnv)
 Signal that the library item specified by vlnv is selected in one of the views.
 
void openBus (VLNV const &busDefVLNV, VLNV const &absDefVLNV, bool disableBusDef)
 Signal that user wants to open specified bus for editing.
 
void openComponent (VLNV const &vlnv)
 Signal that user wants to open specified component for editing.
 
void openDesign (VLNV const &vlnv, QString const &viewName)
 Signal that user wants to open the specified component for editing.
 
void openPlatformComponent (VLNV const &vlnv)
 Signal that user wants to open a platform component.
 
void openSystemDesign (VLNV const &vlnv)
 Signal that user wants to open a system for editing.
 

Public Member Functions

 LibraryHandler (const LibraryHandler &other)=delete
 No copying.
 
 ~LibraryHandler () final=default
 The destructor.
 
bool contains (VLNV const &vlnv) const final
 
QVector< QString > findErrorsInDocument (QSharedPointer< Document > document, QString const &path)
 
QList< VLNV > getAllVLNVs () const final
 
int getChildren (QList< VLNV > &list, VLNV const &vlnvToSearch) const final
 
void getDependencyFiles (VLNV const &vlnv, QStringList &list) final
 
QSharedPointer< Design > getDesign (VLNV const &hierarchyRef) final
 
VLNV getDesignVLNV (VLNV const &hierarchyRef) final
 
QString getDirectoryPath (VLNV const &vlnv) const final
 
VLNV::IPXactType getDocumentType (VLNV const &vlnv) final
 
HierarchyModelgetHierarchyModel ()
 
QSharedPointer< Document > getModel (VLNV const &vlnv) final
 
QSharedPointer< Document const > getModelReadOnly (VLNV const &vlnv) final
 
void getNeededVLNVs (VLNV const &vlnv, QList< VLNV > &list) final
 
int getOwners (QList< VLNV > &list, VLNV const &vlnvToSearch) const final
 
const QString getPath (VLNV const &vlnv) const final
 
LibraryTreeModelgetTreeModel ()
 
LibraryItem const * getTreeRoot () const final
 
bool isValid (VLNV const &vlnv) final
 
LibraryHandleroperator= (const LibraryHandler &other)=delete
 No assignment.
 
int referenceCount (VLNV const &vlnv) const final
 
void searchForIPXactFiles () final
 Search for IP-Xact files in the file system and add them to library.
 
void setOutputChannel (MessageMediator *messageChannel)
 
bool writeModelToFile (QSharedPointer< Document > model) final
 
bool writeModelToFile (QString const &path, QSharedPointer< Document > model) final
 
- Public Member Functions inherited from LibraryInterface
template<class T>
QSharedPointer< T > getModel (VLNV const &vlnv)
 
template<class T>
QSharedPointer< T const > getModelReadOnly (VLNV const &vlnv)
 

Static Public Member Functions

static LibraryHandlergetInstance ()
 The the instance of the library.
 

Detailed Description

LibraryHandler is the class that implements the services to manage the IP-XACT library.

Definition at line 45 of file LibraryHandler.h.

Constructor & Destructor Documentation

◆ LibraryHandler()

LibraryHandler::LibraryHandler ( const LibraryHandler & other)
delete

No copying.

◆ ~LibraryHandler()

LibraryHandler::~LibraryHandler ( )
finaldefault

The destructor.

Member Function Documentation

◆ addVLNV

void LibraryHandler::addVLNV ( VLNV const & vlnv)
signal

Inform tree model that a vlnv is to be added to the tree.

◆ beginSave

void LibraryHandler::beginSave ( )
slot

Call this function before saving several objects to library.

When calling this before saving and then using writeModelToFile() the library is not update between each save operation thus making the program faster.

Be sure to call endSave() after all items are saved.

◆ contains()

bool LibraryHandler::contains ( VLNV const & vlnv) const
finalvirtual

Checks if the library already contains the specified vlnv.

Parameters
[in]vlnvThe vlnv that is searched within the library.
Returns
True if the vlnv was found

Implements LibraryInterface.

◆ endSave

void LibraryHandler::endSave ( )
slot

End the saving operation and update the library.

This function must be called always after calling the beginSave().

◆ findErrorsInDocument()

QVector< QString > LibraryHandler::findErrorsInDocument ( QSharedPointer< Document > document,
QString const & path )

Find errors in the given document.

Parameters
[in]documentThe document to check.
[in]documentPathThe path to the document file on disk.
Returns
List of errors in the document.

◆ getAllVLNVs()

QList< VLNV > LibraryHandler::getAllVLNVs ( ) const
finalvirtual

Gets all the VLNVs currently in the library.

Returns
All known VLNVs in the library.

Implements LibraryInterface.

◆ getChildren()

int LibraryHandler::getChildren ( QList< VLNV > & list,
VLNV const & vlnvToSearch ) const
finalvirtual

Get the items that are needed by the specified item.

Parameters
[in]listQList where the search results are appended.
[in]vlnvToSearchIdentifies the item thats child-items are wanted.
Returns
int The number of found children.

Implements LibraryInterface.

◆ getDependencyFiles()

void LibraryHandler::getDependencyFiles ( VLNV const & vlnv,
QStringList & list )
finalvirtual

Get list of files that are needed by the given document.

This function returns a list of file paths that are converted as absolute file paths to the needed files. This function searches files only from this document, it does not search possible subcomponents.

Parameters
[in]vlnvReference to the vlnv that is used for the search.
[out]listThe files are appended to the list if they are not already on the list.

Implements LibraryInterface.

◆ getDesign()

QSharedPointer< Design > LibraryHandler::getDesign ( VLNV const & hierarchyRef)
finalvirtual

Get pointer to the design for a given hierarchy reference.

  • This function can be used by calling it with a hierarchy reference found if a component's hierarchical view. Function checks if the reference is directly for a design and returns the design pointer. If reference is for a configuration then the design vlnv is searched from the configuration and design pointer is returned. If design is not found then null pointer is returned.
Parameters
[in]hierarchyRefThe hierarchical reference obtained from component's view.
Returns
QSharedPointer<Design> The design.

Implements LibraryInterface.

◆ getDesignVLNV()

VLNV LibraryHandler::getDesignVLNV ( VLNV const & hierarchyRef)
finalvirtual

Get the VLNV of the design for a given hierarchy reference.

This function can be used by calling it with a hierarchy reference found if a component's hierarchical view. Function checks if the reference is directly for a design and returns the design vlnv. If reference is for a configuration then the design vlnv is searched from the configuration and design vlnv is returned. If design is not found then invalid vlnv is returned.

Parameters
[in]hierarchyRefThe hierarchical reference obtained from component's view.
Returns
VLNV The vlnv identifying the design object.

Implements LibraryInterface.

◆ getDirectoryPath()

QString LibraryHandler::getDirectoryPath ( VLNV const & vlnv) const
finalvirtual

Get the directory path to the specified IP-XACT document.

Parameters
[in]vlnvSpecifies the wanted IP-XACT document.
Returns
The directory path to the document. Does not contain the xml file name.

Implements LibraryInterface.

◆ getDocumentType()

VLNV::IPXactType LibraryHandler::getDocumentType ( VLNV const & vlnv)
finalvirtual

Get the document type of given vlnv.

If vlnv is not found in the library then VLNV::INVALID is returned.

Parameters
[in]vlnvSpecifies the document that's type is wanted.
Returns
Type of the document.

Implements LibraryInterface.

◆ getHierarchyModel()

HierarchyModel * LibraryHandler::getHierarchyModel ( )

◆ getInstance()

static LibraryHandler & LibraryHandler::getInstance ( )
static

The the instance of the library.

◆ getModel()

QSharedPointer< Document > LibraryHandler::getModel ( VLNV const & vlnv)
finalvirtual

Get a model that matches given VLNV.

This function can be called to get a model that matches an IP-Xact document.

Parameters
[in]vlnvIdentifies the desired document.
Returns
The model that matches the document.

Implements LibraryInterface.

◆ getModelReadOnly()

QSharedPointer< Document const > LibraryHandler::getModelReadOnly ( VLNV const & vlnv)
finalvirtual

Get a model that matches given VLNV for read-only access.

This function can be called to get a model that matches an IP-Xact document.

Parameters
[in]vlnvIdentifies the desired document.
Returns
The model that matches the document.

Implements LibraryInterface.

◆ getNeededVLNVs()

void LibraryHandler::getNeededVLNVs ( VLNV const & vlnv,
QList< VLNV > & list )
finalvirtual

Get list of vlnvs that are needed by given document.

This function takes an IP-Xact document and searches it and returns list of all vlnvs that are needed by that document. Function also searches all possible sub vlnvs that need other vlnvs and adds them to the list. The list doesn't contain single vlnv twice.

Parameters
[in]vlnvReference to the vlnv that is used as starting point for the search.
[out]listReference to the list where all vlnvs are added to.
Returns
List containing all vlnvs that are referenced in any of the documents.

Implements LibraryInterface.

◆ getOwners()

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

Get the items that have referenced the given vlnv in their meta data.

Parameters
[out]listThe search results.
[in]vlnvToSearchIdentifies the item to search for.
Returns
Number of owners found.

Implements LibraryInterface.

◆ getPath()

const QString LibraryHandler::getPath ( VLNV const & vlnv) const
finalvirtual

Get a path to the specified IP-Xact document.

Parameters
[in]vlnvSpecifies the wanted IP-Xact document.
Returns
The path to the document. If vlnv is not found then empty string is returned.

Implements LibraryInterface.

◆ getTreeModel()

LibraryTreeModel * LibraryHandler::getTreeModel ( )

◆ getTreeRoot()

LibraryItem const * LibraryHandler::getTreeRoot ( ) const
finalvirtual

Get the library tree's root item

Returns
The root item.

Implements LibraryInterface.

◆ isValid()

bool LibraryHandler::isValid ( VLNV const & vlnv)
finalvirtual

Check if the identified object is in valid state.

Parameters
[in]vlnvIdentifies the object to check.
Returns
bool True if the object was valid. False if invalid or object was not found in library.

Implements LibraryInterface.

◆ itemSelected

void LibraryHandler::itemSelected ( VLNV const & vlnv)
signal

Signal that the library item specified by vlnv is selected in one of the views.

◆ onCheckLibraryIntegrity

void LibraryHandler::onCheckLibraryIntegrity ( )
finalslot

Check the library items for validity

This function automatically removes the invalid library items.

◆ onEditItem

void LibraryHandler::onEditItem ( VLNV const & vlnv)
finalslot

Edit an item in the library

Parameters
[in]vlnvReference to the vlnv that identifies the object to edit.

◆ onOpenDesign

void LibraryHandler::onOpenDesign ( VLNV const & vlnv,
QString const & viewName )
finalslot

Open the specified component design

Parameters
[in]vlnvIdentifies the component that's design is wanted
[in]viewNameIdentifies the view for the design.

◆ onOpenMemoryDesign

void LibraryHandler::onOpenMemoryDesign ( VLNV const & vlnv,
QString const & activeView )
slot

Opens the memory design of the given HW design.

Parameters
[in]vlnvThe vlnv of the HW design.
[in]activeViewThe active view of the selected HW design.

◆ onOpenSWDesign

void LibraryHandler::onOpenSWDesign ( VLNV const & vlnv)
slot

Open the specified component SW design

Parameters
[in]vlnvIdentifies the component that's SW design is wanted

◆ onOpenSystemDesign

void LibraryHandler::onOpenSystemDesign ( VLNV const & vlnv)
slot

Open the specified component system design

Parameters
[in]vlnvIdentifies the component that's system design is wanted

◆ openAbsDef

void LibraryHandler::openAbsDef ( VLNV const & absDefVLNV)
signal

Signal that user wants to open specified abstraction for editing.

◆ openApiDefinition

void LibraryHandler::openApiDefinition ( VLNV const & vlnv)
signal

Signal that user wants to open specified API definition for editing.

◆ openBus

void LibraryHandler::openBus ( VLNV const & busDefVLNV)
signal

Signal that user wants to open specified bus for editing.

◆ openCatalog

void LibraryHandler::openCatalog ( VLNV const & vlnv)
signal

Signal that user wants to open specified catalog for editing.

◆ openComDefinition

void LibraryHandler::openComDefinition ( VLNV const & vlnv)
signal

Signal that user wants to open specified COM definition for editing.

◆ openComponent

void LibraryHandler::openComponent ( VLNV const & vlnv)
signal

Signal that user wants to open specified component for editing.

◆ openDesign

void LibraryHandler::openDesign ( VLNV const & vlnv,
const QString & viewName )
signal

Signal that user wants to open the specified component for editing.

◆ openMemoryDesign

void LibraryHandler::openMemoryDesign ( VLNV const & vlnv,
const QString & viewName )
signal

Signal that user wants to open the memory design of the specified component for editing.

◆ openPlatformComponent

void LibraryHandler::openPlatformComponent ( VLNV const & vlnv)
signal

Signal that user wants to open a platform component.

◆ openSWDesign

void LibraryHandler::openSWDesign ( VLNV const & vlnv,
QString const & viewName )
signal

Signal that user wants to open the specified software design for editing.

◆ openSystemDesign

void LibraryHandler::openSystemDesign ( VLNV const & vlnv,
QString const & viewName )
signal

Signal that user wants to open a system for editing.

◆ operator=()

LibraryHandler & LibraryHandler::operator= ( const LibraryHandler & other)
delete

No assignment.

◆ progressStatus

void LibraryHandler::progressStatus ( )
signal

◆ referenceCount()

int LibraryHandler::referenceCount ( VLNV const & vlnv) const
finalvirtual

Count how many times the given component is instantiated in the library.

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

Implements LibraryInterface.

◆ removeObject

void LibraryHandler::removeObject ( VLNV const & vlnv)
finalslot

Remove the specified library object from the library and file system.

This function does not ask user to verify the deletion, it just removes the object and it's xml file. If vlnv is for component the component's files are not removed.

Parameters
[in]vlnvIdentifies the object.

◆ removeObjects

void LibraryHandler::removeObjects ( const QList< VLNV > & vlnvList)
finalslot

Remove the specified library objects from the library and file system.

This function opens a dialog that asks user to confirm the deletion of the objects.

Parameters
[in]vlnvListIdentifies the objects to remove.

◆ removeVLNV

void LibraryHandler::removeVLNV ( VLNV const & vlnv)
signal

Inform tree model that a vlnv is to be removed from the tree.

◆ resetModel

void LibraryHandler::resetModel ( )
signal

Inform both models that the content must be reset.

◆ searchForIPXactFiles()

void LibraryHandler::searchForIPXactFiles ( )
finalvirtual

Search for IP-Xact files in the file system and add them to library.

Implements LibraryInterface.

◆ setOutputChannel()

void LibraryHandler::setOutputChannel ( MessageMediator * messageChannel)

◆ updatedVLNV

void LibraryHandler::updatedVLNV ( VLNV const & vlnv)
signal

Inform that object has been updated.

◆ writeModelToFile() [1/2]

bool LibraryHandler::writeModelToFile ( QSharedPointer< Document > model)
finalvirtual

Write the already registered model to file system.

This function demands that the model is already part of the library and it's file path can be found. The changes made to the model are written to the previous file so the model can not be restored to it's previous state after this operation.

Parameters
[in]modelThe model to be written.
Returns
True if the model was in valid state and was successfully written.

Implements LibraryInterface.

◆ writeModelToFile() [2/2]

bool LibraryHandler::writeModelToFile ( QString const & path,
QSharedPointer< Document > model )
finalvirtual

Write the model to file system to given file path

This function takes the given directory path and writes the given model to that directory. The path must not contain the file name. If file already exists in file system it is written over.

When model is saved using this function it is not necessary to call onItemSaved() because it is called by this function.

Parameters
[in]pathDirectory path that specifies the directory to save to file into.
[in]modelThe library component that is written.
Returns
True if the model was in valid state and was successfully written.

Implements LibraryInterface.


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