alex21
Joined: 20 Apr 2011 Posts: 75 Location: Australia
|
Posted: Sun Aug 04, 2013 11:39 pm Post subject: Silverfrost .NET abstract/interface typed arguments? |
|
|
Hello,
I am trying to write a function a bit like the one below.
Code: |
FUNCTION GetPropertyUnitGroupName(model, property)
OBJECT("Domain.UnitBaseModel"), INTENT(IN) :: model
CHARACTER(LEN=*), INTENT(IN) :: property
CHARACTER :: GetPropertyUnitGroupName
OBJECT("Domain.Units.UnitGroup") :: unitGroup
unitGroup = GetPropertyUnitGroup(CAST@(model, "Domain.UnitBaseModel"), STRING@(property))
GetPropertyUnitGroupName = CHAR(unitGroup%Name)
END FUNCTION GetPropertyUnitGroupName
|
However when trying to use it as such.
Code: |
GetPropertyUnitGroupName(Input%IrrigationData, "PumpMinimum") |
I get error messages like this.
"In the INTERFACE to GETPROPERTYUNITGROUPNAME (from MODULE MODDOMAIN), the first dummy argument (MODEL) was of type OBJECT('Domain.UnitBaseModel'), whereas the actual argument is of type OBJECT('Domain.Input.IrrigationInfrastructure')"
So I was wondering if there is anyway I can fix my function to be able to take a more generic first parameter without having to call CAST@() every time I call it?
Also what is the easiest way to get around not being able to pass .NET arrays as arguments to functions?
Thanks,
Alex. |
|