Open Lighting Architecture  0.9.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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  * UID 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  static CID Generate();
116 
122  static CID FromData(const uint8_t *data);
123 
128  static CID FromString(const std::string &cid);
129 
130  private:
131  class CIDImpl *m_impl;
132 
133  // Takes ownership;
134  explicit CID(class CIDImpl *impl);
135 };
136 } // namespace acn
137 } // namespace ola
138 
142 #endif // INCLUDE_OLA_ACN_CID_H_