FastLED 3.9.15
Loading...
Searching...
No Matches
bytestream.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stdint.h"
4
5#include "fl/namespace.h"
6#include "fl/memory.h"
7#include "fl/int.h"
8
9#include "crgb.h"
10
11namespace fl {
12
14
15// An abstract class that represents a stream of bytes.
17 public:
18 virtual ~ByteStream() {}
19 virtual bool available(fl::size) const = 0;
20 virtual fl::size read(fl::u8 *dst, fl::size bytesToRead) = 0;
21 virtual const char *path() const = 0;
22 virtual void close() {} // default is do nothing on close.
23 // convenience functions
24 virtual fl::size readCRGB(CRGB *dst, fl::size n) {
25 return read((fl::u8 *)dst, n * 3) / 3;
26 }
27};
28
29} // namespace fl
virtual fl::size readCRGB(CRGB *dst, fl::size n)
Definition bytestream.h:24
virtual bool available(fl::size) const =0
virtual ~ByteStream()
Definition bytestream.h:18
virtual void close()
Definition bytestream.h:22
virtual const char * path() const =0
virtual fl::size read(fl::u8 *dst, fl::size bytesToRead)=0
Defines the red, green, and blue (RGB) pixel struct.
Implements the FastLED namespace macros.
unsigned char u8
Definition int.h:17
int read()
Definition io.cpp:148
IMPORTANT!
Definition crgb.h:20
#define FASTLED_SMART_PTR(type)
Definition ptr.h:33
Representation of an RGB pixel (Red, Green, Blue)
Definition crgb.h:86