Skip to content

Refactor Queue as a Template #56

@AsimmHirani

Description

@AsimmHirani

I think it would be a safer and more C++ style usage of the Queue's to take a template argument T and a runtime queue-size as the only constructor argument.

Something like:

struct MyEvent {
  uint32_t id;
  uint16_t element1;
  uint16_t element2;
};

...

cpp_freertos::Queue<MyEvent> event_queue(5); // Event queue that holds 5 MyEvents

The rationale here is the specialization makes the type that is inside the queue well known, and functions that return objects can now take T& instead of pointers, preventing null pointer errors at compile time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions