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 @@
<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="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>"
<Required_Interface name="init">
<Input_Parameter name="seed" type="MyInt" encoding="NATIVE"/>
</Required_Interface>"
</Pseudo_Function>
</System_Function>
</Board>
</Boards>
......@@ -39,11 +39,11 @@ target_sources(${LIB_NAME} PRIVATE
dvpropertytemplate.h
dvpropertytemplateconfig.cpp
dvpropertytemplateconfig.h
dvpseudofunction.cpp
dvpseudofunction.h
dvpseudointerface.cpp
dvpseudointerface.h
dvresources.qrc
dvsystemfunction.cpp
dvsystemfunction.h
dvsysteminterface.cpp
dvsysteminterface.h
dvxmlreader.cpp
dvxmlreader.h
)
......
......@@ -66,7 +66,7 @@ const QHash<QString, Props::Token> Props::TokensByName = {
{ "Boards", Token::Boards },
{ "Board", Token::Board },
{ "Port", Token::Port },
{ "Pseudo_Function", Token::Pseudo_Function },
{ "System_Function", Token::System_Function },
{ "Provided_Interface", Token::Provided_Interface },
{ "Required_Interface", Token::Required_Interface },
{ "Input_Parameter", Token::Input_Parameter },
......
......@@ -46,7 +46,7 @@ public:
Boards,
Board,
Port,
Pseudo_Function,
System_Function,
Provided_Interface,
Required_Interface,
Input_Parameter,
......
......@@ -25,8 +25,8 @@
#include "dvobject.h"
#include "dvpartition.h"
#include "dvport.h"
#include "dvpseudofunction.h"
#include "dvpseudointerface.h"
#include "dvsystemfunction.h"
#include "dvsysteminterface.h"
#include "errorhub.h"
#include <QDebug>
......@@ -82,28 +82,28 @@ void DVHWLibraryReader::processTagOpen(QXmlStreamReader &xml)
obj = port;
}
} break;
case meta::Props::Token::Pseudo_Function: {
case meta::Props::Token::System_Function: {
Q_ASSERT(d->m_currentObject != nullptr);
if (auto board = qobject_cast<DVBoard *>(d->m_currentObject)) {
obj = new dvm::DVPseudoFunction(d->m_currentObject);
obj = new dvm::DVSystemFunction(d->m_currentObject);
}
} break;
case meta::Props::Token::Provided_Interface:
case meta::Props::Token::Required_Interface: {
Q_ASSERT(d->m_currentObject != nullptr);
if (auto board = qobject_cast<DVPseudoFunction *>(d->m_currentObject)) {
auto interface = new dvm::DVPseudoInterface(d->m_currentObject);
if (auto board = qobject_cast<DVSystemFunction *>(d->m_currentObject)) {
auto interface = new dvm::DVSystemInterface(d->m_currentObject);
obj = interface;
interface->setInterfaceType(t == meta::Props::Token::Provided_Interface
? dvm::DVPseudoInterface::InterfaceType::Provided
: dvm::DVPseudoInterface::InterfaceType::Required);
? dvm::DVSystemInterface::InterfaceType::Provided
: dvm::DVSystemInterface::InterfaceType::Required);
break;
}
break;
}
case meta::Props::Token::Output_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);
const EntityAttributes attrs = attributes(xml.attributes());
const shared::InterfaceParameter param = addIfaceParameter(attrs,
......
......@@ -40,8 +40,8 @@ public:
Board,
Port,
PseudoFunction,
PseudoInterface,
SystemFunction,
SystemInterface,
Node,
Partition,
......
......@@ -15,13 +15,20 @@
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 {
DVPseudoFunction::DVPseudoFunction(DVObject *parent)
: DVObject(DVObject::Type::PseudoFunction, {}, parent)
DVSystemFunction::DVSystemFunction(DVObject *parent)
: DVObject(DVObject::Type::SystemFunction, {}, parent)
{
}
QList<DVSystemInterface *> DVSystemFunction::interfaces() const
{
return typedChildren<DVSystemInterface>();
}
} // namespace dvm
......@@ -19,13 +19,20 @@
#include "dvobject.h"
#include <QList>
namespace dvm {
class DVSystemInterface;
class DVPseudoFunction : public DVObject
class DVSystemFunction : public DVObject
{
Q_OBJECT
Q_PROPERTY(QList<dvm::DVSystemInterface *> interfaces READ interfaces)
public:
explicit DVPseudoFunction(DVObject *parent = nullptr);
explicit DVSystemFunction(DVObject *parent = nullptr);
QList<DVSystemInterface *> interfaces() const;
};
} // namespace dvm
......@@ -15,31 +15,41 @@
along with this program. If not, see <https://www.gnu.org/licenses/lgpl-2.1.html>.
*/
#include "dvpseudointerface.h"
#include "dvsysteminterface.h"
namespace dvm {
DVPseudoInterface::DVPseudoInterface(DVObject *parent)
: DVObject(DVObject::Type::PseudoInterface, {}, parent)
DVSystemInterface::DVSystemInterface(DVObject *parent)
: DVObject(DVObject::Type::SystemInterface, {}, parent)
{
}
void DVPseudoInterface::setInterfaceType(InterfaceType type)
void DVSystemInterface::setInterfaceType(InterfaceType type)
{
m_interfaceType = type;
}
DVPseudoInterface::InterfaceType DVPseudoInterface::interfaceType() const
DVSystemInterface::InterfaceType DVSystemInterface::interfaceType() const
{
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;
}
shared::InterfaceParameter DVPseudoInterface::param(const QString &name) const
shared::InterfaceParameter DVSystemInterface::param(const QString &name) const
{
if (!name.isEmpty()) {
for (const shared::InterfaceParameter &param : m_parameters) {
......@@ -51,7 +61,7 @@ shared::InterfaceParameter DVPseudoInterface::param(const QString &name) const
return {};
}
void DVPseudoInterface::setParams(const QVector<shared::InterfaceParameter> &params)
void DVSystemInterface::setParams(const QVector<shared::InterfaceParameter> &params)
{
if (m_parameters != params) {
m_parameters = params;
......@@ -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)) {
m_parameters.append(param);
......
......@@ -24,9 +24,13 @@
namespace dvm {
class DVPseudoInterface : public DVObject
class DVSystemInterface : public DVObject
{
Q_OBJECT
Q_PROPERTY(bool isProvided READ isProvided)
Q_PROPERTY(bool isRequired READ isRequired)
Q_PROPERTY(QVector<shared::InterfaceParameter> params READ params)
public:
enum class InterfaceType
{
......@@ -35,10 +39,12 @@ public:
};
Q_ENUM(InterfaceType)
explicit DVPseudoInterface(DVObject *parent = nullptr);
explicit DVSystemInterface(DVObject *parent = nullptr);
void setInterfaceType(InterfaceType type);
InterfaceType interfaceType() const;
bool isProvided() const;
bool isRequired() const;
QVector<shared::InterfaceParameter> params() const;
shared::InterfaceParameter param(const QString &name) const;
......
......@@ -72,6 +72,20 @@ public:
virtual VEObject *parentObject() 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;
virtual bool postInit() = 0;
virtual bool aboutToBeRemoved() = 0;
......
......@@ -110,7 +110,7 @@ static inline QByteArray multiBoardsWithPort()
"</Boards>");
}
static inline QByteArray boardWithPseudoFunction()
static inline QByteArray boardWithSystemFunction()
{
return QByteArray(
"<Boards>"
......@@ -118,13 +118,13 @@ static inline QByteArray boardWithPseudoFunction()
" <Port "
" asn1file=\"/opt/asn/ip.asn\" asn1module=\"POHICDRIVER-IP\" asn1type=\"IP-Conf-T\" bus=\"eth0\" "
" requiresBusAccess=\"ocarina_buses::ip.i\" />"
" <Pseudo_Function name=\"PrecisionTimer\">"
" <System_Function name=\"PrecisionTimer\">"
" <Provided_Interface name=\"getTime\">"
" </Provided_Interface>"
" <Required_Interface name=\"init\">"
" <Input_Parameter name=\"seed\" type=\"MyInt\" encoding=\"NATIVE\"/>"
" </Required_Interface>"
" </Pseudo_Function>"
" </System_Function>"
" </Board>"
"</Boards>");
}
......
......@@ -71,7 +71,7 @@ void DVBoardReaderTest::tst_singleItems()
runReader(helpers::singleBoardWithPorts(), 4);
runReader(helpers::multiBoardsWithPort(), 4);
runReader(helpers::unknownProperty(), 0);
runReader(helpers::boardWithPseudoFunction(), 5);
runReader(helpers::boardWithSystemFunction(), 5);
runReader(helpers::openCloseTagMismatched(), -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