what is the best approach
i have some compress data from some number of sensors and I want to decompress it and display it to the user, the dispaying (plotting ) an uncompressed data class is done ,now handling the compress data is my problem. how can i approach in an object oriented way ? here is what i think but i don't know how to implement it or is it possible to implement this architecture
Class Sensor <--- base class of a sensor
Class Samples <--- this should contain variable number of Sensor (class)
Class Frame <-- this should contain a fix number of Samples (class)
so when i use frame class ill give it pointer to my compressed data
i.e.
Code:
new Frame(&buffer);
the class sample will decode/uncompress his part of the buffer then the base class sensor will decode his part of the buffer
is there any other good way to it ?
baray98
Re: what is the best approach
I think adding compress() / uncompress() functions would be elegant, and providing the constructor you wrote as syntactic sugar is already the best practice. At least that is how I usually do it:
Code:
class myclass
{
public:
MyClass();
~MyClass():
MyClass(CompressedData& data);
compress(CompressedData& data) const; // or serialize() ... or save() ...
uncompress(CompressedData& data);
// ...
};