Infrared4Arduino
IrSequence.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "InfraredTypes.h"
4 
11 class IrSequence {
12 private:
13  const microseconds_t *durations;
14  size_t length;
15  bool toBeFreed;
16 
17 public:
19  IrSequence();
20 
27  IrSequence(const microseconds_t *durations, size_t length, bool toBeFreed = false);
28 
29  virtual ~IrSequence();
30 
35  IrSequence(const IrSequence& orig);
36 
42  IrSequence(const IrSequence& orig, bool toBeFreed);
43 
48  size_t getLength() const {
49  return length;
50  }
51 
52  bool isEmpty() const {
53  return length == 0;
54  }
55 
56  const microseconds_t *getDurations() const {
57  return durations;
58  }
59 
65  IrSequence *clone() const;
66 
72  void dump(Stream& stream, bool usingSigns = false) const;
73 
79  void dumpWithSigns(Stream& stream) const {
80  dump(stream, true);
81  };
82 
83 #ifdef ARDUINO
84  static IrSequence* readFlash(const microseconds_t *flashData, size_t length);
85 #endif
86 };
uint16_t microseconds_t
Type for durations in micro seconds.
Definition: InfraredTypes.h:15
void dumpWithSigns(Stream &stream) const
Prints the IrSequence on the stream provided.
Definition: IrSequence.h:79
const microseconds_t * getDurations() const
Definition: IrSequence.h:56
IrSequence * clone() const
Creates a (deep) clone of the current object.
Definition: IrSequence.cpp:22
static IrSequence * readFlash(const microseconds_t *flashData, size_t length)
Definition: IrSequence.cpp:40
size_t getLength() const
Returns the length of the data.
Definition: IrSequence.h:48
void dump(Stream &stream, bool usingSigns=false) const
Prints the IrSequence on the stream provided.
Definition: IrSequence.cpp:28
This class consists of a vector of durations.
Definition: IrSequence.h:11
virtual ~IrSequence()
Definition: IrSequence.cpp:17
This file defines some general data types that are used in the library.
bool isEmpty() const
Definition: IrSequence.h:52
IrSequence()
Create an empty sequence.
Definition: IrSequence.cpp:4