Fun thing about #define


#1

..is the possiblity to pass object references to other objects.
so,if you have one object that references 5 tables, you can pass this knowledge on
to other objects that also need to know about these tables, automagically.
maybe this is really whacky coding, but it works and saves a lot of patching or creating 'singletons'

patch: define.axp (7.7 KB)


#2

Very interesting.

Could use ONE load/save object to control 4 tables, by referring the the master object in all 4 tables? And all table data would be saved to same file? Or different files?

Just curious about specific use cases :slight_smile:


#3

hmm,

you can create a save/load object that's referring to ONE master object
which references the 4 tables, and saves them one after the other, to different files.
this will spare you having to reference tables via object attributes all over the place,
and simply make patching less confusing (aside from saving some SRAM,of course)

what you cannot do is to save data from different tables to the same file.
if you wanted to do this, you would have to merge the 4 tables into 1,first.
('fatfs' simply won't let you do this, and it makes sense)

also,hmm, I don't see a use-case for this, but maybe I'm just to focused on
my specific use-case:
what I'm working on is basically a 'master-object' that references
a large 16-bit sample-data table (to have a lot of sampling- time available)
and a small 32-bit table which holds all the start/end/etc info of all the samples.

the 2 tables need to be accesible by other objects (some just provide information
about a specific sample, others are handling SD-card I/O of the entire setup),
so the other objects only need to reference the 'master-object'.