Repository: mesos Updated Branches: refs/heads/master be33e9a57 -> c7767f051
Remove unused tuples folder. Review: https://reviews.apache.org/r/26152 Project: http://git-wip-us.apache.org/repos/asf/mesos/repo Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/c7767f05 Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/c7767f05 Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/c7767f05 Branch: refs/heads/master Commit: c7767f0514be5098550dc4d0536b59f33b959b91 Parents: be33e9a Author: Cody Maloney <[email protected]> Authored: Mon Sep 29 18:43:40 2014 -0700 Committer: Benjamin Mahler <[email protected]> Committed: Mon Sep 29 18:43:40 2014 -0700 ---------------------------------------------------------------------- .../include/process/tuples/details.hpp | 175 ------------------- .../include/process/tuples/tuples.hpp | 156 ----------------- 2 files changed, 331 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mesos/blob/c7767f05/3rdparty/libprocess/include/process/tuples/details.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/tuples/details.hpp b/3rdparty/libprocess/include/process/tuples/details.hpp deleted file mode 100644 index f198f0e..0000000 --- a/3rdparty/libprocess/include/process/tuples/details.hpp +++ /dev/null @@ -1,175 +0,0 @@ -#ifndef __PROCESS_DETAILS_HPP__ -#define __PROCESS_DETAILS_HPP__ - -template <MSGID ID> class tuple; - -#undef IDENTITY -#define IDENTITY(...) __VA_ARGS__ - -#undef TUPLE -#define TUPLE(ID, types) \ - template <> class tuple<ID> : public boost::tuple<IDENTITY types> \ - { \ - public: \ - explicit tuple(const boost::tuple<IDENTITY types> &t) \ - : boost::tuple<IDENTITY types>(t) {} \ - \ - explicit tuple(const std::string &data) \ - { \ - std::istringstream is(data); \ - process::tuples::deserializer d(is); \ - deserialize(d, *this); \ - } \ - \ - operator std::string () const \ - { \ - std::ostringstream os; \ - process::tuples::serializer s(os); \ - serialize(s, *this); \ - return os.str(); \ - } \ - } - - -inline void serialize(process::tuples::serializer &s, - const boost::tuples::null_type &) -{ -} - - -template <typename H, typename T> -inline void serialize(process::tuples::serializer &s, - const boost::tuples::cons<H, T> &c) -{ - s & c.get_head(); - serialize(s, c.get_tail()); -} - - -inline void deserialize(process::tuples::deserializer &d, - const boost::tuples::null_type &) -{ -} - - -template <typename H, typename T> -inline void deserialize(process::tuples::deserializer &d, - boost::tuples::cons<H, T> &c) -{ - d & c.get_head(); - deserialize(d, c.get_tail()); -} - - -template <MSGID ID> -tuple<ID> pack() -{ - return tuple<ID>(::boost::make_tuple()); -} - - -template <MSGID ID, typename T0> -tuple<ID> pack(const T0 &t0) -{ - return tuple<ID>(::boost::make_tuple(t0)); -} - - -template <MSGID ID, typename T0, typename T1> -tuple<ID> pack(const T0 &t0, const T1 &t1) -{ - return tuple<ID>(::boost::make_tuple(t0, t1)); -} - - -template <MSGID ID, typename T0, typename T1, typename T2> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3, typename T4> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3, - const T4 &t4) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3, t4)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3, - const T4 &t4, const T5 &t5) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3, t4, t5)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5, typename T6> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3, - const T4 &t4, const T5 &t5, const T6 &t6) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3, t4, t5, t6)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5, typename T6, typename T7> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3, - const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3, t4, t5, t6, t7)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5, typename T6, typename T7, typename T8> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3, - const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7, - const T8 &t8) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3, t4, t5, t6, t7, t8)); -} - - -template <MSGID ID, - typename T0, typename T1, typename T2, typename T3, typename T4, - typename T5, typename T6, typename T7, typename T8, typename T9> -tuple<ID> pack(const T0 &t0, const T1 &t1, const T2 &t2, const T3 &t3, - const T4 &t4, const T5 &t5, const T6 &t6, const T7 &t7, - const T8 &t8, const T9 &t9) -{ - return tuple<ID>(::boost::make_tuple(t0, t1, t2, t3, t4, t5, t6, t7, t8, t9)); -} - - -template <MSGID ID> -tuple<ID> unpack(const std::string &data) -{ - return tuple<ID>(data); -} - - -template <MSGID ID, int N> -typename boost::tuples::element<N, tuple<ID> >::type unpack( - const std::string &data) -{ - return boost::tuples::get<N>(unpack<ID>(data)); -} - -#endif // __PROCESS_DETAILS_HPP__ http://git-wip-us.apache.org/repos/asf/mesos/blob/c7767f05/3rdparty/libprocess/include/process/tuples/tuples.hpp ---------------------------------------------------------------------- diff --git a/3rdparty/libprocess/include/process/tuples/tuples.hpp b/3rdparty/libprocess/include/process/tuples/tuples.hpp deleted file mode 100644 index f993b01..0000000 --- a/3rdparty/libprocess/include/process/tuples/tuples.hpp +++ /dev/null @@ -1,156 +0,0 @@ -#ifndef __PROCESS_TUPLES_HPP__ -#define __PROCESS_TUPLES_HPP__ - -#include <stdint.h> -#include <stdlib.h> - -#include <arpa/inet.h> - -#include <sstream> -#include <string> -#include <utility> - -#include <boost/tuple/tuple.hpp> - - -namespace process { namespace tuples { - -// TODO(benh): Check stream errors! Report errors! Ahhhh! - -struct serializer -{ - std::ostringstream& stream; - - explicit serializer(std::ostringstream& s) : stream(s) {} - - void operator & (const int32_t & i) - { - uint32_t netInt = htonl((uint32_t) i); - stream.write((char *) &netInt, sizeof(netInt)); - } - - void operator & (const int64_t & i) - { - uint32_t hiInt = htonl((uint32_t) (i >> 32)); - uint32_t loInt = htonl((uint32_t) (i & 0xFFFFFFFF)); - stream.write((char *) &hiInt, sizeof(hiInt)); - stream.write((char *) &loInt, sizeof(loInt)); - } - -#ifdef __APPLE__ - void operator & (const intptr_t &i) - { - if (sizeof(intptr_t) == sizeof(int32_t)) - *this & ((int32_t &) i); - else if (sizeof(intptr_t) == sizeof(int64_t)) - *this & ((int64_t &) i); - else - abort(); - } -#endif - - void operator & (const size_t &i) - { - if (sizeof(size_t) == sizeof(int32_t)) - *this & ((int32_t &) i); - else if (sizeof(size_t) == sizeof(int64_t)) - *this & ((int64_t &) i); - else - abort(); - } - - void operator & (const double &d) - { - // TODO(*): Deal with endian issues? - stream.write((char *) &d, sizeof(d)); - } - - void operator & (const std::string &s) - { - size_t size = s.size(); - *this & (size); - stream.write(s.data(), size); - } - - void operator & (const PID &pid) - { - *this & ((int32_t) pid.pipe); - *this & ((int32_t) pid.ip); - *this & ((int32_t) pid.port); - } -}; - - -struct deserializer -{ - std::istringstream &stream; - - explicit deserializer(std::istringstream &s) : stream(s) {} - - void operator & (int32_t &i) - { - uint32_t netInt; - stream.read((char *) &netInt, sizeof(netInt)); - i = ntohl(netInt); - } - - void operator & (int64_t &i) - { - uint32_t hiInt, loInt; - stream.read((char *) &hiInt, sizeof(hiInt)); - stream.read((char *) &loInt, sizeof(loInt)); - int64_t hi64 = ntohl(hiInt); - int64_t lo64 = ntohl(loInt); - i = (hi64 << 32) | lo64; - } - -#ifdef __APPLE__ - void operator & (intptr_t &i) - { - if (sizeof(intptr_t) == sizeof(int32_t)) - *this & ((int32_t &) i); - else if (sizeof(intptr_t) == sizeof(int64_t)) - *this & ((int64_t &) i); - else - abort(); - } -#endif - - void operator & (size_t &i) - { - if (sizeof(size_t) == sizeof(int32_t)) - *this & ((int32_t &) i); - else if (sizeof(size_t) == sizeof(int64_t)) - *this & ((int64_t &) i); - else - abort(); - } - - void operator & (double &d) - { - // TODO(*): Deal with endian issues? - stream.read((char *) &d, sizeof(d)); - } - - void operator & (std::string &s) - { - size_t size; - *this & (size); - s.resize(size); - stream.read((char *) s.data(), size); - } - - void operator & (PID &pid) - { - *this & ((int32_t &) pid.pipe); - *this & ((int32_t &) pid.ip); - *this & ((int32_t &) pid.port); - } -}; - - -} // namespace tuples { -} // namespace process { - - -#endif // __PROCESS_TUPLES_HPP__
