Skip to content

Commit

Permalink
all: follow omnetpp change: cNedValue::OBJECT renamed to POINTER
Browse files Browse the repository at this point in the history
  • Loading branch information
ZoltanBojthe authored and avarga committed Sep 26, 2023
1 parent 37ccd2c commit 42d2965
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/inet/common/NedFunctions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,16 @@ static cNedValue nedf_intWithUnit(cComponent *context, cNedValue argv[], int arg
return cNedValue(checked_int_cast<intval_t>(floor(argv[0].doubleValueRaw())), argv[0].getUnit());
case cNedValue::STRING:
throw cRuntimeError("intWithUnit(): Cannot convert string to int");
#if OMNETPP_BUILDNUM < 1527
case cNedValue::OBJECT:
throw cRuntimeError("intWithUnit(): Cannot convert cObject to int");
#else
case cNedValue::POINTER:
if (argv[0].containsXML())
throw cRuntimeError("intWithUnit(): Cannot convert xml to int");
else
throw cRuntimeError("intWithUnit(): Cannot convert pointer to int");
#endif
default:
throw cRuntimeError("Internal error: Invalid cNedValue type");
}
Expand All @@ -232,8 +240,13 @@ Define_NED_Function2(nedf_intWithUnit,

cNedValue nedf_xmlattr(cComponent *context, cNedValue argv[], int argc)
{
#if OMNETPP_BUILDNUM < 1527
if (argv[0].getType() != cNedValue::OBJECT)
throw cRuntimeError("xmlattr(): xmlNode argument must be an xml node");
#else
if (argv[0].getType() != cNedValue::POINTER || !argv[0].containsXML())
throw cRuntimeError("xmlattr(): xmlNode argument must be an xml node");
#endif
if (argv[1].getType() != cNEDValue::STRING)
throw cRuntimeError("xmlattr(): attributeName argument must be a string");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ Define_Module(TSNschedGateScheduleConfigurator);
static void printJson(std::ostream& stream, const cValue& value, int level = 0)
{
std::string indent(level * 2, ' ');
#if OMNETPP_BUILDNUM < 1527
if (value.getType() == cValue::OBJECT) {
#else
if (value.getType() == cNedValue::POINTER && value.containsObject()) {
#endif
auto object = value.objectValue();
if (auto array = dynamic_cast<cValueArray *>(object)) {
if (array->size() == 0)
Expand Down

0 comments on commit 42d2965

Please sign in to comment.