Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
LibraryInterface Class Referenceabstract

LibraryInterface defines an interface to operate the IP-XACT-library. More...

#include <LibraryInterface.h>

Inheritance diagram for LibraryInterface:
LibraryHandler

Public Slots

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 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

virtual bool contains (VLNV const &vlnv) const =0
 
virtual QList< VLNV > getAllVLNVs () const =0
 
virtual int getChildren (QList< VLNV > &list, VLNV const &vlnvToSearch) const =0
 
virtual void getDependencyFiles (VLNV const &vlnv, QStringList &list)=0
 
virtual QSharedPointer< Design > getDesign (VLNV const &hierarchyRef)=0
 
virtual VLNV getDesignVLNV (VLNV const &hierarchyRef)=0
 
virtual QString getDirectoryPath (VLNV const &vlnv) const =0
 
virtual VLNV::IPXactType getDocumentType (VLNV const &vlnv)=0
 
template<class T>
QSharedPointer< T > getModel (VLNV const &vlnv)
 
virtual QSharedPointer< Document > getModel (VLNV const &vlnv)=0
 
template<class T>
QSharedPointer< T const > getModelReadOnly (VLNV const &vlnv)
 
virtual QSharedPointer< Document const > getModelReadOnly (VLNV const &vlnv)=0
 
virtual void getNeededVLNVs (VLNV const &vlnv, QList< VLNV > &list)=0
 
virtual int getOwners (QList< VLNV > &list, VLNV const &vlnvToSearch) const =0
 
virtual const QString getPath (VLNV const &vlnv) const =0
 
virtual LibraryItem const * getTreeRoot () const =0
 
virtual bool isValid (VLNV const &vlnv)=0
 
virtual int referenceCount (VLNV const &vlnv) const =0
 
virtual void searchForIPXactFiles ()=0
 Search for IP-XACT files in the file system and add them to library.
 
virtual bool writeModelToFile (QSharedPointer< Document > model)=0
 
virtual bool writeModelToFile (QString const &path, QSharedPointer< Document > model)=0
 

Detailed Description

LibraryInterface defines an interface to operate the IP-XACT-library.

Definition at line 27 of file LibraryInterface.h.

Member Function Documentation

◆ beginSave

virtual void LibraryInterface::beginSave ( )
pure virtualslot

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()

virtual bool LibraryInterface::contains ( VLNV const & vlnv) const
pure virtual

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, otherwise false.

Implemented in LibraryHandler.

◆ createAbsDef

void LibraryInterface::createAbsDef ( VLNV const & busDefVLNV,
QString const & directory,
bool disableBusDef )
signal

Signal that user wants to create a new abstraction definition for given bus definition.

◆ endSave

virtual void LibraryInterface::endSave ( )
pure virtualslot

End the saving operation and update the library.

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

◆ getAllVLNVs()

virtual QList< VLNV > LibraryInterface::getAllVLNVs ( ) const
pure virtual

Gets all the VLNVs currently in the library.

Returns
All known VLNVs in the library.

Implemented in LibraryHandler.

◆ getChildren()

virtual int LibraryInterface::getChildren ( QList< VLNV > & list,
VLNV const & vlnvToSearch ) const
pure virtual

Get the items that are needed by the specified item.

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

Implemented in LibraryHandler.

◆ getDependencyFiles()

virtual void LibraryInterface::getDependencyFiles ( VLNV const & vlnv,
QStringList & list )
pure virtual

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]vlnvThe VLNV that is used for the search.
[out]listThe files are appended to the list if they are not already on the list.

Implemented in LibraryHandler.

◆ getDesign()

virtual QSharedPointer< Design > LibraryInterface::getDesign ( VLNV const & hierarchyRef)
pure virtual

Get 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
The design.

Implemented in LibraryHandler.

◆ getDesignVLNV()

virtual VLNV LibraryInterface::getDesignVLNV ( VLNV const & hierarchyRef)
pure virtual

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

This function can be used by calling it with a hierarchy reference found in 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.

Implemented in LibraryHandler.

◆ getDirectoryPath()

virtual QString LibraryInterface::getDirectoryPath ( VLNV const & vlnv) const
pure virtual

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.

Implemented in LibraryHandler.

◆ getDocumentType()

virtual VLNV::IPXactType LibraryInterface::getDocumentType ( VLNV const & vlnv)
pure virtual

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
The type of the document.

Implemented in LibraryHandler.

◆ getModel() [1/2]

template<class T>
QSharedPointer< T > LibraryInterface::getModel ( VLNV const & vlnv)
inline

Convenience function for getting the model that matches given VLNV, if the type is known beforehand.

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

Definition at line 48 of file LibraryInterface.h.

◆ getModel() [2/2]

virtual QSharedPointer< Document > LibraryInterface::getModel ( VLNV const & vlnv)
pure virtual

Get a model that matches given VLNV. Must be used when changes are made to the document. The provided document is a copy, meaning that it must be explicitly saved after the changes.

Parameters
[in]vlnvIdentifies the desired document.
Returns
The model that matches the document. The ownership of the object remains on Library Handler.

Implemented in LibraryHandler.

◆ getModelReadOnly() [1/2]

template<class T>
QSharedPointer< T const > LibraryInterface::getModelReadOnly ( VLNV const & vlnv)
inline

Convenience function for getting the model that matches given VLNV, if the type is known beforehand.

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

Definition at line 69 of file LibraryInterface.h.

◆ getModelReadOnly() [2/2]

virtual QSharedPointer< Document const > LibraryInterface::getModelReadOnly ( VLNV const & vlnv)
pure virtual

Get a model that matches given VLNV for read-only access. May be used when no changes are to be made for the document.

Parameters
[in]vlnvIdentifies the desired document.
Returns
The model that matches the document. The ownership of the object remains on Library Handler.

Implemented in LibraryHandler.

◆ getNeededVLNVs()

virtual void LibraryInterface::getNeededVLNVs ( VLNV const & vlnv,
QList< VLNV > & list )
pure virtual

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]vlnvThe VLNV that is used as starting point for the search.
[out]listThe list where all VLNVs are added to.

Implemented in LibraryHandler.

◆ getOwners()

virtual int LibraryInterface::getOwners ( QList< VLNV > & list,
VLNV const & vlnvToSearch ) const
pure virtual

Get the components that have instantiated the given vlnv in their design.

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

Implemented in LibraryHandler.

◆ getPath()

virtual const QString LibraryInterface::getPath ( VLNV const & vlnv) const
pure virtual

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.

Implemented in LibraryHandler.

◆ getTreeRoot()

virtual LibraryItem const * LibraryInterface::getTreeRoot ( ) const
pure virtual

Returns const-pointer to the library tree's root item

Implemented in LibraryHandler.

◆ isValid()

virtual bool LibraryInterface::isValid ( VLNV const & vlnv)
pure virtual

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.

Implemented in LibraryHandler.

◆ itemSelected

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

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

◆ onCheckLibraryIntegrity

virtual void LibraryInterface::onCheckLibraryIntegrity ( )
pure virtualslot

Check the library items for validity

@remark This function automatically removes the invalid library items.

◆ onEditItem

virtual void LibraryInterface::onEditItem ( VLNV const & vlnv)
pure virtualslot

Edit an item in the library

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

◆ onOpenDesign

virtual void LibraryInterface::onOpenDesign ( VLNV const & vlnv,
QString const & viewName )
pure virtualslot

Open the specified component design

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

◆ openBus

void LibraryInterface::openBus ( VLNV const & busDefVLNV,
VLNV const & absDefVLNV,
bool disableBusDef )
signal

Signal that user wants to open specified bus for editing.

◆ openComponent

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

Signal that user wants to open specified component for editing.

◆ openDesign

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

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

◆ openPlatformComponent

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

Signal that user wants to open a platform component.

◆ openSystemDesign

void LibraryInterface::openSystemDesign ( VLNV const & vlnv)
signal

Signal that user wants to open a system for editing.

◆ referenceCount()

virtual int LibraryInterface::referenceCount ( VLNV const & vlnv) const
pure virtual

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.

Implemented in LibraryHandler.

◆ removeObject

virtual void LibraryInterface::removeObject ( VLNV const & vlnv)
pure virtualslot

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

virtual void LibraryInterface::removeObjects ( const QList< VLNV > & vlnvList)
pure virtualslot

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.

◆ searchForIPXactFiles()

virtual void LibraryInterface::searchForIPXactFiles ( )
pure virtual

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

Implemented in LibraryHandler.

◆ writeModelToFile() [1/2]

virtual bool LibraryInterface::writeModelToFile ( QSharedPointer< Document > model)
pure virtual

Write the already registered model to file system.

Parameters
[in]modelThemodel to be written.
Returns
True if the model was in valid state and was successfully written.
Remarks
The model must be already part of the library and it's file path can be found.
This operation cannot be undone.

Implemented in LibraryHandler.

◆ writeModelToFile() [2/2]

virtual bool LibraryInterface::writeModelToFile ( QString const & path,
QSharedPointer< Document > model )
pure virtual

Write the model to file system to given file path.

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.
Remarks
The path must not contain the file name.
If file already exists in file system it is overwritten.
It is not necessary to call onItemSaved() because it is called by this function.

Implemented in LibraryHandler.


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