pointer to OBJ ?
janb
Posts: 74
Hi,
I know spin does not support pointers, so I'm asking if there is perhaps some tricks I could play to
immitated them.
The· SubEventF10· (attached) is a typical data block container with 3 memeber variables:
·var
·· byte myKey
·· byte len
·· byte data[noparse][[/noparse]mxLen]
and bunch of get/set methods:
.............
PUB clear
PUB addD(b) ' add one byte to Data
PUB getD(i) ' get one byte from Data
PUB size
PUB new(xkey)
PUB key
...........
I'd like to use array of this OBJ and manipulate sametimes only on one item. So the main program (which later on will be also a OBJ of higher level) would look like:
OBJ
·· eve[noparse][[/noparse]3]: "SubEventF10"
PUB· main |k
·· eve1:=@eve[noparse][[/noparse]1]
·· eve1.clear
·· eve1.addD(33)
Of course·it does not compile. I do not know how to define 'eve1' - the pointer to an element of type SubEventF10·
Is there any trick you could recommend to acomplish it in spin?
Thanks
Jan
I know spin does not support pointers, so I'm asking if there is perhaps some tricks I could play to
immitated them.
The· SubEventF10· (attached) is a typical data block container with 3 memeber variables:
·var
·· byte myKey
·· byte len
·· byte data[noparse][[/noparse]mxLen]
and bunch of get/set methods:
.............
PUB clear
PUB addD(b) ' add one byte to Data
PUB getD(i) ' get one byte from Data
PUB size
PUB new(xkey)
PUB key
...........
I'd like to use array of this OBJ and manipulate sametimes only on one item. So the main program (which later on will be also a OBJ of higher level) would look like:
OBJ
·· eve[noparse][[/noparse]3]: "SubEventF10"
PUB· main |k
·· eve1:=@eve[noparse][[/noparse]1]
·· eve1.clear
·· eve1.addD(33)
Of course·it does not compile. I do not know how to define 'eve1' - the pointer to an element of type SubEventF10·
Is there any trick you could recommend to acomplish it in spin?
Thanks
Jan
spin
586B
Comments