Implement a circular buffer (ring buffer) in C++ that is suitable for a high-throughput interrupt service routine at Motorola Solutions.