Open Lighting Architecture  Latest Git
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
CIDImpl.h
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  * CIDImpl.h
17  * The actual implementation of a CID. The implementation changes based on
18  * which uuid library is installed.
19  * Copyright (C) 2007 Simon Newton
20  */
21 
22 #ifndef LIBS_ACN_CIDIMPL_H_
23 #define LIBS_ACN_CIDIMPL_H_
24 
25 #if HAVE_CONFIG_H
26 #include <config.h>
27 #endif // HAVE_CONFIG_H
28 
29 #include <stdint.h>
30 
31 #ifdef HAVE_OSSP_UUID_H
32 #include <ossp/uuid.h>
33 #else
34 #ifdef HAVE_UUID_UUID_H
35 #include <uuid/uuid.h>
36 #else
37 #include <uuid.h>
38 #endif // HAVE_UUID_UUID_H
39 #endif // HAVE_OSSP_UUID_H
40 
41 #include <iostream>
42 #include <string>
43 
44 #include "ola/io/OutputBuffer.h"
45 
46 namespace ola {
47 namespace acn {
48 
49 class CIDImpl {
50  public :
51  enum { CIDImpl_LENGTH = 16 };
52 
53  CIDImpl();
54  CIDImpl(const CIDImpl& other);
55  ~CIDImpl();
56 
57  bool IsNil() const;
58  void Pack(uint8_t *buf) const;
59  std::string ToString() const;
60  void Write(ola::io::OutputBufferInterface *output) const;
61 
62  CIDImpl& operator=(const CIDImpl& c1);
63  bool operator==(const CIDImpl& c1) const;
64  bool operator!=(const CIDImpl& c1) const;
65  bool operator<(const CIDImpl& c1) const;
66 
67  static CIDImpl* Generate();
68  static CIDImpl* FromData(const uint8_t *data);
69  static CIDImpl* FromString(const std::string &cid);
70 
71  private:
72 #ifdef USE_OSSP_UUID
73  uuid_t *m_uuid;
74  explicit CIDImpl(uuid_t *uuid);
75 #else
76  uuid_t m_uuid;
77  explicit CIDImpl(uuid_t uuid);
78 #endif // HAVE_OSSP_UUID
79 };
80 } // namespace acn
81 } // namespace ola
82 #endif // LIBS_ACN_CIDIMPL_H_
Definition: CIDImpl.h:49
Definition: OutputBuffer.h:36
The namespace containing all OLA symbols.
Definition: Credentials.cpp:44