Apache Mesos
log.hpp
Go to the documentation of this file.
1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef __MESSAGES_LOG_HPP__
18 #define __MESSAGES_LOG_HPP__
19 
20 #include <ostream>
21 
22 #include "messages/log.pb.h"
23 
24 
25 // Definitions for operators on protobuf classes that don't have these
26 // operators generated by the protobuf compiler.
27 
28 namespace mesos {
29 namespace internal {
30 namespace log {
31 
32 inline std::ostream& operator<<(
33  std::ostream& stream,
34  const Action::Type& type)
35 {
36  return stream << Action::Type_Name(type);
37 }
38 
39 
40 inline std::ostream& operator<<(
41  std::ostream& stream,
42  const Metadata::Status& status)
43 {
44  return stream << Metadata::Status_Name(status);
45 }
46 
47 } // namespace log {
48 } // namespace internal {
49 } // namespace mesos {
50 
51 namespace std {
52 
53 template <>
54 struct hash<mesos::internal::log::Metadata_Status>
55 {
56  typedef size_t result_type;
57 
58  typedef mesos::internal::log::Metadata_Status argument_type;
59 
60  result_type operator()(const argument_type& status) const
61  {
62  // Use the underlying type of the enum as hash value.
63  return static_cast<size_t>(status);
64  }
65 };
66 
67 } // namespace std {
68 
69 #endif // __MESSAGES_LOG_HPP__
Result< ProcessStatus > status(pid_t pid)
Definition: proc.hpp:166
Definition: type_utils.hpp:550
std::ostream & operator<<(std::ostream &stream, const Action::Type &type)
Definition: log.hpp:32
Definition: spec.hpp:26
mesos::internal::log::Metadata_Status argument_type
Definition: log.hpp:58
result_type operator()(const argument_type &status) const
Definition: log.hpp:60
Definition: attributes.hpp:24
Type
Definition: capabilities.hpp:79
Try< uint32_t > type(const std::string &path)