Skip to content

handle_byte

Alexandre Marcireau edited this page Jun 3, 2018 · 3 revisions

In header "../third_party/sepia/source/sepia.hpp"

sepia::handle_byte implements the Event Stream state machine associated with each event type. It has a signature equivalent to:

namespace sepia {
    template <type event_stream_type>
    class handle_byte {
        handle_byte(uint16_t width, uint16_t height);
        handle_byte(); // only available if event_stream_type is type::generic     

        /// operator() handles a byte.
        virtual bool operator()(uint8_t byte, event<event_stream_type>& event);

        /// reset initializes the state machine.
        virtual void reset();
    };
}
  • byte is the next byte to handle from the raw stream.
  • event is managed by the calling function, but its fields are set by handle_byte::operator(). If the given byte completes an event, the function returns true: the event is ready for dispatching.
Clone this wiki locally