Page 1 of 1

Code generation for UaVariant defaultValue missing/obsolete

Posted: 24 Mar 2015, 10:02
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);
    ...
}

Re: Code generation for UaVariant defaultValue missing/obsol

Posted: 26 Mar 2015, 15:55
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

Re: Code generation for UaVariant defaultValue missing/obsol

Posted: 27 Mar 2015, 07:59
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.