Mir
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
platform
mir
graphics
buffer_id.h
Go to the documentation of this file.
1
/*
2
* Copyright © 2012 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Kevin DuBois <kevin.dubois@canonical.com>
17
*/
18
#ifndef MIR_GRAPHICS_BUFFER_ID_H_
19
#define MIR_GRAPHICS_BUFFER_ID_H_
20
21
#include <cstdint>
22
23
namespace
mir
24
{
25
namespace
graphics
26
{
27
class
BufferID
28
{
29
public
:
30
BufferID
() : value(id_invalid){}
31
explicit
BufferID
(uint32_t val) : value(val) {}
32
bool
is_valid
()
const
{
return
(id_invalid != value); }
33
uint32_t
as_uint32_t
()
const
{
return
value; };
34
35
private
:
36
uint32_t value;
37
static
const
uint32_t id_invalid = 0;
38
};
39
40
inline
bool
operator <
(
BufferID
const
& lhs,
BufferID
const
& rhs)
41
{
42
return
lhs.
as_uint32_t
() < rhs.
as_uint32_t
();
43
}
44
45
inline
bool
operator ==
(
BufferID
const
& lhs,
BufferID
const
& rhs)
46
{
47
return
lhs.
as_uint32_t
() == rhs.
as_uint32_t
();
48
}
49
inline
bool
operator !=
(
BufferID
const
& lhs,
BufferID
const
& rhs)
50
{
51
return
lhs.
as_uint32_t
() != rhs.
as_uint32_t
();
52
}
53
54
}
55
}
56
#endif
/* MIR_GRAPHICS_BUFFER_ID_H_ */
Copyright © 2012,2013 Canonical Ltd.
Generated on Tue Oct 15 00:23:28 UTC 2013