Structure for monitoring lots of system variables of varying type
I am in need of some advice for a solution to a data storage problem we have at the place 开发者_如何学编程were I work.
The problem is as follows:
We have an embedded application which must monitor data from some equipment. The data is simple, such as status flags, single integer/floating variables indicating a setting/temperature/whatever, but we have hundreds of them.
What we are discussing now, is a simple way to store these variables in the application. Some parts of the system will read the equipment, and write their state to these variables. Other parts of the system will need to be notified when any of these variables change.
So basically a < Consumer > <-----> < Data Store > <-----> < Producer > structure.
As I have never worked on any professional software like this before (fresh out of university :) ) I was hoping there would be some brilliant people on these forums who could lend me their wisdom on how to aproach this problem.
What I have looked into so far, is:
SQLite: Very simple database, and easy to use. But perhaps it is overkill when the data to be stored doesnt really lend itself to a tabular structure?
Hashmaps: Simply store each data-lump with some key as index, then subscribe to changes on certain indices.
I hope I am making sense, and sorry for the wall of text :) Thanks in advance for the help.
With limited data, I'd say try the HashMap implementation using an Observer pattern like you mentioned. I think this may be a good approach because of two things:
- It seems that you're learning. Thus, it's important to be able to quickly churn something out just to see if it will work.
- It seems to be more simple (in terms of dependencies) than using SQLLite. In a fight in which theres a simple solution and a complex solution (and both accomplish the same thing), I'd bet on the simple solution.
You may want to have a look at the SNMP protocol.
精彩评论