1

I have been working on embedded software. One of the requirements is also communication over CAN via proprietary protocol. The core of the communication protocol is a communication table which contains all the communicated variables. Each variable has additional informations e.g. identification number, name, scaling coeficient and so on.

This communication table is divided into so called blocks and each block consists of several so called records. One record contains information about one variable.

Neither the blocks nor the records in one block doesn't constitute continuous sequence of numbers. There are "gaps" between the block numbers and record numbers. So the table may looks like for example in this manner:

block 13: record 01, record 04, record 08; block 15: record 02, record 03; block 18: record 06

I have been thinking about sutaible data structure for implentation of such a table. My first idea was a one dimensional array containig structures with description of each data block. It means block number, number of records in this block and pointer to first record in block. Each block will be implemented as one dimensional array containing individual records as structures containing value, name, scaling coeficient and so on.

The software is written in C++ so I have been also thinking about two dimensional array of objects (each record will be implemented as an instance of Record class).

I need searching in this table very often so I have decided to utilize the fact that the blocks and records in one block are always sorted in ascendent manner according to their identification number and I am going to implement the binary search algorithm.

I would very appreciated any assesment of my idea. Thanks in advance for any suggestions.

Steve
  • 805
  • 7
  • 27

0 Answers0