Kactus2
Kactus2 reference guide
Loading...
Searching...
No Matches
PortMapInterface.h
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2// File: PortMapInterface.h
3//-----------------------------------------------------------------------------
4// Project: Kactus2
5// Author: Mikko Teuho
6// Date: 22.10.2020
7//
8// Description:
9// Interface for editing port maps.
10//-----------------------------------------------------------------------------
11
12#ifndef PORTMAPINTERFACE_H
13#define PORTMAPINTERFACE_H
14
15#include <CommonInterface.h>
17
18#include <IPXACTmodels/common/PresenceTypes.h>
19#include <IPXACTmodels/Component/PortMap.h>
20#include <IPXACTmodels/Component/Port.h>
21#include <IPXACTmodels/generaldeclarations.h>
22
23#include "KactusAPI/KactusAPIGlobal.h"
24
25class PortMap;
26class PortMapValidator;
27class PortAbstraction;
28class AbstractionDefinition;
29class AbstractionType;
30class Component;
31class PortsInterface;
33
34//-----------------------------------------------------------------------------
36//-----------------------------------------------------------------------------
38{
39
40public:
41
51 PortMapInterface(QSharedPointer<PortMapValidator> validator,
52 QSharedPointer<ExpressionParser> expressionParser,
53 QSharedPointer<ExpressionFormatter> expressionFormatter,
54 PortsInterface* physicalPortInterface,
55 PortAbstractionInterface* logicalPortInterface);
56
60 virtual ~PortMapInterface() = default;
61
67 void setupAbstractionDefinition(QSharedPointer<AbstractionDefinition const> absDef);
68
74 void setupPhysicalPorts(Port::List ports);
75
81 virtual void setupPortMaps(QSharedPointer<AbstractionType> abstractionType);
82
88 void setupBusMode(General::InterfaceMode busMode);
89
95 void setupSystemGroup(QString const& systemGroup);
96
104 virtual std::string getIndexedItemName(int const& itemIndex) const;
105
111 virtual int itemCount() const override final;
112
118 virtual std::vector<std::string> getItemNames() const override final;
119
127 std::string getLogicalPortName(int const& portMapIndex) const;
128
137 bool setLogicalPort(int const& portMapIndex, std::string const& newName);
138
146 bool hasPhysicalPort(int const& portMapIndex) const;
147
155 std::string getPhysicalPortName(int const& portMapIndex) const;
156
165 bool setPhysicalPort(int const& portMapIndex, std::string const& newPhysicalName);
166
174 std::string getLogicalPresence(int const& portMapIndex);
175
183 std::string getLogicalPresenceWithLogicalPort(std::string const& logicalName);
184
192 std::string getInvertString(int const& portMapIndex) const;
193
201 BooleanValue getInvertValue(int const& portMapIndex) const;
202
210 bool getInvertBool(int const& portMapIndex) const;
211
220 bool setInvertValue(int const& portMapIndex, bool newInvertValue) const;
221
229 std::string getIsInformativeString(int const& portMapIndex) const;
230
238 bool getIsInformativeValue(int const& portMapIndex) const;
239
247 bool setIsInformativeValue(int const& portMapIndex, bool newIsInformativeValue) const;
248
257 std::string getLogicalTieOffValue(int const& portMapIndex, int const& baseNumber = 0) const;
258
266 std::string getLogicalTieOffFormattedExpression(int const& portMapIndex) const;
267
275 std::string getLogicalTieOffExpression(int const& portMapIndex) const;
276
285 bool setLogicalTieOff(int const& portMapIndex, std::string const& newTieOff);
286
295 std::string getLogicalLeftBoundValue(int const& portMapIndex, int const& baseNumber = 0) const;
296
304 std::string getLogicalLeftBoundFormattedExpression(int const& portMapIndex) const;
305
313 std::string getLogicalLeftBoundExpression(int const& portMapIndex) const;
314
323 bool setLogicalLeftBound(int const& portMapIndex, std::string const& newLogicalLeft);
324
333 std::string getLogicalRightBoundValue(int const& portMapIndex, int const& baseNumber = 0) const;
334
342 std::string getLogicalRightBoundFormattedExpression(int const& portMapIndex) const;
343
351 std::string getLogicalRightBoundExpression(int const& portMapIndex) const;
352
361 bool setLogicalRightBound(int const& portMapIndex, std::string const& newLogicalRight);
362
371 std::string getPhysicalLeftBoundValue(int const& portMapIndex, int const& baseNumber = 0) const;
372
380 std::string getPhysicalLeftBoundFormattedExpression(int const& portMapIndex) const;
381
389 std::string getPhysicalLeftBoundExpression(int const& portMapIndex) const;
390
399 bool setPhysicalLeftBound(int const& portMapIndex, std::string const& newPhysicalLeft);
400
409 std::string getPhysicalRightBoundValue(int const& portMapIndex, int const& baseNumber = 0) const;
410
418 std::string getPhysicalRightBoundFormattedExpression(int const& portMapIndex) const;
419
427 std::string getPhysicalRightBoundExpression(int const& portMapIndex) const;
428
437 bool setPhysicalRightBound(int const& portMapIndex, std::string const& newPhysicalRight);
438
446 std::string getLogicalPortIconPath(int const& portMapIndex) const;
447
455 std::string getPhysicalPortIconPath(int const& portMapIndex) const;
456
464 bool logicalPortExists(int const& portMapIndex) const;
465
474 virtual int getAllReferencesToIdInItem(const std::string& itemName, std::string const& valueID) const override
475 final;
476
484 std::vector<std::string> getExpressionsInSelectedPortMap(int const& portMapIndex) const;
485
491 virtual bool validateItems() const override final;
492
500 bool logicalPortIsValid(int const& portMapIndex) const;
501
509 bool physicalPortIsValid(int const& portMapIndex) const;
510
518 bool physicalMappingIsValid(int const& portMapIndex) const;
519
527 bool connectedPortsHaveValidPortTypes(int const& portMapIndex) const;
528
536 bool connectedPortsHaveValidDirections(int const& portMapIndex) const;
537
545 bool connectedPortsHaveValidInitiatives(int const& portMapIndex) const;
546
554 bool connectedPortsHaveSameRange(int const& portMapIndex) const;
555
563 bool tieOffIsValid(int const& portMapIndex) const;
564
572 bool logicalPortHasValidRange(int const& portMapIndex) const;
573
582 bool connectPorts(std::string const& logicalPortName, std::string const& physicalPortName);
583
589 void addPortMap(int const& row);
590
598 bool removePortMap(int const& portMapIndex);
599
607 std::vector<std::string> removeAllPortMapsFromLogicalPort(std::string const& logicalPortName);
608
616 PortMap* getPortMapPointer(int const& portMapIndex) const;
617
624
631
636
641
646
652 General::InterfaceMode getInterfaceMode() const;
653
659 std::string getSystemGroup() const;
660
661private:
662
670 QSharedPointer<PortMap> getUnconnectedPortMap(std::string const& logicalPortName) const;
671
679 QSharedPointer<PortMap> getPortMap(int const& portMapIndex) const;
680
688 bool removeEmptyLogicalPort(QSharedPointer<PortMap> editedPortMap);
689
695 bool removeEmptyRange(QSharedPointer<PortMap::LogicalPort> editedPortLogical);
696
704 bool removeEmptyPhysicalPort(QSharedPointer<PortMap> editedPortMap);
705
713 bool removeEmptyPhysicalPartSelect(QSharedPointer<PortMap::PhysicalPort> physicalPort);
714
722 QSharedPointer<PartSelect> getPhysicalPartSelect(int const& portMapIndex);
723
729 void createPortMapsWithPresence(int presence);
730
738 bool portMapExistsForLogicalSignal(std::string const& signalName) const;
739
740 //-----------------------------------------------------------------------------
741 // Data.
742 //-----------------------------------------------------------------------------
743
745 QSharedPointer<QList<QSharedPointer<PortMap> > > portMaps_{ nullptr };
746
748 General::InterfaceMode interfaceMode_;
749
751 std::string systemGroup_;
752
754 QSharedPointer<AbstractionDefinition const> abstractionDef_{ nullptr };
755
757 QSharedPointer<PortMapValidator> validator_{ nullptr };
758
760 PortsInterface* physicalPortInterface_{ nullptr };
761
763 PortAbstractionInterface* logicalPortInterface_{ nullptr };
764};
765
766#endif // PORTMAPINTERFACE_H
CommonInterface()=default
ParameterizableInterface(QSharedPointer< ExpressionParser > expressionParser, QSharedPointer< ExpressionFormatter > expressionFormatter)
Interface for editing abstraction definition port abstractions.
bool tieOffIsValid(int const &portMapIndex) const
void createAllSignals()
bool logicalPortExists(int const &portMapIndex) const
std::string getPhysicalLeftBoundExpression(int const &portMapIndex) const
PortAbstractionInterface * getLogicalPortInterface() const
PortsInterface * getPhysicalPortInterface() const
bool setLogicalPort(int const &portMapIndex, std::string const &newName)
bool setIsInformativeValue(int const &portMapIndex, bool newIsInformativeValue) const
std::string getLogicalPresence(int const &portMapIndex)
void setupAbstractionDefinition(QSharedPointer< AbstractionDefinition const > absDef)
void setupSystemGroup(QString const &systemGroup)
bool setPhysicalLeftBound(int const &portMapIndex, std::string const &newPhysicalLeft)
std::string getLogicalPresenceWithLogicalPort(std::string const &logicalName)
virtual bool validateItems() const override final
virtual std::vector< std::string > getItemNames() const override final
std::string getSystemGroup() const
std::string getPhysicalRightBoundValue(int const &portMapIndex, int const &baseNumber=0) const
std::string getPhysicalLeftBoundValue(int const &portMapIndex, int const &baseNumber=0) const
bool physicalPortIsValid(int const &portMapIndex) const
bool logicalPortIsValid(int const &portMapIndex) const
bool setPhysicalPort(int const &portMapIndex, std::string const &newPhysicalName)
bool setPhysicalRightBound(int const &portMapIndex, std::string const &newPhysicalRight)
std::string getPhysicalPortIconPath(int const &portMapIndex) const
std::string getLogicalLeftBoundFormattedExpression(int const &portMapIndex) const
bool connectedPortsHaveValidDirections(int const &portMapIndex) const
std::string getLogicalRightBoundExpression(int const &portMapIndex) const
bool hasPhysicalPort(int const &portMapIndex) const
bool setInvertValue(int const &portMapIndex, bool newInvertValue) const
void createRequiredSignals()
bool removePortMap(int const &portMapIndex)
bool physicalMappingIsValid(int const &portMapIndex) const
bool connectPorts(std::string const &logicalPortName, std::string const &physicalPortName)
bool setLogicalTieOff(int const &portMapIndex, std::string const &newTieOff)
std::vector< std::string > removeAllPortMapsFromLogicalPort(std::string const &logicalPortName)
std::vector< std::string > getExpressionsInSelectedPortMap(int const &portMapIndex) const
std::string getLogicalTieOffValue(int const &portMapIndex, int const &baseNumber=0) const
std::string getPhysicalRightBoundFormattedExpression(int const &portMapIndex) const
bool getInvertBool(int const &portMapIndex) const
std::string getLogicalTieOffExpression(int const &portMapIndex) const
std::string getLogicalRightBoundValue(int const &portMapIndex, int const &baseNumber=0) const
std::string getInvertString(int const &portMapIndex) const
virtual int itemCount() const override final
std::string getLogicalTieOffFormattedExpression(int const &portMapIndex) const
bool logicalPortHasValidRange(int const &portMapIndex) const
bool connectedPortsHaveValidPortTypes(int const &portMapIndex) const
void setupPhysicalPorts(Port::List ports)
void addPortMap(int const &row)
std::string getLogicalRightBoundFormattedExpression(int const &portMapIndex) const
std::string getPhysicalRightBoundExpression(int const &portMapIndex) const
virtual int getAllReferencesToIdInItem(const std::string &itemName, std::string const &valueID) const override final
bool setLogicalLeftBound(int const &portMapIndex, std::string const &newLogicalLeft)
bool connectedPortsHaveSameRange(int const &portMapIndex) const
bool setLogicalRightBound(int const &portMapIndex, std::string const &newLogicalRight)
PortMapInterface(QSharedPointer< PortMapValidator > validator, QSharedPointer< ExpressionParser > expressionParser, QSharedPointer< ExpressionFormatter > expressionFormatter, PortsInterface *physicalPortInterface, PortAbstractionInterface *logicalPortInterface)
std::string getLogicalLeftBoundExpression(int const &portMapIndex) const
void setupBusMode(General::InterfaceMode busMode)
virtual std::string getIndexedItemName(int const &itemIndex) const
void createOptionalSignals()
std::string getIsInformativeString(int const &portMapIndex) const
std::string getPhysicalLeftBoundFormattedExpression(int const &portMapIndex) const
bool connectedPortsHaveValidInitiatives(int const &portMapIndex) const
bool getIsInformativeValue(int const &portMapIndex) const
std::string getPhysicalPortName(int const &portMapIndex) const
std::string getLogicalLeftBoundValue(int const &portMapIndex, int const &baseNumber=0) const
BooleanValue getInvertValue(int const &portMapIndex) const
virtual ~PortMapInterface()=default
PortMap * getPortMapPointer(int const &portMapIndex) const
General::InterfaceMode getInterfaceMode() const
std::string getLogicalPortIconPath(int const &portMapIndex) const
std::string getLogicalPortName(int const &portMapIndex) const
virtual void setupPortMaps(QSharedPointer< AbstractionType > abstractionType)
Interface for editing component ports.