Hi again
StringNodeId is not a function, it is just a variable name that I named to what it contains.
You can also write
UaNodeId: the class name
foo: the variable name
Depending on the arguments, in this case UaString("bla") and (int)2 it selects automatically the correct constructor of the UaNodeId class (C++ function overloading).
This constructors are described in the link I sent you before.
The string based constructor is exactly described here
http://doc.unifiedautomation.com/uasdkc ... d7003de340
OpcUa_Int16 is a typedef to a "short int" on most systems. Because C/C++ don't define fixed size types in portable way the UaStack's platform layer file opcua_p_types.h defines its own types. This can be adapted to every operating system and compiler (portable code).
You can cast (int) to (OpcUa_Int16) and vice versa. This cast is done implicitly like the "2" in the example above.
However when casting a bigger type to smaller one you can loose information so the compiler might show a warning.
In this case an explicit cast tells the compiler that you know what your doing and this loss of information is OK.
Code: Select all
int ns = 3;
UaNodeId foo(UaString("Hello"), (OpcUa_UInt16)ns);
It looks like you don't understand C++ syntax. Maybe you should first try some basic C++ examples. OPC UA is not trivial so you should not learn C++ with OPC UA.
See
http://www.cplusplus.com/doc/tutorial/ for some basic examples.
"Effective C++" is great book from Scott Meyers but requires already some basic knowledge:
http://www.amazon.com/gp/product/032133 ... 0321334876