私は、テレビの録画をスケジュールするための PVR バックエンドに取り組んでおり、関連するすべての情報を含む単純なデータベースを保持する最良の方法を見つけようとしています。私は怠け者のプロトタイプ (以下を参照) をまとめましたが、巨大な配列を静的に割り当ててから、それらのオブジェクトの RAM の内容をディスクにダンプしてストレージに保存したくはありません。
次の怠惰な/悪い習慣のプロトタイプを考えると、私の最良の選択肢は何ですか? 経験豊富なプログラマーは、このようなことをどのように選択するでしょうか? toString/fromString 関数を使用せずにすべてを行うとしたら、どうすればよいでしょうか?
struct Recording{
Date date;
int channel;
int length; //length in hours, minutes, or seconds
bool is_interlaced; //if true, denotes that the episode is interlaced
bool done; //if true, denotes that the episode has been recorded
bool record_successful; //Currently unused
};
struct TV_Episode{
struct Recording recording;
char title[128]; //Episode Title
char season; //Season number
char episode; //Episode number
};
struct TV_Show{
char name[64]; //TV Show name
char numepisodes; //The number of episodes in the array
struct TV_Episode episodes[100]; //Array containing airings of a TV show
};
struct Movie{
struct Recording recording;
char title[128]; //Movie Title, optionally including the year in brackets
};
struct Recordings_DB{ /*
* Obviously these types can be done away with using inheritance
* and the Recordings_DB type can be done away with using a vector.
* They are just here to illustrate the concept.
*/
struct TV_Show shows[20];
struct Movie movies[20];
};