Commit ab2e7d03 authored by Guenter Schwann's avatar Guenter Schwann
Browse files

626 Rename pseudo function/interface to system

parent cadd6fd9
Pipeline #5763 passed with stage
in 10 minutes and 53 seconds
...@@ -11,12 +11,12 @@ ...@@ -11,12 +11,12 @@
<Port name="eth5" asn1file="/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" asn1module="POHICDRIVER-IP" asn1type="IP-Conf-T" requiresBusAccess="ocarina_buses::ip.i"/> <Port name="eth5" asn1file="/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" asn1module="POHICDRIVER-IP" asn1type="IP-Conf-T" requiresBusAccess="ocarina_buses::ip.i"/>
<Port name="eth6" asn1file="/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" asn1module="POHICDRIVER-IP" asn1type="IP-Conf-T" requiresBusAccess="ocarina_buses::ip.i"/> <Port name="eth6" asn1file="/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" asn1module="POHICDRIVER-IP" asn1type="IP-Conf-T" requiresBusAccess="ocarina_buses::ip.i"/>
<Port name="eth7" asn1file="/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" asn1module="POHICDRIVER-IP" asn1type="IP-Conf-T" requiresBusAccess="ocarina_buses::ip.i"/> <Port name="eth7" asn1file="/home/taste/tool-inst/include/ocarina/runtime/polyorb-hi-c/src/drivers/configuration/ip.asn" asn1module="POHICDRIVER-IP" asn1type="IP-Conf-T" requiresBusAccess="ocarina_buses::ip.i"/>
<Pseudo_Function name="PrecisionTimer"> <System_Function name="PrecisionTimer">
<Provided_Interface name="getTime"> <Provided_Interface name="getTime">
</Provided_Interface>" </Provided_Interface>"
<Required_Interface name="init"> <Required_Interface name="init">
<Input_Parameter name="seed" type="MyInt" encoding="NATIVE"/> <Input_Parameter name="seed" type="MyInt" encoding="NATIVE"/>
</Required_Interface>" </Required_Interface>"
</Pseudo_Function> </System_Function>
</Board> </Board>
</Boards> </Boards>
...@@ -39,11 +39,11 @@ target_sources(${LIB_NAME} PRIVATE ...@@ -39,11 +39,11 @@ target_sources(${LIB_NAME} PRIVATE
dvpropertytemplate.h dvpropertytemplate.h
dvpropertytemplateconfig.cpp dvpropertytemplateconfig.cpp
dvpropertytemplateconfig.h dvpropertytemplateconfig.h
dvpseudofunction.cpp
dvpseudofunction.h
dvpseudointerface.cpp
dvpseudointerface.h
dvresources.qrc dvresources.qrc
dvsystemfunction.cpp
dvsystemfunction.h
dvsysteminterface.cpp
dvsysteminterface.h
dvxmlreader.cpp dvxmlreader.cpp
dvxmlreader.h dvxmlreader.h
) )
......
...@@ -66,7 +66,7 @@ const QHash<QString, Props::Token> Props::TokensByName = { ...@@ -66,7 +66,7 @@ const QHash<QString, Props::Token> Props::TokensByName = {
{ "Boards", Token::Boards }, { "Boards", Token::Boards },
{ "Board", Token::Board }, { "Board", Token::Board },
{ "Port", Token::Port }, { "Port", Token::Port },
{ "Pseudo_Function", Token::Pseudo_Function }, { "System_Function", Token::System_Function },
{ "Provided_Interface", Token::Provided_Interface }, { "Provided_Interface", Token::Provided_Interface },
{ "Required_Interface", Token::Required_Interface }, { "Required_Interface", Token::Required_Interface },
{ "Input_Parameter", Token::Input_Parameter }, { "Input_Parameter", Token::Input_Parameter },
......
...@@ -46,7 +46,7 @@ public: ...@@ -46,7 +46,7 @@ public:
Boards, Boards,
Board, Board,
Port, Port,
Pseudo_Function, System_Function,
Provided_Interface, Provided_Interface,
Required_Interface, Required_Interface,
Input_Parameter, Input_Parameter,
......
...@@ -25,8 +25,8 @@ ...@@ -25,8 +25,8 @@
#include "dvobject.h" #include "dvobject.h"
#include "dvpartition.h" #include "dvpartition.h"
#include "dvport.h" #include "dvport.h"
#include "dvpseudofunction.h" #include "dvsystemfunction.h"
#include "dvpseudointerface.h" #include "dvsysteminterface.h"
#include "errorhub.h" #include "errorhub.h"
#include <QDebug> #include <QDebug>
...@@ -82,28 +82,28 @@ void DVHWLibraryReader::processTagOpen(QXmlStreamReader &xml) ...@@ -82,28 +82,28 @@ void DVHWLibraryReader::processTagOpen(QXmlStreamReader &xml)
obj = port; obj = port;
} }
} break; } break;
case meta::Props::Token::Pseudo_Function: { case meta::Props::Token::System_Function: {
Q_ASSERT(d->m_currentObject != nullptr); Q_ASSERT(d->m_currentObject != nullptr);
if (auto board = qobject_cast<DVBoard *>(d->m_currentObject)) { if (auto board = qobject_cast<DVBoard *>(d->m_currentObject)) {
obj = new dvm::DVPseudoFunction(d->m_currentObject); obj = new dvm::DVSystemFunction(d->m_currentObject);
} }
} break; } break;
case meta::Props::Token::Provided_Interface: case meta::Props::Token::Provided_Interface:
case meta::Props::Token::Required_Interface: { case meta::Props::Token::Required_Interface: {
Q_ASSERT(d->m_currentObject != nullptr); Q_ASSERT(d->m_currentObject != nullptr);
if (auto board = qobject_cast<DVPseudoFunction *>(d->m_currentObject)) { if (auto board = qobject_cast<DVSystemFunction *>(d->m_currentObject)) {
auto interface = new dvm::DVPseudoInterface(d->m_currentObject); auto interface = new dvm::DVSystemInterface(d->m_currentObject);
obj = interface; obj = interface;
interface->setInterfaceType(t == meta::Props::Token::Provided_Interface interface->setInterfaceType(t == meta::Props::Token::Provided_Interface
? dvm::DVPseudoInterface::InterfaceType::Provided ? dvm::DVSystemInterface::InterfaceType::Provided
: dvm::DVPseudoInterface::InterfaceType::Required); : dvm::DVSystemInterface::InterfaceType::Required);
break; break;
} }
break; break;
} }
case meta::Props::Token::Output_Parameter: case meta::Props::Token::Output_Parameter:
case meta::Props::Token::Input_Parameter: { case meta::Props::Token::Input_Parameter: {
auto iface = qobject_cast<DVPseudoInterface *>(d->m_currentObject); auto iface = qobject_cast<DVSystemInterface *>(d->m_currentObject);
Q_ASSERT(iface != nullptr); Q_ASSERT(iface != nullptr);
const EntityAttributes attrs = attributes(xml.attributes()); const EntityAttributes attrs = attributes(xml.attributes());
const shared::InterfaceParameter param = addIfaceParameter(attrs, const shared::InterfaceParameter param = addIfaceParameter(attrs,
......
...@@ -40,8 +40,8 @@ public: ...@@ -40,8 +40,8 @@ public:
Board, Board,
Port, Port,
PseudoFunction, SystemFunction,
PseudoInterface, SystemInterface,
Node, Node,
Partition, Partition,
......
...@@ -15,13 +15,20 @@ ...@@ -15,13 +15,20 @@
along with this program. If not, see <https://www.gnu.org/licenses/lgpl-2.1.html>. along with this program. If not, see <https://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
#include "dvpseudofunction.h" #include "dvsystemfunction.h"
#include "dvsysteminterface.h"
namespace dvm { namespace dvm {
DVPseudoFunction::DVPseudoFunction(DVObject *parent) DVSystemFunction::DVSystemFunction(DVObject *parent)
: DVObject(DVObject::Type::PseudoFunction, {}, parent) : DVObject(DVObject::Type::SystemFunction, {}, parent)
{
}
QList<DVSystemInterface *> DVSystemFunction::interfaces() const
{ {
return typedChildren<DVSystemInterface>();
} }
} // namespace dvm } // namespace dvm
...@@ -19,13 +19,20 @@ ...@@ -19,13 +19,20 @@
#include "dvobject.h" #include "dvobject.h"
#include <QList>
namespace dvm { namespace dvm {
class DVSystemInterface;
class DVPseudoFunction : public DVObject class DVSystemFunction : public DVObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QList<dvm::DVSystemInterface *> interfaces READ interfaces)
public: public:
explicit DVPseudoFunction(DVObject *parent = nullptr); explicit DVSystemFunction(DVObject *parent = nullptr);
QList<DVSystemInterface *> interfaces() const;
}; };
} // namespace dvm } // namespace dvm
...@@ -15,31 +15,41 @@ ...@@ -15,31 +15,41 @@
along with this program. If not, see <https://www.gnu.org/licenses/lgpl-2.1.html>. along with this program. If not, see <https://www.gnu.org/licenses/lgpl-2.1.html>.
*/ */
#include "dvpseudointerface.h" #include "dvsysteminterface.h"
namespace dvm { namespace dvm {
DVPseudoInterface::DVPseudoInterface(DVObject *parent) DVSystemInterface::DVSystemInterface(DVObject *parent)
: DVObject(DVObject::Type::PseudoInterface, {}, parent) : DVObject(DVObject::Type::SystemInterface, {}, parent)
{ {
} }
void DVPseudoInterface::setInterfaceType(InterfaceType type) void DVSystemInterface::setInterfaceType(InterfaceType type)
{ {
m_interfaceType = type; m_interfaceType = type;
} }
DVPseudoInterface::InterfaceType DVPseudoInterface::interfaceType() const DVSystemInterface::InterfaceType DVSystemInterface::interfaceType() const
{ {
return m_interfaceType; return m_interfaceType;
} }
QVector<shared::InterfaceParameter> DVPseudoInterface::params() const bool DVSystemInterface::isProvided() const
{
return m_interfaceType == InterfaceType::Provided;
}
bool DVSystemInterface::isRequired() const
{
return m_interfaceType == InterfaceType::Required;
}
QVector<shared::InterfaceParameter> DVSystemInterface::params() const
{ {
return m_parameters; return m_parameters;
} }
shared::InterfaceParameter DVPseudoInterface::param(const QString &name) const shared::InterfaceParameter DVSystemInterface::param(const QString &name) const
{ {
if (!name.isEmpty()) { if (!name.isEmpty()) {
for (const shared::InterfaceParameter &param : m_parameters) { for (const shared::InterfaceParameter &param : m_parameters) {
...@@ -51,7 +61,7 @@ shared::InterfaceParameter DVPseudoInterface::param(const QString &name) const ...@@ -51,7 +61,7 @@ shared::InterfaceParameter DVPseudoInterface::param(const QString &name) const
return {}; return {};
} }
void DVPseudoInterface::setParams(const QVector<shared::InterfaceParameter> &params) void DVSystemInterface::setParams(const QVector<shared::InterfaceParameter> &params)
{ {
if (m_parameters != params) { if (m_parameters != params) {
m_parameters = params; m_parameters = params;
...@@ -59,7 +69,7 @@ void DVPseudoInterface::setParams(const QVector<shared::InterfaceParameter> &par ...@@ -59,7 +69,7 @@ void DVPseudoInterface::setParams(const QVector<shared::InterfaceParameter> &par
} }
} }
void DVPseudoInterface::addParam(const shared::InterfaceParameter &param) void DVSystemInterface::addParam(const shared::InterfaceParameter &param)
{ {
if (!m_parameters.contains(param)) { if (!m_parameters.contains(param)) {
m_parameters.append(param); m_parameters.append(param);
......
...@@ -24,9 +24,13 @@ ...@@ -24,9 +24,13 @@
namespace dvm { namespace dvm {
class DVPseudoInterface : public DVObject class DVSystemInterface : public DVObject
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool isProvided READ isProvided)
Q_PROPERTY(bool isRequired READ isRequired)
Q_PROPERTY(QVector<shared::InterfaceParameter> params READ params)
public: public:
enum class InterfaceType enum class InterfaceType
{ {
...@@ -35,10 +39,12 @@ public: ...@@ -35,10 +39,12 @@ public:
}; };
Q_ENUM(InterfaceType) Q_ENUM(InterfaceType)
explicit DVPseudoInterface(DVObject *parent = nullptr); explicit DVSystemInterface(DVObject *parent = nullptr);
void setInterfaceType(InterfaceType type); void setInterfaceType(InterfaceType type);
InterfaceType interfaceType() const; InterfaceType interfaceType() const;
bool isProvided() const;
bool isRequired() const;
QVector<shared::InterfaceParameter> params() const; QVector<shared::InterfaceParameter> params() const;
shared::InterfaceParameter param(const QString &name) const; shared::InterfaceParameter param(const QString &name) const;
......
...@@ -72,6 +72,20 @@ public: ...@@ -72,6 +72,20 @@ public:
virtual VEObject *parentObject() const; virtual VEObject *parentObject() const;
QVector<VEObject *> descendants() const; QVector<VEObject *> descendants() const;
/// Return all children of type T
template<typename T>
QList<T *> typedChildren() const
{
QList<T *> typedChildren;
for (QObject *obj : children()) {
if (auto child = qobject_cast<T *>(obj)) {
typedChildren.append(child);
}
}
return typedChildren;
}
VEModel *model() const; VEModel *model() const;
virtual bool postInit() = 0; virtual bool postInit() = 0;
virtual bool aboutToBeRemoved() = 0; virtual bool aboutToBeRemoved() = 0;
......
...@@ -110,7 +110,7 @@ static inline QByteArray multiBoardsWithPort() ...@@ -110,7 +110,7 @@ static inline QByteArray multiBoardsWithPort()
"</Boards>"); "</Boards>");
} }
static inline QByteArray boardWithPseudoFunction() static inline QByteArray boardWithSystemFunction()
{ {
return QByteArray( return QByteArray(
"<Boards>" "<Boards>"
...@@ -118,13 +118,13 @@ static inline QByteArray boardWithPseudoFunction() ...@@ -118,13 +118,13 @@ static inline QByteArray boardWithPseudoFunction()
" <Port " " <Port "
" asn1file=\"/opt/asn/ip.asn\" asn1module=\"POHICDRIVER-IP\" asn1type=\"IP-Conf-T\" bus=\"eth0\" " " asn1file=\"/opt/asn/ip.asn\" asn1module=\"POHICDRIVER-IP\" asn1type=\"IP-Conf-T\" bus=\"eth0\" "
" requiresBusAccess=\"ocarina_buses::ip.i\" />" " requiresBusAccess=\"ocarina_buses::ip.i\" />"
" <Pseudo_Function name=\"PrecisionTimer\">" " <System_Function name=\"PrecisionTimer\">"
" <Provided_Interface name=\"getTime\">" " <Provided_Interface name=\"getTime\">"
" </Provided_Interface>" " </Provided_Interface>"
" <Required_Interface name=\"init\">" " <Required_Interface name=\"init\">"
" <Input_Parameter name=\"seed\" type=\"MyInt\" encoding=\"NATIVE\"/>" " <Input_Parameter name=\"seed\" type=\"MyInt\" encoding=\"NATIVE\"/>"
" </Required_Interface>" " </Required_Interface>"
" </Pseudo_Function>" " </System_Function>"
" </Board>" " </Board>"
"</Boards>"); "</Boards>");
} }
......
...@@ -71,7 +71,7 @@ void DVBoardReaderTest::tst_singleItems() ...@@ -71,7 +71,7 @@ void DVBoardReaderTest::tst_singleItems()
runReader(helpers::singleBoardWithPorts(), 4); runReader(helpers::singleBoardWithPorts(), 4);
runReader(helpers::multiBoardsWithPort(), 4); runReader(helpers::multiBoardsWithPort(), 4);
runReader(helpers::unknownProperty(), 0); runReader(helpers::unknownProperty(), 0);
runReader(helpers::boardWithPseudoFunction(), 5); runReader(helpers::boardWithSystemFunction(), 5);
runReader(helpers::openCloseTagMismatched(), -1, false); runReader(helpers::openCloseTagMismatched(), -1, false);
runReader(helpers::malformedXml(), -1, false); runReader(helpers::malformedXml(), -1, false);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment