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

Interface for editing registers. More...

#include <RegisterInterface.h>

Inheritance diagram for RegisterInterface:
ParameterizableInterface NameGroupInterface CommonInterface

Public Member Functions

 RegisterInterface (QSharedPointer< RegisterValidator > validator, QSharedPointer< ExpressionParser > expressionParser, QSharedPointer< ExpressionFormatter > expressionFormatter, FieldInterface *subInterface, AccessPolicyInterface *accessPolicyInterface)
 
virtual ~RegisterInterface ()=default
 
bool addAccessPolicy (std::string const &registerName)
 
void addRegister (int const &row, int const &dataIndex, std::string const &newRegisterName=std::string(""))
 
void addRegister (std::string const &newRegisterName=std::string(""))
 
void copyRows (std::vector< int > const &selectedRows)
 
AccessTypes::Access getAccess (std::string const &registerName) const
 
int getAccessPolicyCount (std::string const &registerName) const
 
AccessPolicyInterfacegetAccessPolicyInterface () const
 
std::string getAccessString (std::string const &registerName, bool getAccessPolicyAccess=false) const
 
virtual int getAllReferencesToIdInItem (const std::string &itemName, std::string const &valueID) const override final
 
std::string getDimensionExpression (std::string const &registerName) const
 
std::string getDimensionFormattedExpression (std::string const &registerName) const
 
std::string getDimensionValue (std::string const &registerName, int const &baseNumber=0) const
 
std::vector< std::string > getExpressionsInSelectedRegisters (std::vector< std::string > const &registerNames) const
 
std::string getIndexedItemName (int itemIndex) const final
 
std::string getIsPresentExpression (std::string const &registerName) const
 
std::string getIsPresentFormattedExpression (std::string const &registerName) const
 
std::string getIsPresentValue (std::string const &registerName, int const &baseNumber=0) const
 
virtual int getItemIndex (std::string const &itemName) const override final
 
virtual std::vector< std::string > getItemNames () const override final
 
std::string getOffsetExpression (std::string const &registerName) const
 
std::string getOffsetFormattedExpression (std::string const &registerName) const
 
std::string getOffsetValue (std::string const &registerName, int const &baseNumber=0) const
 
int getPasteRowCount () const
 
std::string getSizeExpression (std::string const &registerName) const
 
std::string getSizeFormattedExpression (std::string const &registerName) const
 
std::string getSizeValue (std::string const &registerName, int const &baseNumber=0) const
 
FieldInterfacegetSubInterface () const
 
std::string getVolatile (std::string const &registerName) const
 
bool hasValidDimension (std::string const &registerName) const
 
bool hasValidIsPresent (std::string const &registerName) const
 
bool hasValidOffset (std::string const &registerName) const
 
bool hasValidSize (std::string const &registerName) const
 
int indexInRegisterData (int const &index) const
 
virtual int itemCount () const override final
 
virtual bool itemHasValidName (std::string const &itemName) const override final
 
std::vector< std::string > pasteRows ()
 
int registerDataCount () const
 
bool removeRegister (std::string const &registerName, int const &dataIndex)
 
bool setAccess (std::string const &registerName, std::string const &newAccess, bool setAccessPolicyAccess=false)
 
void setAddressUnitBits (int const &newAddressUnitbits)
 
bool setDimension (std::string const &registerName, std::string const &newDimension)
 
bool setIsPresent (std::string const &registerName, std::string const &newIsPresent)
 
virtual bool setName (std::string const &currentName, std::string const &newName) override final
 
bool setOffset (std::string const &registerName, std::string const &newOffset)
 
void setRegisters (QSharedPointer< QList< QSharedPointer< RegisterBase > > > newRegisterData)
 
bool setSize (std::string const &registerName, std::string const &newSize)
 
bool setVolatile (std::string const &registerName, std::string const &newVolatile)
 
virtual bool validateItems () const override final
 
- Public Member Functions inherited from ParameterizableInterface
 ParameterizableInterface (const ParameterizableInterface &other)=delete
 No copying. No assignment.
 
 ParameterizableInterface (QSharedPointer< ExpressionParser > expressionParser, QSharedPointer< ExpressionFormatter > expressionFormatter)
 
virtual ~ParameterizableInterface ()=default
 
ParameterizableInterfaceoperator= (const ParameterizableInterface &other)=delete
 
- Public Member Functions inherited from NameGroupInterface
 NameGroupInterface ()
 
 NameGroupInterface (const NameGroupInterface &other)=delete
 No copying. No assignment.
 
virtual ~NameGroupInterface ()=default
 
virtual std::string getDescription (std::string const &itemName) const
 
virtual std::string getDisplayName (std::string const &itemName) const
 
virtual std::string getShortDescription (std::string const &itemName) const
 
NameGroupInterfaceoperator= (const NameGroupInterface &other)=delete
 
virtual bool setDescription (std::string const &itemName, std::string const &newDescription)
 
virtual bool setDisplayName (std::string const &itemName, std::string const &newDisplayName) const
 
bool setShortDescription (std::string const &itemName, std::string const &newShortDescription) const
 
- Public Member Functions inherited from CommonInterface
 CommonInterface ()=default
 
 CommonInterface (const CommonInterface &other)=delete
 No copying. No assignment.
 
virtual ~CommonInterface ()=default
 
CommonInterfaceoperator= (const CommonInterface &other)=delete
 

Additional Inherited Members

- Protected Member Functions inherited from ParameterizableInterface
QString formattedValueFor (QString const &expression) const
 
QString parseExpressionToBaseNumber (QString const &expression, unsigned int const &baseNumber, bool *expressionIsValid=nullptr) const
 
QString parseExpressionToDecimal (QString const &expression, bool *expressionIsValid=nullptr) const
 
- Protected Member Functions inherited from CommonInterface
QString getUniqueName (std::string const &newName, std::string const &itemTypeName) const
 
bool nameHasChanged (std::string const &newName, std::string const &oldName) const
 

Detailed Description

Interface for editing registers.

Definition at line 34 of file RegisterInterface.h.

Constructor & Destructor Documentation

◆ RegisterInterface()

RegisterInterface::RegisterInterface ( QSharedPointer< RegisterValidator > validator,
QSharedPointer< ExpressionParser > expressionParser,
QSharedPointer< ExpressionFormatter > expressionFormatter,
FieldInterface * subInterface,
AccessPolicyInterface * accessPolicyInterface )

The constructor.

Parameters
[in]validatorValidator for registers.
[in]expressionParserParser for expressions.
[in]expressionFormatterFormatter for expressions.
[in]subInterfaceInterface for accessing fields.

◆ ~RegisterInterface()

virtual RegisterInterface::~RegisterInterface ( )
virtualdefault

The destructor.

Member Function Documentation

◆ addAccessPolicy()

bool RegisterInterface::addAccessPolicy ( std::string const & registerName)

Adds a new access policy to the selected register.

Parameters
[in]registerNameThe selected register.
Returns
True, if operation was successful, otherwise false.

◆ addRegister() [1/2]

void RegisterInterface::addRegister ( int const & row,
int const & dataIndex,
std::string const & newRegisterName = std::string("") )

Add a new register, inserting it to position specified by row and dataIndex.

Parameters
[in]rowRow of the new register.
[in]dataIndexIndex of the new register in the register data.
[in]newRegisterNameName of the new register.

◆ addRegister() [2/2]

void RegisterInterface::addRegister ( std::string const & newRegisterName = std::string(""))

Add a new register. This overload should be preferred when using Python.

Parameters
[in]newRegisterNameName of the new register.

◆ copyRows()

void RegisterInterface::copyRows ( std::vector< int > const & selectedRows)

Copy the selected registers.

Parameters
[in]selectedRowsIndexes of the selected registers.

◆ getAccess()

AccessTypes::Access RegisterInterface::getAccess ( std::string const & registerName) const

Get the access of the selected register or access policy given by the access policy index.

Parameters
[in]registerNameName of the selected register.
[in]accessPolicyIndexThe index of the selected access policy.
Returns
The access value of the selected register.

◆ getAccessPolicyCount()

int RegisterInterface::getAccessPolicyCount ( std::string const & registerName) const

Get the number of access policies for a given register.

Parameters
[in]registerNameThe name of the register to get the number off access policies of.
Returns
The number of access policies for the given register.

◆ getAccessPolicyInterface()

AccessPolicyInterface * RegisterInterface::getAccessPolicyInterface ( ) const

Get the access policy interface.

@return Interface for accessing the register access policies.

◆ getAccessString()

std::string RegisterInterface::getAccessString ( std::string const & registerName,
bool getAccessPolicyAccess = false ) const

Get the access string of the selected register or first access policy.

Parameters
[in]registerNameName of the selected register.
[in]getAccessPolicyAccessFlag indicating if access is fetched from access policy or directly from register. Access is fetched from first access policy, if true.
Returns
The access string of the selected register.

◆ getAllReferencesToIdInItem()

virtual int RegisterInterface::getAllReferencesToIdInItem ( const std::string & itemName,
std::string const & valueID ) const
finaloverridevirtual

Calculate all the references to the selected ID in the selected item.

Parameters
[in]itemNameName of the selected item.
[in]valueIDThe selected ID.
Returns
Number of references to the selected ID in the selected item.

Implements ParameterizableInterface.

◆ getDimensionExpression()

std::string RegisterInterface::getDimensionExpression ( std::string const & registerName) const

Get the dimension expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Dimension expression of the selected register.

◆ getDimensionFormattedExpression()

std::string RegisterInterface::getDimensionFormattedExpression ( std::string const & registerName) const

Get the formatted dimension expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Formatted dimension expression of the selected register.

◆ getDimensionValue()

std::string RegisterInterface::getDimensionValue ( std::string const & registerName,
int const & baseNumber = 0 ) const

Get the calculated dimension value of the selected register.

Parameters
[in]registerNameName of the selected register.
[in]baseNumberBase for displaying the value.
Returns
Calculated dimension value of the selected register.

◆ getExpressionsInSelectedRegisters()

std::vector< std::string > RegisterInterface::getExpressionsInSelectedRegisters ( std::vector< std::string > const & registerNames) const

Get the expressions in the selected registers.

Parameters
[in]registerNamesNames of the selected registers.
Returns
The expressions of the selected registers.

◆ getIndexedItemName()

std::string RegisterInterface::getIndexedItemName ( int itemIndex) const
finalvirtual

Get name of the indexed item.

Parameters
[in]itemIndexIndex of the selected item.
Returns
Name of the selected item.

Implements NameGroupInterface.

◆ getIsPresentExpression()

std::string RegisterInterface::getIsPresentExpression ( std::string const & registerName) const

Get the is present expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Is present expression of the selected register.

◆ getIsPresentFormattedExpression()

std::string RegisterInterface::getIsPresentFormattedExpression ( std::string const & registerName) const

Get the formatted is present expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Formatted is present expression of the selected register.

◆ getIsPresentValue()

std::string RegisterInterface::getIsPresentValue ( std::string const & registerName,
int const & baseNumber = 0 ) const

Get the calculated is present value of the selected register.

Parameters
[in]registerNameName of the selected register.
[in]baseNumberBase for displaying the value.
Returns
Calculated is present value of the selected register.

◆ getItemIndex()

virtual int RegisterInterface::getItemIndex ( std::string const & itemName) const
finaloverridevirtual

Get index of the selected item.

Parameters
[in]itemNameName of the selected item.
Returns
Index of the selected item.

Implements NameGroupInterface.

◆ getItemNames()

virtual std::vector< std::string > RegisterInterface::getItemNames ( ) const
finaloverridevirtual

Get the names of the available items.

Returns
Names of the available items.

Implements CommonInterface.

◆ getOffsetExpression()

std::string RegisterInterface::getOffsetExpression ( std::string const & registerName) const

Get the offset expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Offset expression of the selected register.

◆ getOffsetFormattedExpression()

std::string RegisterInterface::getOffsetFormattedExpression ( std::string const & registerName) const

Get the formatted offset expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Formatted offset expression of the selected register.

◆ getOffsetValue()

std::string RegisterInterface::getOffsetValue ( std::string const & registerName,
int const & baseNumber = 0 ) const

Get the calculated offset value of the selected register.

Parameters
[in]registerNameName of the selected register.
[in]baseNumberBase for displaying the value.
Returns
Calculated offset value of the selected register.

◆ getPasteRowCount()

int RegisterInterface::getPasteRowCount ( ) const

Get the number of pasted registers.

Returns
Number of the pasted registers.

◆ getSizeExpression()

std::string RegisterInterface::getSizeExpression ( std::string const & registerName) const

Get the size expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Size expression of the selected register.

◆ getSizeFormattedExpression()

std::string RegisterInterface::getSizeFormattedExpression ( std::string const & registerName) const

Get the formatted size expression of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
Formatted size expression of the selected register.

◆ getSizeValue()

std::string RegisterInterface::getSizeValue ( std::string const & registerName,
int const & baseNumber = 0 ) const

Get the calculated size value of the selected register.

Parameters
[in]registerNameName of the selected register.
[in]baseNumberBase for displaying the value.
Returns
Calculated size value of the selected register.

◆ getSubInterface()

FieldInterface * RegisterInterface::getSubInterface ( ) const

Get the sub interface.

Returns
Interface for accessing fields.

◆ getVolatile()

std::string RegisterInterface::getVolatile ( std::string const & registerName) const

Get the volatile of the selected register.

Parameters
[in]registerNameName of the selected register.
Returns
The volatile value of the selected register.

◆ hasValidDimension()

bool RegisterInterface::hasValidDimension ( std::string const & registerName) const

Check if the selected register has a valid dimension.

Parameters
[in]registerNameName of the selected register.
Returns
True, if the dimension is valid, false otherwise.

◆ hasValidIsPresent()

bool RegisterInterface::hasValidIsPresent ( std::string const & registerName) const

Check if the selected register has a valid is present value.

Parameters
[in]registerNameName of the selected register.
Returns
True, if the is present value is valid, false otherwise.

◆ hasValidOffset()

bool RegisterInterface::hasValidOffset ( std::string const & registerName) const

Check if the selected register has a valid offset.

Parameters
[in]registerNameName of the selected register.
Returns
True, if the offset is valid, false otherwise.

◆ hasValidSize()

bool RegisterInterface::hasValidSize ( std::string const & registerName) const

Check if the selected register has a valid size.

Parameters
[in]registerNameName of the selected register.
Returns
True, if the size is valid, false otherwise.

◆ indexInRegisterData()

int RegisterInterface::indexInRegisterData ( int const & index) const

Get the selected index as the index of register data.

Parameters
[in]indexThe selected index.
Returns
The selected index transformed to register data index.

◆ itemCount()

virtual int RegisterInterface::itemCount ( ) const
finaloverridevirtual

Get the number of available items.

Returns
Number of available items.

Implements CommonInterface.

◆ itemHasValidName()

virtual bool RegisterInterface::itemHasValidName ( std::string const & itemName) const
finaloverridevirtual

Check if the selected item has a valid name.

Parameters
[in]itemNameName of the selected item.
Returns
True, if the name is valid, false otherwise.

Implements NameGroupInterface.

◆ pasteRows()

std::vector< std::string > RegisterInterface::pasteRows ( )

Paste the selected registers.

Returns
Names of the pasted registers.

◆ registerDataCount()

int RegisterInterface::registerDataCount ( ) const

Get the number of register data.

Returns
Number of register data.

◆ removeRegister()

bool RegisterInterface::removeRegister ( std::string const & registerName,
int const & dataIndex )

Remove the selected register.

Parameters
[in]registerNameName of the selected register.
[in]dataIndexIndex of the removed register in the register data.
Returns
True, if successful, false otherwise.

◆ setAccess()

bool RegisterInterface::setAccess ( std::string const & registerName,
std::string const & newAccess,
bool setAccessPolicyAccess = false )

Set the access value for the selected register or its access policy given by the access policy index.

Parameters
[in]registerNameName of the selected register.
[in]newAccessThe new access value.
[in]getAccessPolicyAccessFlag indicating if access is set to access policy or directly to register. Access is set to first access policy, if true.
Returns
True, if successful, false otherwise.

◆ setAddressUnitBits()

void RegisterInterface::setAddressUnitBits ( int const & newAddressUnitbits)

Change the value for address unit bits.

Parameters
[in]newAddressUnitbitsThe new value for address unit bits.

◆ setDimension()

bool RegisterInterface::setDimension ( std::string const & registerName,
std::string const & newDimension )

Set a new dimension value for the selected register.

Parameters
[in]registerNameName of the selected register.
[in]newDimensionNew dimension value.
Returns
True, if successful, false otherwise.

◆ setIsPresent()

bool RegisterInterface::setIsPresent ( std::string const & registerName,
std::string const & newIsPresent )

Set a new is present value for the selected register.

Parameters
[in]registerNameName of the selected register.
[in]newIsPresentNew is present value.
Returns
True, if successful, false otherwise.

◆ setName()

virtual bool RegisterInterface::setName ( std::string const & currentName,
std::string const & newName )
finaloverridevirtual

Set a new name for the selected item.

Parameters
[in]currentNameName of the selected item.
[in]newNameNew name for the item.
Returns
True, if successful, false otherwise.

Implements NameGroupInterface.

◆ setOffset()

bool RegisterInterface::setOffset ( std::string const & registerName,
std::string const & newOffset )

Set a new offset value for the selected register.

Parameters
[in]registerNameName of the selected register.
[in]newOffsetNew offset value.
Returns
True, if successful, false otherwise.

◆ setRegisters()

void RegisterInterface::setRegisters ( QSharedPointer< QList< QSharedPointer< RegisterBase > > > newRegisterData)

Set available registers.

Parameters
[in]newRegisterDataThe new register data.

◆ setSize()

bool RegisterInterface::setSize ( std::string const & registerName,
std::string const & newSize )

Set a new size value for the selected register.

Parameters
[in]registerNameName of the selected register.
[in]newSizeNew size value.
Returns
True, if successful, false otherwise.

◆ setVolatile()

bool RegisterInterface::setVolatile ( std::string const & registerName,
std::string const & newVolatile )

Set the volatile for the selected register.

Parameters
[in]registerNameName of the selected register.
[in]newVolatileThe new volatile value.
Returns
True, if successful, false otherwise.

◆ validateItems()

virtual bool RegisterInterface::validateItems ( ) const
finaloverridevirtual

Validates the contained items.

Returns
True, if all the ports are valid, false otherwise.

Implements CommonInterface.


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