Beijer Electronics (formerly QSI Corporation)

Manufacturer of Mobile Data and Human Machine Interface Terminals.
It is currently Mon Dec 11, 2017 11:33 pm

All times are UTC - 7 hours




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Mon Dec 15, 2008 11:19 am 
Offline
User avatar

Joined: Fri Feb 01, 2008 4:50 pm
Posts: 101
Because objects can't be created at runtime, I am creating a sort of struct out of a byte array, and making an array of these using ArrayHandlers. Within the byte array structure I would like to store a reference to an object, but I am not sure if this is possible. How might I go about doing this? I could store the str(objref), and store the size of this string in the byte array. Then, I could use val() to access the object. What do you think? The easiest way would be to simply store the reference itself, but I am not sure if I can or not.

Thanks!


Top
 Profile  
 
PostPosted: Mon Dec 15, 2008 11:33 am 
Offline
QSI Support
QSI Support
User avatar

Joined: Wed Mar 08, 2006 12:25 pm
Posts: 881
Location: Salt Lake City, Utah
Unfortunately you cannot store an objref directly in a string (byte array), you can, of course call str() on the object and then use val() or GetObjRef() to restore the object reference. Be sure to read the docs, GetObjRef() cannot return a typed objRef, where val is able to.

An alternate technique that I use on occasion would be to create an array of objrefs, then store only the index in the array of the object you are using. This could be easier, particularly if you are using fewer than 256 unique objects of that type.

_________________
Jeremy
http://www.beijerinc.com


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 7 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group