Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(769)

Side by Side Diff: mojo/edk/system/ports/name.h

Issue 2515483002: Move const PortName data out of header file (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/edk/system/ports/name.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_EDK_SYSTEM_PORTS_NAME_H_ 5 #ifndef MOJO_EDK_SYSTEM_PORTS_NAME_H_
6 #define MOJO_EDK_SYSTEM_PORTS_NAME_H_ 6 #define MOJO_EDK_SYSTEM_PORTS_NAME_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <ostream> 10 #include <ostream>
(...skipping 22 matching lines...) Expand all
33 return std::tie(a.v1, a.v2) < std::tie(b.v1, b.v2); 33 return std::tie(a.v1, a.v2) < std::tie(b.v1, b.v2);
34 } 34 }
35 35
36 std::ostream& operator<<(std::ostream& stream, const Name& name); 36 std::ostream& operator<<(std::ostream& stream, const Name& name);
37 37
38 struct PortName : Name { 38 struct PortName : Name {
39 PortName() : Name(0, 0) {} 39 PortName() : Name(0, 0) {}
40 PortName(uint64_t v1, uint64_t v2) : Name(v1, v2) {} 40 PortName(uint64_t v1, uint64_t v2) : Name(v1, v2) {}
41 }; 41 };
42 42
43 const PortName kInvalidPortName = {0, 0}; 43 extern const PortName kInvalidPortName;
44 44
45 struct NodeName : Name { 45 struct NodeName : Name {
46 NodeName() : Name(0, 0) {} 46 NodeName() : Name(0, 0) {}
47 NodeName(uint64_t v1, uint64_t v2) : Name(v1, v2) {} 47 NodeName(uint64_t v1, uint64_t v2) : Name(v1, v2) {}
48 }; 48 };
49 49
50 const NodeName kInvalidNodeName = {0, 0}; 50 extern const NodeName kInvalidNodeName;
51 51
52 } // namespace ports 52 } // namespace ports
53 } // namespace edk 53 } // namespace edk
54 } // namespace mojo 54 } // namespace mojo
55 55
56 namespace std { 56 namespace std {
57 57
58 template <> 58 template <>
59 struct hash<mojo::edk::ports::PortName> { 59 struct hash<mojo::edk::ports::PortName> {
60 std::size_t operator()(const mojo::edk::ports::PortName& name) const { 60 std::size_t operator()(const mojo::edk::ports::PortName& name) const {
61 return base::HashInts64(name.v1, name.v2); 61 return base::HashInts64(name.v1, name.v2);
62 } 62 }
63 }; 63 };
64 64
65 template <> 65 template <>
66 struct hash<mojo::edk::ports::NodeName> { 66 struct hash<mojo::edk::ports::NodeName> {
67 std::size_t operator()(const mojo::edk::ports::NodeName& name) const { 67 std::size_t operator()(const mojo::edk::ports::NodeName& name) const {
68 return base::HashInts64(name.v1, name.v2); 68 return base::HashInts64(name.v1, name.v2);
69 } 69 }
70 }; 70 };
71 71
72 } // namespace std 72 } // namespace std
73 73
74 #endif // MOJO_EDK_SYSTEM_PORTS_NAME_H_ 74 #endif // MOJO_EDK_SYSTEM_PORTS_NAME_H_
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/ports/name.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698