Infrared4Arduino 1.2.3
Loading...
Searching...
No Matches
IrSequence.h
Go to the documentation of this file.
1#pragma once
2
3#include "InfraredTypes.h"
4
12private:
13 const microseconds_t *durations = nullptr;
14 size_t length = 0U;
15
16public:
19
25 IrSequence(const microseconds_t *durations, size_t length);
26
27 virtual ~IrSequence();
28
33 IrSequence(const IrSequence& orig);
34
39 IrSequence(IrSequence&& orig);
40
45 IrSequence& operator=(const IrSequence& rhs);
46
52
54
59 operator bool() const { return ! isEmpty(); }
60
65 size_t getLength() const {
66 return length;
67 }
68
69 bool isEmpty() const {
70 return length == 0U;
71 }
72
74 return durations;
75 }
76
77 size_t size() const {
78 return length;
79 }
80
81 const microseconds_t* begin() const {
82 return durations;
83 }
84
85 const microseconds_t* end() const {
86 return durations + length;
87 }
88
90 return durations[i];
91 }
92
98 void dump(Stream& stream, bool usingSigns = false) const;
99
105 void dumpWithSigns(Stream& stream) const {
106 dump(stream, true);
107 };
108
109 // Do NOT put #ifdef HAS_FLASH_READ here, leads to circular includes.
119 static IrSequence* readFlash(const microseconds_t *flashData, size_t length);
120};
This file defines some general data types that are used in the library.
uint16_t microseconds_t
Type for durations in micro seconds.
Definition: InfraredTypes.h:15
This class consists of a vector of durations.
Definition: IrSequence.h:11
const microseconds_t * end() const
Definition: IrSequence.h:85
void dump(Stream &stream, bool usingSigns=false) const
Prints the IrSequence on the stream provided.
Definition: IrSequence.cpp:47
void dumpWithSigns(Stream &stream) const
Prints the IrSequence on the stream provided.
Definition: IrSequence.h:105
bool isEmpty() const
Definition: IrSequence.h:69
microseconds_t operator[](int i) const
Definition: IrSequence.h:89
static const IrSequence emptyInstance
Definition: IrSequence.h:53
const microseconds_t * begin() const
Definition: IrSequence.h:81
const microseconds_t * getDurations() const
Definition: IrSequence.h:73
virtual ~IrSequence()
Definition: IrSequence.cpp:41
static IrSequence * readFlash(const microseconds_t *flashData, size_t length)
Create an IrSequence from data in PROGMEM.
IrSequence()
Create an empty sequence.
Definition: IrSequence.h:18
size_t size() const
Definition: IrSequence.h:77
size_t getLength() const
Returns the number of durations.
Definition: IrSequence.h:65
IrSequence & operator=(const IrSequence &rhs)
Copy assignment.
Definition: IrSequence.cpp:31