View previous topic :: View next topic |
Author |
Message |
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
Help Deciding on Data Type |
Posted: Wed Oct 12, 2005 8:58 pm |
|
|
Hello All,
I'm trying to figure out how to deal with the following data issues...
I'll have about 150 "items" predefined and each will have the following attributes:
Code: |
unit_number int16 //condo unit number
cable_number int8 //ribbon cable LEDs are on
group_number int8 //group of 8 on the cable
bit_mask int8 //bits that make-up the units LEDs
|
I need to be able to do the following things with the items and attributes:
Search by unit number
Access the bitmask value to generate a WRITE_SPI
Preload or predefine all the values for each item & attribute
I was going to make a structure, but how would you predefine all the values prior to compilation?
I was thinking of an array of int8s, but the unit number's requirement to be an int16 threw me....
Could the experts help me?
Thanks,
John |
|
|
jecottrell
Joined: 16 Jan 2005 Posts: 559 Location: Tucson, AZ
|
|
Posted: Wed Oct 12, 2005 10:35 pm |
|
|
OK, tell me if this is a really awkward way of handling the issue at hand.
I will create and populate an int16 array of the unit numbers.
I will create and populate a 2 dimensional int8 array of the other data that goes along with the unit number. (I will ensure that the data for each unit has the same index as its associated unit.)
When I need the data for a unit I will search the unit array to deduce the index for that unit. I'll then use that index to access the other array to extract the data....
Creative problem solving? or hideous abortion of coding?
Thanks,
John |
|
|
|