]> git.sesse.net Git - casparcg/blob - server/utils/ID.h
bee7e30c0125fd6c62fa4071f8603a018c42e373
[casparcg] / server / utils / ID.h
1 /*\r
2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 *  This file is part of CasparCG.\r
5 *\r
6 *    CasparCG is free software: you can redistribute it and/or modify\r
7 *    it under the terms of the GNU General Public License as published by\r
8 *    the Free Software Foundation, either version 3 of the License, or\r
9 *    (at your option) any later version.\r
10 *\r
11 *    CasparCG is distributed in the hope that it will be useful,\r
12 *    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 *    GNU General Public License for more details.\r
15 \r
16 *    You should have received a copy of the GNU General Public License\r
17 *    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
18 *\r
19 */\r
20  \r
21 #ifndef _ID_H_\r
22 #define _ID_H_\r
23 \r
24 namespace caspar\r
25 {\r
26         namespace utils\r
27         {\r
28                 class ID \r
29                 {                       \r
30                 public:\r
31                         typedef long long value_type;\r
32 \r
33                         ID();\r
34                         const value_type& Value() const;\r
35                         static ID Generate(void* ptr);\r
36                 private:\r
37                         value_type value_; \r
38                 };\r
39 \r
40                 class Identifiable\r
41                 {\r
42                 public:\r
43                         Identifiable();\r
44                         virtual ~Identifiable(){}\r
45                         const utils::ID& ID() const;\r
46                 private:\r
47                         const utils::ID id_;\r
48                 };\r
49 \r
50                 bool operator==(const ID& lhs,const ID& rhs);\r
51                 bool operator!=(const ID& lhs,const ID& rhs);\r
52         }\r
53 }\r
54 \r
55 #endif