Is there a method to determine a MAP's Type?

Just starting out? Need help? Post your questions and find answers here.
swhite
Addict
Addict
Posts: 805
Joined: Thu May 21, 2009 6:56 pm

Is there a method to determine a MAP's Type?

Post by swhite »

Hi

Is there a way that I could determine a MAP's type? I am thinking that if FWSite() was passed to a procedure it could do something like MAPType(FWSite()) = "dBValue" or MAPType(FWTrn())="RecordSet". This should work for all MAP types. If not I would like to suggest a new function for this purpose.

Code: Select all

Structure dBValue
   StructureUnion
      ValueD.d
      ValueI.i
   EndStructureUnion 
   ValueS.s
   Type.s[1]
   Chngd.a
EndStructure
; Record Set Structure
Structure RecordSet
   Map Fld.dBValue()  
EndStructure

Define NewMap FWSite.dBValue(),NewMap FWTrn.RecordSet()

Simon White
dCipher Computing
User avatar
idle
Always Here
Always Here
Posts: 6026
Joined: Fri Sep 21, 2007 5:52 am
Location: New Zealand

Re: Is there a method to determine a MAP's Type?

Post by idle »

No there isn't any runtime reflection of user structures at the moment.
If you look at https://www.purebasic.fr/english/viewtopic.php?t=84733
there's an example of that for x64 windows asm backend which impliment jsonruntimestrucutre which has the reflection and does it at run time
and it's also in the impbdb.pbi which is the dbengine for codeDB example
https://www.purebasic.fr/english/viewtopic.php?t=86090
Post Reply