[Gambas-user] gb3: using string as stream for sequential write operations of arbitrary datatypes
tobias
tobiasboe1 at ...20...
Tue Aug 30 17:05:41 CEST 2011
hi,
> On 08/30/2011 04:35 AM, Bruce Bruen wrote:
>> On Tue, 2011-08-30 at 01:52 -0400, Kevin Fishburne wrote:
>>> When a transaction isn't received and I need to resend it, I'd like
>>> to
>>> be able to refer to the transaction history and resend the data
>>> (QueueOut[id].Data) without having to recalculate it, especially
>>> since
>>> the data may have changed during the timeout period. I don't see any
>>> way
>>> to store a completely arbitrary set of datatypes as a single
>>> structure
>>> property however. I could write them to a file, then read the file
>>> into
>>> a string and load it into a property of the array of structures, but
>>> that's just crazy.
regardless of (potential) design problems, i'd like to try to discuss
your problem.
i hopefully understood you right... you want to read and write
arbitrary/binary data in some sort of queue (array?)?
as i read your explanation, two things came in my mind:
*the Memory keyword: http://gambasdoc.org/help/lang/memory?v3
*the Struct keyword: http://gambasdoc.org/help/lang/struct?v3
i never worked with either of both, but you can define functions for the
Memory solution to read and write your structure, or create an array of
your defined structure (but those, i read, do not have e.g. an Add
method, so you'll have to implement it yourself, maybe...)
i just noticed, since struct arrays are embedded arrays, the two
solutions will lead to the same in memory, i think, but are different
ways...
(i still hope, i understood your problem)
(btw, there's one thing that makes me stuck apart from the network
related design: the term "player" made me think of a game, so you want
to have a game in a network and you said that you want to resend data
which may not even be "up to date", so why resending that and not the
current data? but that's something, that depends on your game, i think...)
regards,
tobi
More information about the User
mailing list