/usr/include/caf/detail/message_data.hpp is in libcaf-dev 0.13.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | /******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright (C) 2011 - 2015 *
* Dominik Charousset <dominik.charousset (at) haw-hamburg.de> *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#ifndef CAF_DETAIL_MESSAGE_DATA_HPP
#define CAF_DETAIL_MESSAGE_DATA_HPP
#include <string>
#include <iterator>
#include <typeinfo>
#include "caf/intrusive_ptr.hpp"
#include "caf/config.hpp"
#include "caf/ref_counted.hpp"
#include "caf/uniform_type_info.hpp"
#include "caf/detail/type_list.hpp"
namespace caf {
namespace detail {
class message_data : public ref_counted {
public:
message_data() = default;
message_data(const message_data&) = default;
~message_data();
/****************************************************************************
* modifiers *
****************************************************************************/
virtual void* mutable_at(size_t pos) = 0;
/****************************************************************************
* observers *
****************************************************************************/
// computes "@<>+..." formatted type name
std::string tuple_type_names() const;
// compares each element using uniform_type_info objects
bool equals(const message_data& other) const;
virtual size_t size() const = 0;
virtual const void* at(size_t pos) const = 0;
// Tries to match element at position `pos` to given RTTI.
virtual bool match_element(size_t pos, uint16_t typenr,
const std::type_info* rtti) const = 0;
virtual uint32_t type_token() const = 0;
virtual const char* uniform_name_at(size_t pos) const = 0;
virtual uint16_t type_nr_at(size_t pos) const = 0;
/****************************************************************************
* nested types *
****************************************************************************/
class cow_ptr {
public:
cow_ptr() = default;
cow_ptr(cow_ptr&&) = default;
cow_ptr(const cow_ptr&) = default;
cow_ptr& operator=(cow_ptr&&) = default;
cow_ptr& operator=(const cow_ptr&) = default;
template <class T>
cow_ptr(intrusive_ptr<T> p) : m_ptr(std::move(p)) {
// nop
}
inline cow_ptr(message_data* ptr, bool add_ref) : m_ptr(ptr, add_ref) {
// nop
}
/**************************************************************************
* modifiers *
**************************************************************************/
inline void swap(cow_ptr& other) {
m_ptr.swap(other.m_ptr);
}
inline void reset(message_data* p = nullptr, bool add_ref = true) {
m_ptr.reset(p, add_ref);
}
inline message_data* release() {
return m_ptr.release();
}
inline void detach() {
static_cast<void>(get_detached());
}
inline message_data* operator->() {
return get_detached();
}
inline message_data& operator*() {
return *get_detached();
}
/**************************************************************************
* observers *
**************************************************************************/
inline const message_data* operator->() const {
return m_ptr.get();
}
inline const message_data& operator*() const {
return *m_ptr.get();
}
inline explicit operator bool() const {
return static_cast<bool>(m_ptr);
}
inline message_data* get() const {
return m_ptr.get();
}
private:
message_data* get_detached();
intrusive_ptr<message_data> m_ptr;
};
virtual cow_ptr copy() const = 0;
};
} // namespace detail
} // namespace caf
#endif // CAF_DETAIL_MESSAGE_DATA_HPP
|