You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by mp...@apache.org on 2016/01/04 11:43:21 UTC
[1/5] mesos git commit: Cleaned up STL I/O includes.
Repository: mesos
Updated Branches:
refs/heads/master 68d4fc33a -> 440eb96ee
Cleaned up STL I/O includes.
Moved `operator<<` definitions to implementation files and
include <iosfwd> in headers.
Review: https://reviews.apache.org/r/41513/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/440eb96e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/440eb96e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/440eb96e
Branch: refs/heads/master
Commit: 440eb96ee735b44741bf106677c8346ac2436aed
Parents: fcadd2d
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Jan 4 02:26:31 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 4 02:37:22 2016 -0800
----------------------------------------------------------------------
src/linux/perf.cpp | 2 +-
src/linux/routing/filter/ip.cpp | 9 +++++++++
src/linux/routing/filter/ip.hpp | 9 ++-------
src/linux/routing/handle.cpp | 12 +++++++++++-
src/linux/routing/handle.hpp | 8 ++------
src/messages/messages.cpp | 15 ++++++++++++---
src/messages/messages.hpp | 15 +++++----------
7 files changed, 42 insertions(+), 28 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/linux/perf.cpp
----------------------------------------------------------------------
diff --git a/src/linux/perf.cpp b/src/linux/perf.cpp
index 8ee9f38..9dd8ca4 100644
--- a/src/linux/perf.cpp
+++ b/src/linux/perf.cpp
@@ -23,7 +23,7 @@
#include <sys/wait.h>
#include <list>
-#include <ostream>
+#include <sstream>
#include <tuple>
#include <vector>
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/linux/routing/filter/ip.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/ip.cpp b/src/linux/routing/filter/ip.cpp
index 158bab6..7283008 100644
--- a/src/linux/routing/filter/ip.cpp
+++ b/src/linux/routing/filter/ip.cpp
@@ -20,6 +20,8 @@
#include <netlink/route/cls/u32.h>
+#include <ostream>
+
#include <stout/error.hpp>
#include <stout/none.hpp>
@@ -32,6 +34,7 @@
#include "linux/routing/filter/ip.hpp"
#include "linux/routing/filter/priority.hpp"
+using std::ostream;
using std::string;
using std::vector;
@@ -452,6 +455,12 @@ Try<PortRange> PortRange::fromBeginMask(uint16_t begin, uint16_t mask)
}
+ostream& operator<<(ostream& stream, const PortRange& range)
+{
+ return stream << "[" << range.begin() << "," << range.end() << "]";
+}
+
+
Try<bool> exists(
const string& link,
const Handle& parent,
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/linux/routing/filter/ip.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/filter/ip.hpp b/src/linux/routing/filter/ip.hpp
index 1a63dcc..ee416bc 100644
--- a/src/linux/routing/filter/ip.hpp
+++ b/src/linux/routing/filter/ip.hpp
@@ -19,7 +19,7 @@
#include <stdint.h>
-#include <iostream>
+#include <iosfwd>
#include <string>
#include <vector>
@@ -82,12 +82,7 @@ private:
};
-inline std::ostream& operator<<(
- std::ostream& stream,
- const PortRange& range)
-{
- return stream << "[" << range.begin() << "," << range.end() << "]";
-}
+std::ostream& operator<<(std::ostream& stream, const PortRange& range);
struct Classifier
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/linux/routing/handle.cpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/handle.cpp b/src/linux/routing/handle.cpp
index e88c6eb..3d8d2f1 100644
--- a/src/linux/routing/handle.cpp
+++ b/src/linux/routing/handle.cpp
@@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <ios>
+#include <ostream>
#include <string>
#include <vector>
@@ -22,12 +24,13 @@
#include "handle.hpp"
+using std::ostream;
using std::string;
using std::vector;
namespace routing {
-Try<Handle> Handle::parse(const std::string& str)
+Try<Handle> Handle::parse(const string& str)
{
if (str == "root") {
return EGRESS_ROOT;
@@ -53,4 +56,11 @@ Try<Handle> Handle::parse(const std::string& str)
return Handle(primary.get(), secondary.get());
}
+
+ostream& operator<<(ostream& out, const Handle& handle)
+{
+ out << std::hex << handle.primary() << ":" << handle.secondary() << std::dec;
+ return out;
+}
+
} // namespace routing {
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/linux/routing/handle.hpp
----------------------------------------------------------------------
diff --git a/src/linux/routing/handle.hpp b/src/linux/routing/handle.hpp
index 5b03be5..bafeec2 100644
--- a/src/linux/routing/handle.hpp
+++ b/src/linux/routing/handle.hpp
@@ -19,7 +19,7 @@
#include <stdint.h>
-#include <ostream>
+#include <iosfwd>
#include <netlink/route/tc.h>
@@ -70,11 +70,7 @@ protected:
};
-inline std::ostream& operator<<(std::ostream& out, const Handle& handle)
-{
- out << std::hex << handle.primary() << ":" << handle.secondary() << std::dec;
- return out;
-}
+std::ostream& operator<<(std::ostream& out, const Handle& handle);
// Packets flowing from the device driver to the network stack are
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/messages/messages.cpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.cpp b/src/messages/messages.cpp
index 30f55bb..89deee3 100644
--- a/src/messages/messages.cpp
+++ b/src/messages/messages.cpp
@@ -16,9 +16,13 @@
#include "messages/messages.hpp"
+#include <ostream>
+
#include <mesos/resources.hpp>
#include <mesos/type_utils.hpp>
+using std::ostream;
+
namespace mesos {
namespace internal {
@@ -49,9 +53,7 @@ bool operator==(const Task& left, const Task& right)
}
-std::ostream& operator<<(
- std::ostream& stream,
- const StatusUpdate& update)
+ostream& operator<<(ostream& stream, const StatusUpdate& update)
{
stream << update.status().state()
<< (update.has_uuid()
@@ -67,5 +69,12 @@ std::ostream& operator<<(
return stream << " of framework " << update.framework_id();
}
+
+ostream& operator<<(ostream& stream, const StatusUpdateRecord::Type& type)
+{
+ return stream
+ << StatusUpdateRecord::Type_descriptor()->FindValueByNumber(type)->name();
+}
+
} // namespace internal {
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/440eb96e/src/messages/messages.hpp
----------------------------------------------------------------------
diff --git a/src/messages/messages.hpp b/src/messages/messages.hpp
index 3501183..695ed2d 100644
--- a/src/messages/messages.hpp
+++ b/src/messages/messages.hpp
@@ -21,7 +21,7 @@
#include <google/protobuf/io/zero_copy_stream_impl.h> // For ArrayInputStream.
-#include <ostream>
+#include <iosfwd>
#include <string>
#include <stout/error.hpp>
@@ -69,17 +69,12 @@ namespace internal {
bool operator==(const Task& left, const Task& right);
-std::ostream& operator<<(
- std::ostream& stream,
- const StatusUpdate& update);
+std::ostream& operator<<(std::ostream& stream, const StatusUpdate& update);
+
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const StatusUpdateRecord::Type& type)
-{
- return stream
- << StatusUpdateRecord::Type_descriptor()->FindValueByNumber(type)->name();
-}
+ const StatusUpdateRecord::Type& type);
} // namespace internal {
} // namespace mesos {
[5/5] mesos git commit: Cleaned up STL I/O includes in external
containerizer.
Posted by mp...@apache.org.
Cleaned up STL I/O includes in external containerizer.
Removed unused I/O includes, cleaned up blank lines and include order.
Review: https://reviews.apache.org/r/41510/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/e8d3ab1e
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/e8d3ab1e
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/e8d3ab1e
Branch: refs/heads/master
Commit: e8d3ab1ebdd8b96cd4dbb665639f84265f00ded2
Parents: d3a5a61
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Jan 4 02:25:25 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 4 02:37:22 2016 -0800
----------------------------------------------------------------------
src/slave/containerizer/external_containerizer.cpp | 15 +++++----------
src/slave/containerizer/external_containerizer.hpp | 1 -
2 files changed, 5 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/e8d3ab1e/src/slave/containerizer/external_containerizer.cpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.cpp b/src/slave/containerizer/external_containerizer.cpp
index 04cf31e..fe368dd 100644
--- a/src/slave/containerizer/external_containerizer.cpp
+++ b/src/slave/containerizer/external_containerizer.cpp
@@ -14,16 +14,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-#include <iostream>
-#include <iomanip>
-#include <list>
-#include <tuple>
-
#include <errno.h>
#include <poll.h>
#include <signal.h>
#include <stdio.h>
+#include <list>
+#include <tuple>
+
#include <mesos/type_utils.hpp>
#include <process/async.hpp>
@@ -49,14 +47,12 @@
#include "slave/containerizer/external_containerizer.hpp"
-
using lambda::bind;
using std::list;
using std::map;
using std::set;
using std::string;
-using std::stringstream;
using std::tuple;
using std::vector;
@@ -71,7 +67,6 @@ using state::FrameworkState;
using state::RunState;
using state::SlaveState;
-
Try<ExternalContainerizer*> ExternalContainerizer::create(const Flags& flags)
{
return new ExternalContainerizer(flags);
@@ -433,8 +428,8 @@ Future<bool> ExternalContainerizerProcess::launch(
const ContainerID& containerId,
const Option<TaskInfo>& taskInfo,
const ExecutorInfo& executor,
- const std::string& directory,
- const Option<std::string>& user,
+ const string& directory,
+ const Option<string>& user,
const SlaveID& slaveId,
const PID<Slave>& slavePid,
bool checkpoint)
http://git-wip-us.apache.org/repos/asf/mesos/blob/e8d3ab1e/src/slave/containerizer/external_containerizer.hpp
----------------------------------------------------------------------
diff --git a/src/slave/containerizer/external_containerizer.hpp b/src/slave/containerizer/external_containerizer.hpp
index a5b4079..feeb027 100644
--- a/src/slave/containerizer/external_containerizer.hpp
+++ b/src/slave/containerizer/external_containerizer.hpp
@@ -18,7 +18,6 @@
#define __EXTERNAL_CONTAINERIZER_HPP__
#include <list>
-#include <sstream>
#include <string>
#include <tuple>
[2/5] mesos git commit: Cleaned up STL I/O includes in public headers
(including v1).
Posted by mp...@apache.org.
Cleaned up STL I/O includes in public headers (including v1).
Where possible moved `operator<<` definitions and functions using
streams to implementation files and included <iosfwd> in headers.
Also removed unused I/O includes, added necessary includes, and
cleaned up `std::` prefixes and blank lines.
Review: https://reviews.apache.org/r/41511/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/820640de
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/820640de
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/820640de
Branch: refs/heads/master
Commit: 820640de06f527ecca43785117f2b76541513c47
Parents: e8d3ab1
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Jan 4 02:25:33 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 4 02:37:22 2016 -0800
----------------------------------------------------------------------
include/mesos/resources.hpp | 13 ++--
include/mesos/type_utils.hpp | 134 ++++++++----------------------------
include/mesos/v1/mesos.hpp | 134 ++++++++----------------------------
include/mesos/v1/resources.hpp | 13 ++--
include/mesos/v1/values.hpp | 2 +
include/mesos/values.hpp | 2 +
src/common/resources.cpp | 11 +++
src/common/type_utils.cpp | 133 +++++++++++++++++++++++++++++++++++
src/v1/mesos.cpp | 131 +++++++++++++++++++++++++++++++++++
src/v1/resources.cpp | 11 +++
10 files changed, 358 insertions(+), 226 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/include/mesos/resources.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/resources.hpp b/include/mesos/resources.hpp
index 9c8bfb0..cc8fef9 100644
--- a/include/mesos/resources.hpp
+++ b/include/mesos/resources.hpp
@@ -18,11 +18,13 @@
#define __RESOURCES_HPP__
#include <map>
-#include <iostream>
+#include <iosfwd>
#include <set>
#include <string>
#include <vector>
+#include <google/protobuf/repeated_field.h>
+
#include <mesos/mesos.hpp>
#include <mesos/type_utils.hpp>
#include <mesos/values.hpp>
@@ -369,15 +371,14 @@ private:
std::ostream& operator<<(std::ostream& stream, const Resource& resource);
+
+
std::ostream& operator<<(std::ostream& stream, const Resources& resources);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const google::protobuf::RepeatedPtrField<Resource>& resources)
-{
- return stream << Resources(resources);
-}
+ const google::protobuf::RepeatedPtrField<Resource>& resources);
inline Resources operator+(
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/include/mesos/type_utils.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/type_utils.hpp b/include/mesos/type_utils.hpp
index b370b51..efe2b1d 100644
--- a/include/mesos/type_utils.hpp
+++ b/include/mesos/type_utils.hpp
@@ -17,10 +17,14 @@
#ifndef __MESOS_TYPE_UTILS_H__
#define __MESOS_TYPE_UTILS_H__
-#include <ostream>
+#include <iosfwd>
+#include <string>
+#include <vector>
#include <boost/functional/hash.hpp>
+#include <google/protobuf/repeated_field.h>
+
#include <mesos/mesos.hpp>
#include <mesos/module/module.hpp>
@@ -246,141 +250,61 @@ inline bool operator<(const TaskID& left, const TaskID& right)
}
-inline std::ostream& operator<<(
- std::ostream& stream,
- const ContainerID& containerId)
-{
- return stream << containerId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const ContainerID& containerId);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const ContainerInfo& containerInfo)
-{
- return stream << containerInfo.DebugString();
-}
+ const ContainerInfo& containerInfo);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const ExecutorID& executorId)
-{
- return stream << executorId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const ExecutorID& executorId);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const ExecutorInfo& executor)
-{
- return stream << executor.DebugString();
-}
-
+std::ostream& operator<<(std::ostream& stream, const ExecutorInfo& executor);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const FrameworkID& frameworkId)
-{
- return stream << frameworkId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const FrameworkID& frameworkId);
-inline std::ostream& operator<<(std::ostream& stream, const MasterInfo& master)
-{
- return stream << master.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const MasterInfo& master);
-inline std::ostream& operator<<(std::ostream& stream, const OfferID& offerId)
-{
- return stream << offerId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const OfferID& offerId);
-inline std::ostream& operator<<(std::ostream& stream, const RateLimits& limits)
-{
- return stream << limits.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const RateLimits& limits);
-inline std::ostream& operator<<(std::ostream& stream, const SlaveID& slaveId)
-{
- return stream << slaveId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const SlaveID& slaveId);
-inline std::ostream& operator<<(std::ostream& stream, const SlaveInfo& slave)
-{
- return stream << slave.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const SlaveInfo& slave);
-inline std::ostream& operator<<(std::ostream& stream, const TaskID& taskId)
-{
- return stream << taskId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const TaskID& taskId);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const MachineID& machineId)
-{
- if (machineId.has_hostname() && machineId.has_ip()) {
- return stream << machineId.hostname() << " (" << machineId.ip() << ")";
- }
- // If only a hostname is present.
- if (machineId.has_hostname()) {
- return stream << machineId.hostname();
- } else { // If there is no hostname, then there is an IP.
- return stream << "(" << machineId.ip() << ")";
- }
-}
+std::ostream& operator<<(std::ostream& stream, const MachineID& machineId);
-inline std::ostream& operator<<(std::ostream& stream, const TaskInfo& task)
-{
- return stream << task.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const TaskInfo& task);
-inline std::ostream& operator<<(std::ostream& stream, const TaskState& state)
-{
- return stream << TaskState_Name(state);
-}
+std::ostream& operator<<(std::ostream& stream, const TaskState& state);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const std::vector<TaskID>& taskIds)
-{
- stream << "[ ";
- for (auto it = taskIds.begin(); it != taskIds.end(); ++it) {
- if (it != taskIds.begin()) {
- stream << ", ";
- }
- stream << *it;
- }
- stream << " ]";
- return stream;
-}
+ const std::vector<TaskID>& taskIds);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const FrameworkInfo::Capability& capability)
-{
- return stream << FrameworkInfo::Capability::Type_Name(capability.type());
-}
+ const FrameworkInfo::Capability& capability);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const Image::Type& imageType)
-{
- return stream << Image::Type_Name(imageType);
-}
+std::ostream& operator<<(std::ostream& stream, const Image::Type& imageType);
template <typename T>
@@ -400,13 +324,9 @@ inline std::ostream& operator<<(
}
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const hashmap<std::string, std::string>& map)
-{
- stream << stringify(map);
- return stream;
-}
+ const hashmap<std::string, std::string>& map);
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/include/mesos/v1/mesos.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/v1/mesos.hpp b/include/mesos/v1/mesos.hpp
index 80e7604..961042d 100644
--- a/include/mesos/v1/mesos.hpp
+++ b/include/mesos/v1/mesos.hpp
@@ -17,10 +17,14 @@
#ifndef __MESOS_V1_HPP__
#define __MESOS_V1_HPP__
-#include <ostream>
+#include <iosfwd>
+#include <string>
+#include <vector>
#include <boost/functional/hash.hpp>
+#include <google/protobuf/repeated_field.h>
+
#include <mesos/v1/mesos.pb.h> // ONLY USEFUL AFTER RUNNING PROTOC.
#include <stout/strings.hpp>
@@ -240,141 +244,61 @@ inline bool operator<(const TaskID& left, const TaskID& right)
}
-inline std::ostream& operator<<(
- std::ostream& stream,
- const ContainerID& containerId)
-{
- return stream << containerId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const ContainerID& containerId);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const ContainerInfo& containerInfo)
-{
- return stream << containerInfo.DebugString();
-}
+ const ContainerInfo& containerInfo);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const ExecutorID& executorId)
-{
- return stream << executorId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const ExecutorID& executorId);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const ExecutorInfo& executor)
-{
- return stream << executor.DebugString();
-}
-
+std::ostream& operator<<(std::ostream& stream, const ExecutorInfo& executor);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const FrameworkID& frameworkId)
-{
- return stream << frameworkId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const FrameworkID& frameworkId);
-inline std::ostream& operator<<(std::ostream& stream, const MasterInfo& master)
-{
- return stream << master.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const MasterInfo& master);
-inline std::ostream& operator<<(std::ostream& stream, const OfferID& offerId)
-{
- return stream << offerId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const OfferID& offerId);
-inline std::ostream& operator<<(std::ostream& stream, const RateLimits& limits)
-{
- return stream << limits.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const RateLimits& limits);
-inline std::ostream& operator<<(std::ostream& stream, const AgentID& agentId)
-{
- return stream << agentId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const AgentID& agentId);
-inline std::ostream& operator<<(std::ostream& stream, const AgentInfo& agent)
-{
- return stream << agent.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const AgentInfo& agent);
-inline std::ostream& operator<<(std::ostream& stream, const TaskID& taskId)
-{
- return stream << taskId.value();
-}
+std::ostream& operator<<(std::ostream& stream, const TaskID& taskId);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const MachineID& machineId)
-{
- if (machineId.has_hostname() && machineId.has_ip()) {
- return stream << machineId.hostname() << " (" << machineId.ip() << ")";
- }
- // If only a hostname is present.
- if (machineId.has_hostname()) {
- return stream << machineId.hostname();
- } else { // If there is no hostname, then there is an IP.
- return stream << "(" << machineId.ip() << ")";
- }
-}
+std::ostream& operator<<(std::ostream& stream, const MachineID& machineId);
-inline std::ostream& operator<<(std::ostream& stream, const TaskInfo& task)
-{
- return stream << task.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const TaskInfo& task);
-inline std::ostream& operator<<(std::ostream& stream, const TaskState& state)
-{
- return stream << TaskState_Name(state);
-}
+std::ostream& operator<<(std::ostream& stream, const TaskState& state);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const std::vector<TaskID>& taskIds)
-{
- stream << "[ ";
- for (auto it = taskIds.begin(); it != taskIds.end(); ++it) {
- if (it != taskIds.begin()) {
- stream << ", ";
- }
- stream << *it;
- }
- stream << " ]";
- return stream;
-}
+ const std::vector<TaskID>& taskIds);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const FrameworkInfo::Capability& capability)
-{
- return stream << FrameworkInfo::Capability::Type_Name(capability.type());
-}
+ const FrameworkInfo::Capability& capability);
-inline std::ostream& operator<<(
- std::ostream& stream,
- const Image::Type& imageType)
-{
- return stream << Image::Type_Name(imageType);
-}
+std::ostream& operator<<(std::ostream& stream, const Image::Type& imageType);
template <typename T>
@@ -394,13 +318,9 @@ inline std::ostream& operator<<(
}
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const hashmap<std::string, std::string>& map)
-{
- stream << stringify(map);
- return stream;
-}
+ const hashmap<std::string, std::string>& map);
} // namespace v1 {
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/include/mesos/v1/resources.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/v1/resources.hpp b/include/mesos/v1/resources.hpp
index db87c99..f489297 100644
--- a/include/mesos/v1/resources.hpp
+++ b/include/mesos/v1/resources.hpp
@@ -18,11 +18,13 @@
#define __MESOS_V1_RESOURCES_HPP__
#include <map>
-#include <iostream>
+#include <iosfwd>
#include <set>
#include <string>
#include <vector>
+#include <google/protobuf/repeated_field.h>
+
#include <mesos/v1/mesos.hpp>
#include <mesos/v1/values.hpp>
@@ -369,15 +371,14 @@ private:
std::ostream& operator<<(std::ostream& stream, const Resource& resource);
+
+
std::ostream& operator<<(std::ostream& stream, const Resources& resources);
-inline std::ostream& operator<<(
+std::ostream& operator<<(
std::ostream& stream,
- const google::protobuf::RepeatedPtrField<Resource>& resources)
-{
- return stream << Resources(resources);
-}
+ const google::protobuf::RepeatedPtrField<Resource>& resources);
inline Resources operator+(
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/include/mesos/v1/values.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/v1/values.hpp b/include/mesos/v1/values.hpp
index a160bd4..03a19ee 100644
--- a/include/mesos/v1/values.hpp
+++ b/include/mesos/v1/values.hpp
@@ -17,6 +17,8 @@
#ifndef __MESOS_V1_VALUES_HPP__
#define __MESOS_V1_VALUES_HPP__
+#include <iosfwd>
+
#include <mesos/v1/mesos.hpp>
#include <stout/try.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/include/mesos/values.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/values.hpp b/include/mesos/values.hpp
index 58af972..0d09729 100644
--- a/include/mesos/values.hpp
+++ b/include/mesos/values.hpp
@@ -17,6 +17,8 @@
#ifndef __VALUES_HPP__
#define __VALUES_HPP__
+#include <iosfwd>
+
#include <mesos/mesos.hpp>
#include <stout/try.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/src/common/resources.cpp
----------------------------------------------------------------------
diff --git a/src/common/resources.cpp b/src/common/resources.cpp
index b9d31ae..6afd2df 100644
--- a/src/common/resources.cpp
+++ b/src/common/resources.cpp
@@ -16,12 +16,15 @@
#include <stdint.h>
+#include <ostream>
#include <set>
#include <string>
#include <vector>
#include <glog/logging.h>
+#include <google/protobuf/repeated_field.h>
+
#include <mesos/resources.hpp>
#include <mesos/values.hpp>
#include <mesos/type_utils.hpp>
@@ -1392,4 +1395,12 @@ ostream& operator<<(ostream& stream, const Resources& resources)
return stream;
}
+
+ostream& operator<<(
+ ostream& stream,
+ const google::protobuf::RepeatedPtrField<Resource>& resources)
+{
+ return stream << Resources(resources);
+}
+
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/src/common/type_utils.cpp
----------------------------------------------------------------------
diff --git a/src/common/type_utils.cpp b/src/common/type_utils.cpp
index c6c9ba7..76f48f6 100644
--- a/src/common/type_utils.cpp
+++ b/src/common/type_utils.cpp
@@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <ostream>
+
#include <mesos/attributes.hpp>
#include <mesos/mesos.hpp>
#include <mesos/resources.hpp>
@@ -21,6 +23,10 @@
#include "messages/messages.hpp"
+using std::ostream;
+using std::string;
+using std::vector;
+
namespace mesos {
// TODO(vinod): Ensure that these operators do not go out of sync
@@ -360,4 +366,131 @@ bool operator!=(const TaskStatus& left, const TaskStatus& right)
return !(left == right);
}
+
+ostream& operator<<(ostream& stream, const ContainerID& containerId)
+{
+ return stream << containerId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const ContainerInfo& containerInfo)
+{
+ return stream << containerInfo.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const ExecutorID& executorId)
+{
+ return stream << executorId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const ExecutorInfo& executor)
+{
+ return stream << executor.DebugString();
+}
+
+
+ostream& operator<<(std::ostream& stream, const FrameworkID& frameworkId)
+{
+ return stream << frameworkId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const MasterInfo& master)
+{
+ return stream << master.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const OfferID& offerId)
+{
+ return stream << offerId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const RateLimits& limits)
+{
+ return stream << limits.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const SlaveID& slaveId)
+{
+ return stream << slaveId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const SlaveInfo& slave)
+{
+ return stream << slave.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const TaskID& taskId)
+{
+ return stream << taskId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const MachineID& machineId)
+{
+ if (machineId.has_hostname() && machineId.has_ip()) {
+ return stream << machineId.hostname() << " (" << machineId.ip() << ")";
+ }
+
+ // If only a hostname is present.
+ if (machineId.has_hostname()) {
+ return stream << machineId.hostname();
+ } else { // If there is no hostname, then there is an IP.
+ return stream << "(" << machineId.ip() << ")";
+ }
+}
+
+
+ostream& operator<<(ostream& stream, const TaskInfo& task)
+{
+ return stream << task.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const TaskState& state)
+{
+ return stream << TaskState_Name(state);
+}
+
+
+ostream& operator<<(ostream& stream, const vector<TaskID>& taskIds)
+{
+ stream << "[ ";
+ for (auto it = taskIds.begin(); it != taskIds.end(); ++it) {
+ if (it != taskIds.begin()) {
+ stream << ", ";
+ }
+ stream << *it;
+ }
+ stream << " ]";
+ return stream;
+}
+
+
+ostream& operator<<(
+ ostream& stream,
+ const FrameworkInfo::Capability& capability)
+{
+ return stream << FrameworkInfo::Capability::Type_Name(capability.type());
+}
+
+
+ostream& operator<<(ostream& stream, const Image::Type& imageType)
+{
+ return stream << Image::Type_Name(imageType);
+}
+
+
+ostream& operator<<(ostream& stream, const hashmap<string, string>& map)
+{
+ return stream << stringify(map);
+}
+
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/src/v1/mesos.cpp
----------------------------------------------------------------------
diff --git a/src/v1/mesos.cpp b/src/v1/mesos.cpp
index 13a58ba..9264752 100644
--- a/src/v1/mesos.cpp
+++ b/src/v1/mesos.cpp
@@ -14,10 +14,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <ostream>
+
#include <mesos/v1/attributes.hpp>
#include <mesos/v1/mesos.hpp>
#include <mesos/v1/resources.hpp>
+using std::ostream;
+using std::string;
+using std::vector;
+
namespace mesos {
namespace v1 {
@@ -356,6 +362,131 @@ bool operator!=(const TaskStatus& left, const TaskStatus& right)
return !(left == right);
}
+ostream& operator<<(ostream& stream, const ContainerID& containerId)
+{
+ return stream << containerId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const ContainerInfo& containerInfo)
+{
+ return stream << containerInfo.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const ExecutorID& executorId)
+{
+ return stream << executorId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const ExecutorInfo& executor)
+{
+ return stream << executor.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const FrameworkID& frameworkId)
+{
+ return stream << frameworkId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const MasterInfo& master)
+{
+ return stream << master.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const OfferID& offerId)
+{
+ return stream << offerId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const RateLimits& limits)
+{
+ return stream << limits.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const AgentID& agentId)
+{
+ return stream << agentId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const AgentInfo& agent)
+{
+ return stream << agent.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const TaskID& taskId)
+{
+ return stream << taskId.value();
+}
+
+
+ostream& operator<<(ostream& stream, const MachineID& machineId)
+{
+ if (machineId.has_hostname() && machineId.has_ip()) {
+ return stream << machineId.hostname() << " (" << machineId.ip() << ")";
+ }
+
+ // If only a hostname is present.
+ if (machineId.has_hostname()) {
+ return stream << machineId.hostname();
+ } else { // If there is no hostname, then there is an IP.
+ return stream << "(" << machineId.ip() << ")";
+ }
+}
+
+
+ostream& operator<<(ostream& stream, const TaskInfo& task)
+{
+ return stream << task.DebugString();
+}
+
+
+ostream& operator<<(ostream& stream, const TaskState& state)
+{
+ return stream << TaskState_Name(state);
+}
+
+
+ostream& operator<<(ostream& stream, const vector<TaskID>& taskIds)
+{
+ stream << "[ ";
+ for (auto it = taskIds.begin(); it != taskIds.end(); ++it) {
+ if (it != taskIds.begin()) {
+ stream << ", ";
+ }
+ stream << *it;
+ }
+ stream << " ]";
+ return stream;
+}
+
+
+ostream& operator<<(
+ ostream& stream,
+ const FrameworkInfo::Capability& capability)
+{
+ return stream << FrameworkInfo::Capability::Type_Name(capability.type());
+}
+
+
+ostream& operator<<(ostream& stream, const Image::Type& imageType)
+{
+ return stream << Image::Type_Name(imageType);
+}
+
+
+ostream& operator<<(ostream& stream, const hashmap<string, string>& map)
+{
+ return stream << stringify(map);
+}
} // namespace v1 {
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/820640de/src/v1/resources.cpp
----------------------------------------------------------------------
diff --git a/src/v1/resources.cpp b/src/v1/resources.cpp
index 0c0eee6..8de6672 100644
--- a/src/v1/resources.cpp
+++ b/src/v1/resources.cpp
@@ -16,12 +16,15 @@
#include <stdint.h>
+#include <ostream>
#include <set>
#include <string>
#include <vector>
#include <glog/logging.h>
+#include <google/protobuf/repeated_field.h>
+
#include <mesos/v1/mesos.hpp>
#include <mesos/v1/resources.hpp>
#include <mesos/v1/values.hpp>
@@ -1394,5 +1397,13 @@ ostream& operator<<(ostream& stream, const Resources& resources)
return stream;
}
+
+ostream& operator<<(
+ ostream& stream,
+ const google::protobuf::RepeatedPtrField<Resource>& resources)
+{
+ return stream << Resources(resources);
+}
+
} // namespace v1 {
} // namespace mesos {
[3/5] mesos git commit: libprocess: Cleaned up STL I/O includes.
Posted by mp...@apache.org.
libprocess: Cleaned up STL I/O includes.
Where possible moved `operator<<` definitions and functions using
streams to implementation files and included <iosfwd> in headers.
Also removed unused I/O includes, and cleaned up `std::` prefixes.
Review: https://reviews.apache.org/r/41509/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/d3a5a614
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/d3a5a614
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/d3a5a614
Branch: refs/heads/master
Commit: d3a5a614a9afa6b3b8873a26200db4c79aba7379
Parents: 68d4fc3
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Jan 4 02:24:54 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 4 02:37:22 2016 -0800
----------------------------------------------------------------------
3rdparty/libprocess/include/process/address.hpp | 2 +-
3rdparty/libprocess/include/process/future.hpp | 1 -
3rdparty/libprocess/include/process/http.hpp | 25 +------------------
3rdparty/libprocess/include/process/pid.hpp | 3 +--
3rdparty/libprocess/src/http.cpp | 24 ++++++++++++++++++
3rdparty/libprocess/src/pid.cpp | 26 +++++++++++---------
6 files changed, 41 insertions(+), 40 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3a5a614/3rdparty/libprocess/include/process/address.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/address.hpp b/3rdparty/libprocess/include/process/address.hpp
index 79429e9..04e3155 100644
--- a/3rdparty/libprocess/include/process/address.hpp
+++ b/3rdparty/libprocess/include/process/address.hpp
@@ -24,7 +24,7 @@
#include <glog/logging.h>
-#include <sstream>
+#include <ostream>
#include <boost/functional/hash.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3a5a614/3rdparty/libprocess/include/process/future.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/future.hpp b/3rdparty/libprocess/include/process/future.hpp
index 817fca2..bcb5668 100644
--- a/3rdparty/libprocess/include/process/future.hpp
+++ b/3rdparty/libprocess/include/process/future.hpp
@@ -17,7 +17,6 @@
#include <stdlib.h> // For abort.
#include <atomic>
-#include <iostream>
#include <list>
#include <memory> // TODO(benh): Replace shared_ptr with unique_ptr.
#include <set>
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3a5a614/3rdparty/libprocess/include/process/http.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/http.hpp b/3rdparty/libprocess/include/process/http.hpp
index 404770f..ed708fe 100644
--- a/3rdparty/libprocess/include/process/http.hpp
+++ b/3rdparty/libprocess/include/process/http.hpp
@@ -21,7 +21,6 @@
#include <iosfwd>
#include <memory>
#include <queue>
-#include <sstream>
#include <string>
#include <vector>
@@ -491,29 +490,7 @@ struct OK : Response
explicit OK(const std::string& body) : Response(body, Status::OK) {}
- OK(const JSON::Value& value, const Option<std::string>& jsonp = None())
- : Response(Status::OK)
- {
- type = BODY;
-
- std::ostringstream out;
-
- if (jsonp.isSome()) {
- out << jsonp.get() << "(";
- }
-
- out << value;
-
- if (jsonp.isSome()) {
- out << ");";
- headers["Content-Type"] = "text/javascript";
- } else {
- headers["Content-Type"] = "application/json";
- }
-
- headers["Content-Length"] = stringify(out.str().size());
- body = out.str().data();
- }
+ OK(const JSON::Value& value, const Option<std::string>& jsonp = None());
};
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3a5a614/3rdparty/libprocess/include/process/pid.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/include/process/pid.hpp b/3rdparty/libprocess/include/process/pid.hpp
index b22c160..0791dc1 100644
--- a/3rdparty/libprocess/include/process/pid.hpp
+++ b/3rdparty/libprocess/include/process/pid.hpp
@@ -15,8 +15,7 @@
#include <stdint.h>
-#include <iostream>
-#include <sstream>
+#include <iosfwd>
#include <string>
#include <boost/functional/hash.hpp>
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3a5a614/3rdparty/libprocess/src/http.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/http.cpp b/3rdparty/libprocess/src/http.cpp
index 2893d91..06231d9 100644
--- a/3rdparty/libprocess/src/http.cpp
+++ b/3rdparty/libprocess/src/http.cpp
@@ -542,6 +542,30 @@ Future<Nothing> Pipe::Writer::readerClosed() const
}
+OK::OK(const JSON::Value& value, const Option<string>& jsonp)
+ : Response(Status::OK)
+{
+ type = BODY;
+
+ std::ostringstream out;
+
+ if (jsonp.isSome()) {
+ out << jsonp.get() << "(";
+ }
+
+ out << value;
+
+ if (jsonp.isSome()) {
+ out << ");";
+ headers["Content-Type"] = "text/javascript";
+ } else {
+ headers["Content-Type"] = "application/json";
+ }
+
+ headers["Content-Length"] = stringify(out.str().size());
+ body = out.str().data();
+}
+
namespace path {
Try<hashmap<string, string>> parse(const string& pattern, const string& path)
http://git-wip-us.apache.org/repos/asf/mesos/blob/d3a5a614/3rdparty/libprocess/src/pid.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/src/pid.cpp b/3rdparty/libprocess/src/pid.cpp
index 1a9cbd1..3cd04ec 100644
--- a/3rdparty/libprocess/src/pid.cpp
+++ b/3rdparty/libprocess/src/pid.cpp
@@ -21,6 +21,7 @@
#include <glog/logging.h>
#include <iostream>
+#include <sstream>
#include <string>
#include <process/pid.hpp>
@@ -31,24 +32,25 @@
#include "config.hpp"
-
+using std::ios_base;
using std::istream;
+using std::istringstream;
using std::ostream;
+using std::ostringstream;
using std::string;
-
namespace process {
UPID::UPID(const char* s)
{
- std::istringstream in(s);
+ istringstream in(s);
in >> *this;
}
-UPID::UPID(const std::string& s)
+UPID::UPID(const string& s)
{
- std::istringstream in(s);
+ istringstream in(s);
in >> *this;
}
@@ -63,7 +65,7 @@ UPID::UPID(const ProcessBase& process)
UPID::operator std::string() const
{
- std::ostringstream out;
+ ostringstream out;
out << *this;
return out.str();
}
@@ -84,14 +86,14 @@ istream& operator>>(istream& stream, UPID& pid)
string str;
if (!(stream >> str)) {
- stream.setstate(std::ios_base::badbit);
+ stream.setstate(ios_base::badbit);
return stream;
}
VLOG(2) << "Attempting to parse '" << str << "' into a PID";
if (str.size() == 0) {
- stream.setstate(std::ios_base::badbit);
+ stream.setstate(ios_base::badbit);
return stream;
}
@@ -104,7 +106,7 @@ istream& operator>>(istream& stream, UPID& pid)
if (index != string::npos) {
id = str.substr(0, index);
} else {
- stream.setstate(std::ios_base::badbit);
+ stream.setstate(ios_base::badbit);
return stream;
}
@@ -115,7 +117,7 @@ istream& operator>>(istream& stream, UPID& pid)
if (index != string::npos) {
host = str.substr(0, index);
} else {
- stream.setstate(std::ios_base::badbit);
+ stream.setstate(ios_base::badbit);
return stream;
}
@@ -124,7 +126,7 @@ istream& operator>>(istream& stream, UPID& pid)
if (ip.isError()) {
VLOG(2) << ip.error();
- stream.setstate(std::ios_base::badbit);
+ stream.setstate(ios_base::badbit);
return stream;
}
@@ -133,7 +135,7 @@ istream& operator>>(istream& stream, UPID& pid)
str = str.substr(index + 1);
if (sscanf(str.c_str(), "%hu", &address.port) != 1) {
- stream.setstate(std::ios_base::badbit);
+ stream.setstate(ios_base::badbit);
return stream;
}
[4/5] mesos git commit: Cleaned up STL I/O includes in public headers
which are not part of v1.
Posted by mp...@apache.org.
Cleaned up STL I/O includes in public headers which are not part of v1.
Where possible moved `operator<<` definitions and functions using
streams to implementation files and included <iosfwd> in headers.
Also removed unused I/O includes, added necessary includes, and cleaned
up `std::` prefixes.
Review: https://reviews.apache.org/r/41512/
Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/fcadd2d2
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/fcadd2d2
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/fcadd2d2
Branch: refs/heads/master
Commit: fcadd2d2950d081677aa54fa0c70dab5dd5862bd
Parents: 820640d
Author: Alexander Rukletsov <ru...@gmail.com>
Authored: Mon Jan 4 02:26:18 2016 -0800
Committer: Michael Park <mp...@apache.org>
Committed: Mon Jan 4 02:37:22 2016 -0800
----------------------------------------------------------------------
include/mesos/authorizer/authorizer.hpp | 7 ++-----
include/mesos/http.hpp | 18 ++----------------
include/mesos/uri/uri.hpp | 2 +-
src/authorizer/authorizer.cpp | 9 +++++++++
src/common/http.cpp | 19 ++++++++++++++++++-
5 files changed, 32 insertions(+), 23 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/include/mesos/authorizer/authorizer.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/authorizer/authorizer.hpp b/include/mesos/authorizer/authorizer.hpp
index 7a04ca8..f616139 100644
--- a/include/mesos/authorizer/authorizer.hpp
+++ b/include/mesos/authorizer/authorizer.hpp
@@ -17,7 +17,7 @@
#ifndef __MESOS_AUTHORIZER_AUTHORIZER_HPP__
#define __MESOS_AUTHORIZER_AUTHORIZER_HPP__
-#include <ostream>
+#include <iosfwd>
#include <string>
// ONLY USEFUL AFTER RUNNING PROTOC.
@@ -192,10 +192,7 @@ protected:
};
-inline std::ostream& operator<<(std::ostream& stream, const ACLs& acls)
-{
- return stream << acls.DebugString();
-}
+std::ostream& operator<<(std::ostream& stream, const ACLs& acls);
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/include/mesos/http.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/http.hpp b/include/mesos/http.hpp
index 8529ed0..bd7e81f 100644
--- a/include/mesos/http.hpp
+++ b/include/mesos/http.hpp
@@ -17,9 +17,7 @@
#ifndef __MESOS_HTTP_HPP__
#define __MESOS_HTTP_HPP__
-#include <ostream>
-
-#include <stout/unreachable.hpp>
+#include <iosfwd>
namespace mesos {
@@ -35,19 +33,7 @@ enum class ContentType
};
-inline std::ostream& operator<<(std::ostream& stream, ContentType contentType)
-{
- switch (contentType) {
- case ContentType::PROTOBUF: {
- return stream << APPLICATION_PROTOBUF;
- }
- case ContentType::JSON: {
- return stream << APPLICATION_JSON;
- }
- }
-
- UNREACHABLE();
-}
+std::ostream& operator<<(std::ostream& stream, ContentType contentType);
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/include/mesos/uri/uri.hpp
----------------------------------------------------------------------
diff --git a/include/mesos/uri/uri.hpp b/include/mesos/uri/uri.hpp
index 75f08c8..180dc13 100644
--- a/include/mesos/uri/uri.hpp
+++ b/include/mesos/uri/uri.hpp
@@ -17,7 +17,7 @@
#ifndef __MESOS_URI_PROTO_HPP__
#define __MESOS_URI_PROTO_HPP__
-#include <ostream>
+#include <iosfwd>
// ONLY USEFUL AFTER RUNNING PROTOC.
#include <mesos/uri/uri.pb.h>
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/src/authorizer/authorizer.cpp
----------------------------------------------------------------------
diff --git a/src/authorizer/authorizer.cpp b/src/authorizer/authorizer.cpp
index 31712e5..54278b0 100644
--- a/src/authorizer/authorizer.cpp
+++ b/src/authorizer/authorizer.cpp
@@ -14,6 +14,8 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include <ostream>
+
#include <mesos/authorizer/authorizer.hpp>
#include <mesos/module/authorizer.hpp>
@@ -24,6 +26,7 @@
#include "module/manager.hpp"
+using std::ostream;
using std::string;
using mesos::internal::LocalAuthorizer;
@@ -43,4 +46,10 @@ Try<Authorizer*> Authorizer::create(const string& name)
return modules::ModuleManager::create<Authorizer>(name);
}
+
+ostream& operator<<(ostream& stream, const ACLs& acls)
+{
+ return stream << acls.DebugString();
+}
+
} // namespace mesos {
http://git-wip-us.apache.org/repos/asf/mesos/blob/fcadd2d2/src/common/http.cpp
----------------------------------------------------------------------
diff --git a/src/common/http.cpp b/src/common/http.cpp
index 2ecb78c..7165551 100644
--- a/src/common/http.cpp
+++ b/src/common/http.cpp
@@ -15,12 +15,14 @@
// limitations under the License.
#include <map>
+#include <ostream>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include <mesos/attributes.hpp>
+#include <mesos/http.hpp>
#include <mesos/resources.hpp>
#include <stout/foreach.hpp>
@@ -33,11 +35,27 @@
#include "messages/messages.hpp"
using std::map;
+using std::ostream;
using std::set;
using std::string;
using std::vector;
namespace mesos {
+
+ostream& operator<<(ostream& stream, ContentType contentType)
+{
+ switch (contentType) {
+ case ContentType::PROTOBUF: {
+ return stream << APPLICATION_PROTOBUF;
+ }
+ case ContentType::JSON: {
+ return stream << APPLICATION_JSON;
+ }
+ }
+
+ UNREACHABLE();
+}
+
namespace internal {
string serialize(
@@ -378,6 +396,5 @@ JSON::Object model(
return object;
}
-
} // namespace internal {
} // namespace mesos {