c - How to program these structures? -
i have 3 objects, (at moment) representing structs:
- a
dataset - a
datasetwindow - a
movingwindow
and variable windowsize
there may multiple dataset's , each should have it's own datasetwindow. ok, fair enough, me sounds make datasetwindow struct , put member of dataset struct
there 1 movingwindow, should know dataset's. ok, far seems pretty simple. create struct movingwindow , has pointer dataset. (an array of datasets).
so far, have this:
typedef struct { int *buffer; int someothermember; } datasetwindow; typedef struct { int somemember; datasetwindow *window; //pointer datasetwindow obj. } dataset; typedef struct { int offset; int somemember; dataset *datasets; //array of dataset } movingwindow; the part having trouble this: movingwindow should know windowsize, should each datasetwindow. dataset should preferably not need know windowsize is.
i don't know how arrange structures support this?
you can modify definitions of structs movingwindow , datasetwindow incorporate member (pointer or interger variable) holding value of windowsize.