Skip to content

Instantly share code, notes, and snippets.

@Dalrik
Created November 11, 2014 03:31
Show Gist options
  • Save Dalrik/f163f362cf87ccc7ffa3 to your computer and use it in GitHub Desktop.
Save Dalrik/f163f362cf87ccc7ffa3 to your computer and use it in GitHub Desktop.
How to results array properly
class PipeExampleModule : public Module {
...
union {
struct pipe_results pr;
struct pipe_results2 pr2;
struct pipe_results3 pr3;
} results[NUMBER_PIPES];
...
// Nothing needed in constructor or destructor
...
Status process_image(Image *image) {
...
for (uint i = 0; i < NUMBER_PIPES; i++){
memset(&results[i], 0, sizeof(struct pipe_results));
...
results[i].pr.center_x = box.center.x;
results[i].pr.center_y = box.center.y;
...
}
...
shm_setg(pipe_results, results[0].pr);
shm_setg(pipe_results2, results[1].pr2);
shm_setg(pipe_results3, results[2].pr3);
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment