How to return UNDEFINED

Discusses CAPE-OPEN specific middleware and corresponding development kit

Moderator: jasper

Post Reply
jrdp
Posts: 4
Joined: 12 May 2023, 13:35

How to return UNDEFINED

Post by jrdp »

In the specification of the GetPresentPhases() method of the ICapeThermoMaterial interface for example, it is stated that the output parameters shall be returned as "UNDEFINED". Now I am unsure how to do this.
In the header file Cobia_UndefinedValues.h, there is the line

Code: Select all

#define CapeStringUndefined (COBIA::ConstCapeEmptyString{})
but as I am not a programmer by trade, I am not sure if and how to use it.
In any case, I would greatly appreciate any tips on how to correctly return "UNDEFINED" as per the COBIA specification.

Regards,
Philip
User avatar
jasper
Posts: 1129
Joined: 24 October 2012, 15:33
Location: Spain
Contact:

Re: How to return UNDEFINED

Post by jasper »

The definition you see is for passing as input argument. As output argument - I suppose the easiest it so call .clear() on the passed output argument itself - UNDEFINED for a string value equals an empty string.
User avatar
jasper
Posts: 1129
Joined: 24 October 2012, 15:33
Location: Spain
Contact:

Re: How to return UNDEFINED

Post by jasper »

What is the context in which you are returning UNDEFINED? Which function is it?
jrdp
Posts: 4
Joined: 12 May 2023, 13:35

Re: How to return UNDEFINED

Post by jrdp »

This question arose whilst working on implementing the GetPresentPhases function of the ICapeThermoMaterial interface. The overall context is implementing a Modelica-CAPE-OPEN interface for Dymola.
jrdp
Posts: 4
Joined: 12 May 2023, 13:35

Re: How to return UNDEFINED

Post by jrdp »

Regarding this particular function, GetPresentPhases, its parameters are CapeArrayString and CapeArrayEnumeration<CAPEOPEN_1_2::CapePhaseStatus>, so there is no clear()-function available. Would a resize(0) on the output parameters comply with the specification of the function?
User avatar
jasper
Posts: 1129
Joined: 24 October 2012, 15:33
Location: Spain
Contact:

Re: How to return UNDEFINED

Post by jasper »

Yes - UNDEFINED for arrays is an empty array. Indeed resize(0) will do the trick.
Post Reply

Return to “CAPE-OPEN Binary Interop Architecture”