Code generation for UaVariant defaultValue missing/obsolete

Questions regarding the use of UaModeler

Moderator: uamodeler

Post Reply
Bergsteiger
Sr. Member
Sr. Member
Posts: 18
Joined: 07 Jul 2014, 16:11

Code generation for UaVariant defaultValue missing/obsolete

Post by Bergsteiger »

UaModeler Version 1.3.4 "293"

Object node initiatlization using Mandatory as Modeling rule generates the following code:

Code: Select all

/** Initialize the object with all member nodes
*/
void PressureTypeBase::initialize()
{
    UaStatus      addStatus;
    UaVariant     defaultValue;

    if ( s_typeNodesCreated == false )
    {
        createTypes();
    }
    // Mandatory variable Pressure
    m_pPressure = new OpcUa::AnalogItemType(this, s_pPressure, m_pNodeConfig, m_pSharedMutex);
    addStatus = m_pNodeConfig->addNodeAndReference(this, m_pPressure, OpcUaId_HasComponent);
    UA_ASSERT(addStatus.isGood());
        m_pPressure->setEURange(UaRange(0, 1000));

    defaultValue.setInt32(0);
	...
}
The declaration and definition of the UaVariant seams to be not necessary as the result is not used anywhere unless the UaVariant constructor causes an undocumented side effect. But the code compiles. Worse is that using the Optional Modeling rule the code does not compile as the UaVariant is not being declared, but initialized:

Code: Select all

void PressureTypeBase::initialize()
{

    if ( s_typeNodesCreated == false )
    {
        createTypes();
    }
    // Optional variable Pressure
    m_pPressure = NULL;
    defaultValue.setInt32(0);
    ...
}

User avatar
Support Team
Hero Member
Hero Member
Posts: 3072
Joined: 18 Mar 2011, 15:09

Re: Code generation for UaVariant defaultValue missing/obsol

Post by Support Team »

Hello,

We can not reproduce the problem. Could you please send your model file to support@unifiedautomation.com

Best regards
Support Team

Bergsteiger
Sr. Member
Sr. Member
Posts: 18
Joined: 07 Jul 2014, 16:11

Re: Code generation for UaVariant defaultValue missing/obsol

Post by Bergsteiger »

After completely deleteing and new creation of the nodes the issue was gone. May be the problem occured as the original model was created with an older version of the UaModeler. Fact is, that even so that I was able to reproduce the probelm with several nodes, in the moment the model works nicely.

Post Reply