DevSlashLirc
IrSequence.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <sys/types.h>
4 #include <stdint.h>
5 #include <iostream>
6 
7 #include "InfraredTypes.h"
8 
15 class IrSequence {
16 private:
17  const microseconds_t *durations;
18  size_t length;
19  bool toBeFreed;
20 
21 public:
23  IrSequence();
24 
31  IrSequence(const microseconds_t *durations, size_t length, bool toBeFreed = false);
32 
33  virtual ~IrSequence();
34 
39  IrSequence(const IrSequence& orig);
40 
46  IrSequence(const IrSequence& orig, bool toBeFreed);
47 
52  size_t getLength() const {
53  return length;
54  }
55 
56  bool isEmpty() const {
57  return length == 0;
58  }
59 
60  const microseconds_t *getDurations() const {
61  return durations;
62  }
63 
65 
71  IrSequence *clone() const;
72 
78  void dump(std::ostream& stream = std::cout, bool usingSigns = false) const;
79 
85  void dumpWithSigns(std::ostream& stream = std::cout) const {
86  dump(stream, true);
87  };
88 
89  const char* toString() const;
90 };
const microseconds_t * getDurations() const
Definition: IrSequence.h:60
IrSequence * clone() const
Creates a (deep) clone of the current object.
Definition: IrSequence.cpp:24
void dumpWithSigns(std::ostream &stream=std::cout) const
Prints the IrSequence on the stream provided.
Definition: IrSequence.h:85
const char * toString() const
Definition: IrSequence.cpp:41
size_t getLength() const
Returns the length of the data.
Definition: IrSequence.h:52
microseconds_t getTotalDuration() const
Definition: IrSequence.cpp:50
uint32_t microseconds_t
Type for durations in micro seconds.
Definition: InfraredTypes.h:20
This class consists of a vector of durations.
Definition: IrSequence.h:15
void dump(std::ostream &stream=std::cout, bool usingSigns=false) const
Prints the IrSequence on the stream provided.
Definition: IrSequence.cpp:30
virtual ~IrSequence()
Definition: IrSequence.cpp:19
This file defines some general data types that are used in the library.
bool isEmpty() const
Definition: IrSequence.h:56
IrSequence()
Create an empty sequence.
Definition: IrSequence.cpp:6