Lumiera 0.pre.04~rc.1
»edit your freedom«
Loading...
Searching...
No Matches
buffer-local-tag.hpp
Go to the documentation of this file.
1/*
2 BUFFER-LOCAL-TAG.hpp - opaque data for BufferProvider implementation
3
4 Copyright (C)
5 2011, Hermann Vosseler <Ichthyostega@web.de>
6
7  **Lumiera** is free software; you can redistribute it and/or modify it
8  under the terms of the GNU General Public License as published by the
9  Free Software Foundation; either version 2 of the License, or (at your
10  option) any later version. See the file COPYING for further details.
11
12*/
13
14
20#ifndef STEAM_ENGINE_BUFFR_LOCAL_TAG_H
21#define STEAM_ENGINE_BUFFR_LOCAL_TAG_H
22
23
24#include "lib/error.hpp"
25#include "lib/hash-value.h"
26
27#include <boost/functional/hash.hpp>
28
29
30namespace steam {
31namespace engine {
32
33 namespace metadata {
34 class Key;
35 class Entry;
36 }
37 class BufferMetadata;
38
39 using lib::HashVal;
40
41
42
50 {
52 {
53 uint64_t _as_number;
55 };
56
58
59 public:
60 explicit
61 LocalTag (uint64_t opaqueValue=0)
62 {
63 privateID_._as_number = opaqueValue;
64 }
65
66 LocalTag (void* impl_related_ptr)
67 {
69 privateID_._as_pointer = impl_related_ptr;
70 }
71
72 LocalTag (LocalTag const&) = default;
73
75 static const LocalTag UNKNOWN;
76
77 operator uint64_t() const
78 {
80 }
81
82 operator void*() const
83 {
85 }
86
87 explicit
88 operator bool() const
89 {
90 return bool(privateID_._as_number);
91 }
92
93 friend size_t
94 hash_value (LocalTag const& lkey)
95 {
96 boost::hash<uint64_t> hashFunction;
97 return hashFunction(lkey.privateID_._as_number);
98 }
99
100 friend bool
101 operator== (LocalTag const& left, LocalTag const& right)
102 {
103 return uint64_t(left) == uint64_t(right);
104 }
105 friend bool
106 operator!= (LocalTag const& left, LocalTag const& right)
107 {
108 return uint64_t(left) != uint64_t(right);
109 }
110
111
112 private:
115 {
117 return *this;
118 }
119
121 friend class metadata::Key;
122 };
123
124
125}} // namespace steam::engine
126#endif /*STEAM_ENGINE_BUFFR_LOCAL_TAG_H*/
Registry for managing buffer metadata.
an opaque mark to be used by the BufferProvider implementation.
LocalTag(void *impl_related_ptr)
friend size_t hash_value(LocalTag const &lkey)
LocalTag & operator=(LocalTag const &o)
assignment usually prohibited
friend bool operator!=(LocalTag const &left, LocalTag const &right)
LocalTag(LocalTag const &)=default
LocalTag(uint64_t opaqueValue=0)
static const LocalTag UNKNOWN
Marker when no distinct local key is given.
friend bool operator==(LocalTag const &left, LocalTag const &right)
A complete metadata Entry, based on a Key.
Description of a Buffer-"type".
Lumiera error handling (C++ interface).
Hash value types and utilities.
size_t HashVal
a STL compatible hash value
Definition hash-value.h:52
Steam-Layer implementation namespace root.