Open Lighting Architecture  Latest Git
CID.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 2 of the License, or
5  * (at your option) any later version.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU Library General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
15  *
16  * CID.h
17  * The CID class, this just wraps a CIDImpl so we don't need to include all the
18  * UUID headers.
19  * Copyright (C) 2007 Simon Newton
20  */
21 
22 #ifndef INCLUDE_OLA_ACN_CID_H_
23 #define INCLUDE_OLA_ACN_CID_H_
24 
33 #include <stdint.h>
34 #include <ola/io/OutputBuffer.h>
35 #include <string>
36 
37 namespace ola {
38 namespace acn {
39 
47 class CID {
48  public :
52  enum {
53  CID_LENGTH = 16
54  };
55 
59  CID();
60 
64  CID(const CID& other);
65 
69  ~CID();
70 
74  bool IsNil() const;
75 
81  void Pack(uint8_t *output) const;
82 
90  std::string ToString() const;
91 
95  void Write(ola::io::OutputBufferInterface *output) const;
96 
100  CID& operator=(const CID& c1);
101 
105  bool operator==(const CID& c1) const;
106 
110  bool operator!=(const CID& c1) const;
111 
115  bool operator<(const CID& c1) const;
116 
120  static CID Generate();
121 
127  static CID FromData(const uint8_t *data);
128 
133  static CID FromString(const std::string &cid);
134 
135  private:
136  class CIDImpl *m_impl;
137 
138  // Takes ownership;
139  explicit CID(class CIDImpl *impl);
140 };
141 } // namespace acn
142 } // namespace ola
143 
147 #endif // INCLUDE_OLA_ACN_CID_H_
Definition: CIDImpl.h:49
Definition: OutputBuffer.h:36
Definition: CID.h:53
bool operator==(const CID &c1) const
Equality operator.
Definition: CID.cpp:53
void Pack(uint8_t *output) const
Pack a CID into the binary representation.
Definition: CID.cpp:44
The ACN component identifier.
Definition: CID.h:47
static CID FromString(const std::string &cid)
Create a new CID from a human readable string.
Definition: CID.cpp:84
bool operator<(const CID &c1) const
Less than operator.
Definition: CID.cpp:61
bool IsNil() const
Returns true if the CID is uninitialized.
Definition: CID.cpp:40
static CID FromData(const uint8_t *data)
Create a new CID from a binary representation.
Definition: CID.cpp:79
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44
~CID()
CID destructor.
Definition: CID.cpp:36
CID & operator=(const CID &c1)
Assignment operator.
Definition: CID.cpp:48
std::string ToString() const
Return the CID as a human readable string.
Definition: CID.cpp:65
CID()
Create a new uninitialized CID.
Definition: CID.cpp:30
bool operator!=(const CID &c1) const
Inequality operator.
Definition: CID.cpp:57
static CID Generate()
Generate a new CID.
Definition: CID.cpp:74
void Write(ola::io::OutputBufferInterface *output) const
Write the CID to an OutputBufferInterface.
Definition: CID.cpp:69