F2I-Consulting / fesapi

API for ENERGISTICS™ data standards (mainly RESQML™), multi-languages (C++, Java, C#, Python)
Apache License 2.0
34 stars 24 forks source link

SWIG wrap property getters, e.g., SWIG_GETTER_DATAOBJECTS(RESQML2_NS::ContinuousProperty, ContinuousProperty) #299

Closed mgimhof closed 3 years ago

mgimhof commented 3 years ago

Is your feature request related to a problem? Please describe. My use case is to exchange properties between applications using the C# bindings and I would like to get more direct access to properties in the epc

Describe the solution you'd like C# Getters for CategoricalProperty, ContinuousProperty, DiscreteProperty

e.g., swigModule.i

        SWIG_GETTER_DATAOBJECTS(RESQML2_NS::CategoricalProperty, CategoricalProperty)
        SWIG_GETTER_DATAOBJECTS(RESQML2_NS::ContinuousProperty, ContinuousProperty)
        SWIG_GETTER_DATAOBJECTS(RESQML2_NS::DiscreteProperty, DiscreteProperty)

Describe alternatives you've considered I can try to get properties through the representation, but I would prefer not having to send the representation just for a list to access its properties.

Additional context Add any other context or screenshots about the feature request here.

philippeVerney commented 3 years ago

Hi @mgimhof

Do you expect it for a particular release? v2+ (as it is today, draft RESQML2.2 and Apache license) v3+ (probably for final RESQML2.2 and potentially with a dual license GPL + commercial) v1+ or maybe you don't care.

mgimhof commented 3 years ago

@philippeVerney I think v2+, essentially the current 201

mgimhof commented 3 years ago

I seem to be using 2.1.1.0.

Matthias

mgimhof commented 3 years ago

@philippeVerney I have to add a C# (and Python?) method to just get all objects in the EPC. In the spirit of the current getters, that would be

getDataObject(uint i) and uint getDataObjectCount()

If I can recast AbstractObject to, e.g., ContinuousProperty, then the generic getter might be sufficient and the specific getters listed above would be sugar.

philippeVerney commented 3 years ago

@mgimhof There is already something quite similar discussed here : https://discourse.f2i-consulting.com/t/reading-of-seismiclattice-from-dataobjectrepository/167/4 where someone wanted to read SeismicLattice from DataObjectRepository in Java.

The key is to use:

mgimhof commented 3 years ago

@philippeVerney Indeed, I missed the route you describe above. Thanks for pointing it out again.

Please treat this threat as a request for sugar, not a blocker. With the recipe listed above, I could create a helper function in my app to loop over the content and gather the desired top level objects, e.g., ContinuousProperty.

mgimhof commented 3 years ago

feel free to close it

philippeVerney commented 3 years ago

Closed since there is a workaround and that the long term solution is to provide an array of not final classes in SWIG. For now we only know how to have arrays of final classes in SWIG i.e. array of resqml2.0.1.ContiuousProperty but not array of resqml2.ContiuousProperty. This is the main step to solve first for a long term solution.