Commit 42db08af authored by neverlord's avatar neverlord

coding style

parent 71416e36
......@@ -51,7 +51,7 @@ class abstract_actor : public Base
}
queue_node(actor* from, const any_tuple& content)
queue_node(actor* from, any_tuple const& content)
: next(nullptr), sender(from), msg(content)
{
......@@ -69,7 +69,7 @@ class abstract_actor : public Base
}
template<class List, typename Element>
bool unique_insert(List& lst, const Element& e)
bool unique_insert(List& lst, Element const& e)
{
auto end = lst.end();
auto i = std::find(lst.begin(), end, e);
......@@ -82,7 +82,7 @@ class abstract_actor : public Base
}
template<class List, typename Iterator, typename Element>
int erase_all(List& lst, Iterator begin, Iterator end, const Element& e)
int erase_all(List& lst, Iterator begin, Iterator end, Element const& e)
{
auto i = std::find(begin, end, e);
if (i != end)
......@@ -93,7 +93,7 @@ class abstract_actor : public Base
}
template<class List, typename Element>
int erase_all(List& lst, const Element& e)
int erase_all(List& lst, Element const& e)
{
return erase_all(lst, lst.begin(), lst.end(), e);
}
......@@ -191,7 +191,7 @@ class abstract_actor : public Base
}
}
void detach(const attachable::token& what) /*override*/
void detach(attachable::token const& what) /*override*/
{
attachable_ptr uptr;
// lifetime scope of guard
......
......@@ -63,8 +63,8 @@ class abstract_event_based_actor : public detail::abstract_scheduled_actor
{
stack_element() = delete;
stack_element(const stack_element&) = delete;
stack_element& operator=(const stack_element&) = delete;
stack_element(stack_element const&) = delete;
stack_element& operator=(stack_element const&) = delete;
util::either<invoke_rules*, timed_invoke_rules*> m_ptr;
bool m_ownership;
......
......@@ -32,10 +32,10 @@ class actor : public channel
protected:
actor(const process_information_ptr& parent = process_information::get());
actor(process_information_ptr const& parent = process_information::get());
actor(std::uint32_t aid,
const process_information_ptr& parent = process_information::get());
process_information_ptr const& parent = process_information::get());
public:
......@@ -67,7 +67,7 @@ class actor : public channel
/**
* @brief Detaches the first attached object that matches @p what.
*/
virtual void detach(const attachable::token& what) = 0;
virtual void detach(attachable::token const& what) = 0;
template<typename T>
bool attach(std::unique_ptr<T>&& ptr,
......@@ -87,7 +87,7 @@ class actor : public channel
* @note Groups are leaved automatically if the Actor finishes
* execution.
*/
void leave(const group_ptr& what);
void leave(group_ptr const& what);
/**
* @brief Links this actor to @p other.
......@@ -148,7 +148,7 @@ class actor : public channel
* @brief Gets the {@link process_information} of the parent process.
* @returns The {@link process_information} of the parent process.
*/
inline const process_information& parent_process() const;
inline process_information const& parent_process() const;
/**
* @brief Gets the {@link process_information} pointer
......@@ -185,7 +185,7 @@ typedef intrusive_ptr<actor> actor_ptr;
* inline and template member function implementations *
******************************************************************************/
inline const process_information& actor::parent_process() const
inline process_information const& actor::parent_process() const
{
return *m_parent_process;
}
......@@ -230,7 +230,7 @@ class functor_attachable : public attachable
m_functor(reason);
}
bool matches(const attachable::token&)
bool matches(attachable::token const&)
{
return false;
}
......
......@@ -14,16 +14,16 @@ class actor_proxy : public abstract_actor<actor>
typedef abstract_actor<actor> super;
void forward_message(const process_information_ptr&,
actor*, const any_tuple&);
void forward_message(process_information_ptr const&,
actor*, any_tuple const&);
public:
actor_proxy(std::uint32_t mid, const process_information_ptr& parent);
actor_proxy(std::uint32_t mid, process_information_ptr const& parent);
void enqueue(actor* sender, any_tuple&& msg);
void enqueue(actor* sender, const any_tuple& msg);
void enqueue(actor* sender, any_tuple const& msg);
void link_to(intrusive_ptr<actor>& other);
......
......@@ -68,7 +68,7 @@ namespace cppa {
* instance (mapped to @p plain_type); otherwise @c false
* is returned and @p uniform_type was deleted.
*/
bool announce(const std::type_info& tinfo, uniform_type_info* utype);
bool announce(std::type_info const& tinfo, uniform_type_info* utype);
// deals with member pointer
/**
......@@ -80,7 +80,7 @@ bool announce(const std::type_info& tinfo, uniform_type_info* utype);
*/
template<class C, class Parent, typename... Args>
std::pair<C Parent::*, util::abstract_uniform_type_info<C>*>
compound_member(C Parent::*c_ptr, const Args&... args)
compound_member(C Parent::*c_ptr, Args const&... args)
{
return { c_ptr, new detail::default_uniform_type_info_impl<C>(args...) };
}
......@@ -88,7 +88,7 @@ compound_member(C Parent::*c_ptr, const Args&... args)
// deals with getter returning a mutable reference
template<class C, class Parent, typename... Args>
std::pair<C& (Parent::*)(), util::abstract_uniform_type_info<C>*>
compound_member(C& (Parent::*c_ptr)(), const Args&... args)
compound_member(C& (Parent::*c_ptr)(), Args const&... args)
{
return { c_ptr, new detail::default_uniform_type_info_impl<C>(args...) };
}
......@@ -99,7 +99,7 @@ template<class Parent, typename GRes,
std::pair<std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>,
util::abstract_uniform_type_info<typename util::rm_ref<GRes>::type>*>
compound_member(const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)>& gspair,
const Args&... args)
Args const&... args)
{
return { gspair, new detail::default_uniform_type_info_impl<typename util::rm_ref<GRes>::type>(args...) };
}
......@@ -112,7 +112,7 @@ compound_member(const std::pair<GRes (Parent::*)() const, SRes (Parent::*)(SArg)
* otherwise @c false.
*/
template<typename T, typename... Args>
inline bool announce(const Args&... args)
inline bool announce(Args const&... args)
{
return announce(typeid(T),
new detail::default_uniform_type_info_impl<T>(args...));
......
......@@ -23,7 +23,7 @@ class any_tuple
cow_ptr<detail::abstract_tuple> m_vals;
explicit any_tuple(const cow_ptr<detail::abstract_tuple>& vals);
explicit any_tuple(cow_ptr<detail::abstract_tuple> const& vals);
public:
......@@ -32,32 +32,32 @@ class any_tuple
any_tuple();
template<typename... Args>
any_tuple(const tuple<Args...>& t) : m_vals(t.vals()) { }
any_tuple(tuple<Args...> const& t) : m_vals(t.vals()) { }
template<typename... Args>
any_tuple(const tuple_view<Args...>& t) : m_vals(t.vals()) { }
any_tuple(tuple_view<Args...> const& t) : m_vals(t.vals()) { }
explicit any_tuple(detail::abstract_tuple*);
any_tuple(any_tuple&&);
any_tuple(const any_tuple&) = default;
any_tuple(any_tuple const&) = default;
any_tuple& operator=(any_tuple&&);
any_tuple& operator=(const any_tuple&) = default;
any_tuple& operator=(any_tuple const&) = default;
size_t size() const;
void* mutable_at(size_t p);
const void* at(size_t p) const;
void const* at(size_t p) const;
const uniform_type_info& utype_info_at(size_t p) const;
uniform_type_info const& utype_info_at(size_t p) const;
const cow_ptr<detail::abstract_tuple>& vals() const;
cow_ptr<detail::abstract_tuple> const& vals() const;
bool equals(const any_tuple& other) const;
bool equals(any_tuple const& other) const;
any_tuple tail(size_t offset = 1) const;
......@@ -67,27 +67,27 @@ class any_tuple
}
template<typename T>
inline const T& get_as(size_t p) const;
inline T const& get_as(size_t p) const;
template<typename T>
inline T& get_mutable_as(size_t p);
};
inline bool operator==(const any_tuple& lhs, const any_tuple& rhs)
inline bool operator==(any_tuple const& lhs, any_tuple const& rhs)
{
return lhs.equals(rhs);
}
inline bool operator!=(const any_tuple& lhs, const any_tuple& rhs)
inline bool operator!=(any_tuple const& lhs, any_tuple const& rhs)
{
return !(lhs == rhs);
}
template<typename T>
inline const T& any_tuple::get_as(size_t p) const
inline T const& any_tuple::get_as(size_t p) const
{
return *reinterpret_cast<const T*>(at(p));
return *reinterpret_cast<T const*>(at(p));
}
template<typename T>
......@@ -97,7 +97,7 @@ inline T& any_tuple::get_mutable_as(size_t p)
}
template<typename... Types>
tuple_view<Types...> tuple_cast(const any_tuple& tup)
tuple_view<Types...> tuple_cast(any_tuple const& tup)
{
return tuple_view<Types...>::from(tup.vals());
}
......
......@@ -8,12 +8,12 @@ namespace cppa {
*/
struct anything { };
inline bool operator==(const anything&, const anything&)
inline bool operator==(anything const&, anything const&)
{
return true;
}
inline bool operator!=(const anything&, const anything&)
inline bool operator!=(anything const&, anything const&)
{
return false;
}
......
......@@ -9,7 +9,7 @@ namespace cppa {
enum class atom_value : std::uint64_t { dirty_little_hack = 37337 };
std::string to_string(const atom_value& a);
std::string to_string(atom_value const& a);
template<size_t Size>
constexpr atom_value atom(const char (&str) [Size])
......
......@@ -12,8 +12,8 @@ namespace cppa {
class attachable
{
attachable(const attachable&) = delete;
attachable& operator=(const attachable&) = delete;
attachable(attachable const&) = delete;
attachable& operator=(attachable const&) = delete;
protected:
......@@ -23,9 +23,9 @@ class attachable
struct token
{
const std::type_info& subtype;
const void* ptr;
inline token(const std::type_info& msubtype, const void* mptr)
std::type_info const& subtype;
void const* ptr;
inline token(std::type_info const& msubtype, void const* mptr)
: subtype(msubtype), ptr(mptr)
{
}
......@@ -41,7 +41,7 @@ class attachable
*/
virtual void actor_exited(std::uint32_t reason) = 0;
virtual bool matches(const token&) = 0;
virtual bool matches(token const&) = 0;
};
......
......@@ -8,25 +8,25 @@ namespace cppa {
class binary_deserializer : public deserializer
{
const char* pos;
const char* end;
char const* pos;
char const* end;
void range_check(size_t read_size);
public:
binary_deserializer(const char* buf, size_t buf_size);
binary_deserializer(const char* begin, const char* end);
binary_deserializer(char const* buf, size_t buf_size);
binary_deserializer(char const* begin, char const* end);
std::string seek_object();
std::string peek_object();
void begin_object(const std::string& type_name);
void begin_object(std::string const& type_name);
void end_object();
size_t begin_sequence();
void end_sequence();
primitive_variant read_value(primitive_type ptype);
void read_tuple(size_t size,
const primitive_type* ptypes,
primitive_type const* ptypes,
primitive_variant* storage);
};
......
......@@ -26,7 +26,7 @@ class binary_serializer : public serializer
~binary_serializer();
void begin_object(const std::string& tname);
void begin_object(std::string const& tname);
void end_object();
......@@ -34,9 +34,9 @@ class binary_serializer : public serializer
void end_sequence();
void write_value(const primitive_variant& value);
void write_value(primitive_variant const& value);
void write_tuple(size_t size, const primitive_variant* values);
void write_tuple(size_t size, primitive_variant const* values);
/**
* @brief Takes the internal buffer and returns it.
......@@ -52,7 +52,7 @@ class binary_serializer : public serializer
/**
* @brief Returns a pointer to the internal buffer.
*/
const char* data() const;
char const* data() const;
/**
* @brief Resets the internal buffer.
......
......@@ -34,7 +34,7 @@ class channel : public ref_counted
/**
* @brief Enqueues @p msg to the list of received messages.
*/
virtual void enqueue(actor* sender, const any_tuple& msg) = 0;
virtual void enqueue(actor* sender, any_tuple const& msg) = 0;
virtual void enqueue(actor* sender, any_tuple&& msg) = 0;
......
......@@ -21,14 +21,14 @@ constexpr int copy_method()
// is_copyable
template<typename T>
T* copy_of(const T* what, std::integral_constant<int, 1>)
T* copy_of(T const* what, std::integral_constant<int, 1>)
{
return new T(*what);
}
// has_copy_member_fun
template<typename T>
T* copy_of(const T* what, std::integral_constant<int, 2>)
T* copy_of(T const* what, std::integral_constant<int, 2>)
{
return what->copy();
}
......@@ -71,17 +71,17 @@ class cow_ptr
cow_ptr(T* raw_ptr) : m_ptr(raw_ptr) { }
cow_ptr(const cow_ptr& other) : m_ptr(other.m_ptr) { }
cow_ptr(cow_ptr const& other) : m_ptr(other.m_ptr) { }
template<typename Y>
cow_ptr(const cow_ptr<Y>& other) : m_ptr(const_cast<Y*>(other.get())) { }
cow_ptr(cow_ptr<Y> const& other) : m_ptr(const_cast<Y*>(other.get())) { }
inline void swap(cow_ptr& other)
{
m_ptr.swap(other.m_ptr);
}
cow_ptr& operator=(const cow_ptr& other)
cow_ptr& operator=(cow_ptr const& other)
{
cow_ptr tmp(other);
swap(tmp);
......@@ -89,7 +89,7 @@ class cow_ptr
}
template<typename Y>
cow_ptr& operator=(const cow_ptr<Y>& other)
cow_ptr& operator=(cow_ptr<Y> const& other)
{
cow_ptr tmp(other);
swap(tmp);
......@@ -98,15 +98,15 @@ class cow_ptr
inline T* get() { return detach_ptr(); }
inline const T* get() const { return m_ptr.get(); }
inline T const* get() const { return m_ptr.get(); }
inline T* operator->() { return detach_ptr(); }
inline T& operator*() { return detach_ptr(); }
inline const T* operator->() const { return m_ptr.get(); }
inline T const* operator->() const { return m_ptr.get(); }
inline const T& operator*() const { return *m_ptr.get(); }
inline T const& operator*() const { return *m_ptr.get(); }
inline explicit operator bool() const { return static_cast<bool>(m_ptr); }
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef CPPA_HPP
#define CPPA_HPP
......@@ -210,7 +182,7 @@
* @code
* receive
* (
* on<atom("hello"), std::string>() >> [](const std::string& msg)
* on<atom("hello"), std::string>() >> [](std::string const& msg)
* {
* cout << "received hello message: " << msg << endl;
* },
......@@ -235,7 +207,7 @@
* @code
* receive
* (
* on(atom("hello"), val<std::string>()) >> [](const std::string& msg)
* on(atom("hello"), val<std::string>()) >> [](std::string const& msg)
* {
* cout << "received hello message: " << msg << endl;
* },
......@@ -346,7 +318,7 @@
*
* The message passing of @p libcppa prohibits pointers in messages because
* it enforces network transparent messaging.
* Unfortunately, string literals in @p C++ have the type <tt>const char*</tt>,
* Unfortunately, string literals in @p C++ have the type <tt>char const*</tt>,
* resp. <tt>const char[]</tt>. Since @p libcppa is a user-friendly library,
* it silently converts string literals and C-strings to @p std::string objects.
* It also converts unicode literals to the corresponding STL container.
......@@ -356,7 +328,7 @@
* // sends an std::string containing "hello actor!" to itself
* send(self, "hello actor!");
*
* const char* cstring = "cstring";
* char const* cstring = "cstring";
* // sends an std::string containing "cstring" to itself
* send(self, cstring);
*
......@@ -487,7 +459,7 @@ inline actor_ptr spawn(abstract_event_based_actor* what)
*/
template<scheduling_hint Hint, typename F, typename... Args>
auto //actor_ptr
spawn(F&& what, const Args&... args)
spawn(F&& what, Args const&... args)
-> typename util::disable_if_c< std::is_convertible<typename util::rm_ref<F>::type, scheduled_actor*>::value
|| std::is_convertible<typename util::rm_ref<F>::type, event_based_actor*>::value,
actor_ptr>::type
......@@ -506,7 +478,7 @@ spawn(F&& what, const Args&... args)
*/
template<typename F, typename... Args>
auto // actor_ptr
spawn(F&& what, const Args&... args)
spawn(F&& what, Args const&... args)
-> typename util::disable_if_c< std::is_convertible<typename util::rm_ref<F>::type, scheduled_actor*>::value
|| std::is_convertible<typename util::rm_ref<F>::type, event_based_actor*>::value,
actor_ptr>::type
......@@ -678,7 +650,7 @@ inline actor_ptr& last_sender()
* @param args Any number of values for the message content.
*/
template<typename Arg0, typename... Args>
void send(channel_ptr& whom, const Arg0& arg0, const Args&... args);
void send(channel_ptr& whom, Arg0 const& arg0, Args const&... args);
/**
* @brief Send a message to @p whom.
......@@ -693,56 +665,36 @@ void send(channel_ptr& whom, const Arg0& arg0, const Args&... args);
* @param what Content of the message.
* @returns @p whom.
*/
channel_ptr& operator<<(channel_ptr& whom, const any_tuple& what);
channel_ptr& operator<<(channel_ptr& whom, any_tuple const& what);
#else
template<class C, typename Arg0, typename... Args>
typename util::enable_if<std::is_base_of<channel, C>, void>::type
send(intrusive_ptr<C>& whom, const Arg0& arg0, const Args&... args)
void send(intrusive_ptr<C>& whom, Arg0 const& arg0, Args const&... args)
{
static_assert(std::is_base_of<channel, C>::value, "C is not a channel");
if (whom) whom->enqueue(self, make_tuple(arg0, args...));
}
template<class C, typename Arg0, typename... Args>
typename util::enable_if<std::is_base_of<channel, C>, void>::type
send(intrusive_ptr<C>&& whom, const Arg0& arg0, const Args&... args)
void send(intrusive_ptr<C>&& whom, Arg0 const& arg0, Args const&... args)
{
static_assert(std::is_base_of<channel, C>::value, "C is not a channel");
intrusive_ptr<C> tmp(std::move(whom));
if (tmp) tmp->enqueue(self, make_tuple(arg0, args...));
}
// matches send(self, ...);
template<typename Arg0, typename... Args>
void send(local_actor* whom, const Arg0& arg0, const Args&... args)
void send(self_type const&, Arg0 const& arg0, Args const&... args)
{
if (whom) whom->enqueue(self, make_tuple(arg0, args...));
}
template<class C>
typename util::enable_if<std::is_base_of<channel, C>, void>::type
send_tuple(intrusive_ptr<C>& whom, const any_tuple& what)
{
if (whom) whom->enqueue(self, what);
}
template<class C>
typename util::enable_if<std::is_base_of<channel, C>, void>::type
send_tuple(intrusive_ptr<C>&& whom, const any_tuple& what)
{
intrusive_ptr<C> tmp(std::move(whom));
if (tmp) tmp->enqueue(self, what);
}
// matches send(self, ...);
inline void send_tuple(local_actor* whom, const any_tuple& what)
{
if (whom) whom->enqueue(self, what);
local_actor* s = self;
s->enqueue(s, make_tuple(arg0, args...));
}
template<class C>
typename util::enable_if<std::is_base_of<channel, C>, intrusive_ptr<C>&>::type
operator<<(intrusive_ptr<C>& whom, const any_tuple& what)
operator<<(intrusive_ptr<C>& whom, any_tuple const& what)
{
if (whom) whom->enqueue(self, what);
return whom;
......@@ -750,7 +702,7 @@ operator<<(intrusive_ptr<C>& whom, const any_tuple& what)
template<class C>
typename util::enable_if<std::is_base_of<channel, C>, intrusive_ptr<C>>::type
operator<<(intrusive_ptr<C>&& whom, const any_tuple& what)
operator<<(intrusive_ptr<C>&& whom, any_tuple const& what)
{
intrusive_ptr<C> tmp(std::move(whom));
if (tmp) tmp->enqueue(self, what);
......@@ -774,25 +726,18 @@ operator<<(intrusive_ptr<C>&& whom, any_tuple&& what)
return std::move(tmp);
}
// matches self << make_tuple(...)
local_actor* operator<<(local_actor* whom, const any_tuple& what);
self_type const& operator<<(self_type const& s, any_tuple const& what);
// matches self << make_tuple(...)
local_actor* operator<<(local_actor* whom, any_tuple&& what);
self_type const& operator<<(self_type const& s, any_tuple&& what);
#endif
template<typename Arg0, typename... Args>
void reply(const Arg0& arg0, const Args&... args)
void reply(Arg0 const& arg0, Args const&... args)
{
send(self->last_sender(), arg0, args...);
}
inline void reply_tuple(const any_tuple& what)
{
send_tuple(self->last_sender(), what);
}
/**
* @brief Sends a message to @p whom that is delayed by @p rel_time.
* @param whom Receiver of the message.
......@@ -800,7 +745,7 @@ inline void reply_tuple(const any_tuple& what)
* @param data Any number of values for the message content.
*/
template<typename Duration, typename... Data>
void future_send(actor_ptr whom, const Duration& rel_time, const Data&... data)
void future_send(actor_ptr whom, Duration const& rel_time, Data const&... data)
{
get_scheduler()->future_send(whom, rel_time, data...);
}
......@@ -838,7 +783,7 @@ void publish(actor_ptr&& whom, std::uint16_t port);
* @param port TCP port.
* @returns A pointer to the proxy instance that represents the remote Actor.
*/
actor_ptr remote_actor(const char* host, std::uint16_t port);
actor_ptr remote_actor(char const* host, std::uint16_t port);
} // namespace cppa
......
......@@ -18,8 +18,8 @@ class object;
class deserializer
{
deserializer(const deserializer&) = delete;
deserializer& operator=(const deserializer&) = delete;
deserializer(deserializer const&) = delete;
deserializer& operator=(deserializer const&) = delete;
public:
......@@ -43,7 +43,7 @@ class deserializer
* @brief Begins deserialization of an object of type @p type_name.
* @param type_name The platform-independent @p libcppa type name.
*/
virtual void begin_object(const std::string& type_name) = 0;
virtual void begin_object(std::string const& type_name) = 0;
/**
* @brief Ends deserialization of an object.
......@@ -76,7 +76,7 @@ class deserializer
* @param storage Array of size @p num, storing the result of this function.
*/
virtual void read_tuple(size_t num,
const primitive_type* ptypes,
primitive_type const* ptypes,
primitive_variant* storage ) = 0;
};
......
......@@ -52,7 +52,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
ordinary_message
};
filter_result filter_msg(const any_tuple& msg);
filter_result filter_msg(any_tuple const& msg);
dq_result dq(std::unique_ptr<queue_node>& node,
invoke_rules_base& rules,
......@@ -63,7 +63,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
return m_has_pending_timeout_request;
}
void request_timeout(const util::duration& d);
void request_timeout(util::duration const& d);
void reset_timeout()
{
......@@ -105,7 +105,7 @@ class abstract_scheduled_actor : public abstract_actor<local_actor>
void enqueue(actor* sender, any_tuple&& msg);
void enqueue(actor* sender, const any_tuple& msg);
void enqueue(actor* sender, any_tuple const& msg);
int compare_exchange_state(int expected, int new_value);
......@@ -135,7 +135,7 @@ struct scheduled_actor_dummy : abstract_scheduled_actor
void unlink_from(intrusive_ptr<actor>&);
bool establish_backlink(intrusive_ptr<actor>&);
bool remove_backlink(intrusive_ptr<actor>&);
void detach(const attachable::token&);
void detach(attachable::token const&);
bool attach(attachable*);
};
......
......@@ -17,10 +17,10 @@ struct abstract_tuple : ref_counted
// accessors
virtual size_t size() const = 0;
virtual abstract_tuple* copy() const = 0;
virtual const void* at(size_t pos) const = 0;
virtual const uniform_type_info& utype_info_at(size_t pos) const = 0;
virtual void const* at(size_t pos) const = 0;
virtual uniform_type_info const& utype_info_at(size_t pos) const = 0;
virtual bool equals(const abstract_tuple& other) const;
virtual bool equals(abstract_tuple const& other) const;
};
......
......@@ -28,7 +28,7 @@ class actor_proxy_cache
new_proxy_callback m_new_cb;
process_information_ptr get_pinfo(const key_tuple& key);
process_information_ptr get_pinfo(key_tuple const& key);
public:
......@@ -39,13 +39,13 @@ class actor_proxy_cache
m_new_cb = std::forward<F>(cb);
}
actor_proxy_ptr get(const key_tuple& key);
actor_proxy_ptr get(key_tuple const& key);
void add(actor_proxy_ptr& pptr);
size_t size() const;
void erase(const actor_proxy_ptr& pptr);
void erase(actor_proxy_ptr const& pptr);
template<typename F>
void for_each(F&& fun)
......
......@@ -18,26 +18,26 @@ class addressed_message
public:
addressed_message(const actor_ptr& from,
const channel_ptr& to,
const any_tuple& ut);
addressed_message(actor_ptr const& from,
channel_ptr const& to,
any_tuple const& ut);
addressed_message(const actor_ptr& from,
const channel_ptr& to,
addressed_message(actor_ptr const& from,
channel_ptr const& to,
any_tuple&& ut);
addressed_message() = default;
addressed_message(addressed_message&&) = default;
addressed_message(const addressed_message&) = default;
addressed_message(addressed_message const&) = default;
addressed_message& operator=(addressed_message&&) = default;
addressed_message& operator=(const addressed_message&) = default;
addressed_message& operator=(addressed_message const&) = default;
inline actor_ptr& sender()
{
return m_sender;
}
inline const actor_ptr& sender() const
inline actor_ptr const& sender() const
{
return m_sender;
}
......@@ -47,7 +47,7 @@ class addressed_message
return m_receiver;
}
inline const channel_ptr& receiver() const
inline channel_ptr const& receiver() const
{
return m_receiver;
}
......@@ -57,7 +57,7 @@ class addressed_message
return m_content;
}
inline const any_tuple& content() const
inline any_tuple const& content() const
{
return m_content;
}
......@@ -75,9 +75,9 @@ class addressed_message
};
bool operator==(const addressed_message& lhs, const addressed_message& rhs);
bool operator==(addressed_message const& lhs, addressed_message const& rhs);
inline bool operator!=(const addressed_message& lhs, const addressed_message& rhs)
inline bool operator!=(addressed_message const& lhs, addressed_message const& rhs)
{
return !(lhs == rhs);
}
......
......@@ -27,7 +27,7 @@ inline constexpr std::uint64_t next_interim(std::uint64_t tmp, size_t char_code)
return (tmp << 6) | encoding_table[char_code];
}
constexpr std::uint64_t atom_val(const char* str, std::uint64_t interim = 0)
constexpr std::uint64_t atom_val(char const* str, std::uint64_t interim = 0)
{
return (*str <= 0) ? interim
: atom_val(str + 1, next_interim(interim, *str));
......
......@@ -10,7 +10,7 @@ namespace cppa { namespace detail {
// public part of the actor interface
struct channel : ref_counted
{
virtual void enqueue_msg(const message& msg) = 0;
virtual void enqueue_msg(message const& msg) = 0;
};
} } // namespace cppa::detail
......
......@@ -43,7 +43,7 @@ class converted_thread_context : public abstract_actor<local_actor>
void enqueue(actor* sender, any_tuple&& msg) /*override*/;
void enqueue(actor* sender, const any_tuple& msg) /*override*/;
void enqueue(actor* sender, any_tuple const& msg) /*override*/;
void dequeue(invoke_rules& rules) /*override*/;
......@@ -69,7 +69,7 @@ class converted_thread_context : public abstract_actor<local_actor>
invoke_rules_base& rules,
queue_node_buffer& buffer);
throw_on_exit_result throw_on_exit(const any_tuple& msg);
throw_on_exit_result throw_on_exit(any_tuple const& msg);
pattern<atom_value, actor_ptr, std::uint32_t> m_exit_msg_pattern;
......
......@@ -27,7 +27,7 @@ class decorated_tuple : public abstract_tuple
typedef cow_ptr<abstract_tuple> ptr_type;
decorated_tuple(const ptr_type& d, const vector_type& v)
decorated_tuple(ptr_type const& d, vector_type const& v)
: m_decorated(d), m_mappings(v)
{
}
......@@ -47,17 +47,17 @@ class decorated_tuple : public abstract_tuple
return new decorated_tuple(*this);
}
virtual const void* at(size_t pos) const
virtual void const* at(size_t pos) const
{
return m_decorated->at(m_mappings[pos]);
}
virtual const uniform_type_info& utype_info_at(size_t pos) const
virtual uniform_type_info const& utype_info_at(size_t pos) const
{
return m_decorated->utype_info_at(m_mappings[pos]);
}
virtual bool equals(const abstract_tuple&) const
virtual bool equals(abstract_tuple const&) const
{
return false;
}
......@@ -67,14 +67,14 @@ class decorated_tuple : public abstract_tuple
ptr_type m_decorated;
vector_type m_mappings;
decorated_tuple(const decorated_tuple& other)
decorated_tuple(decorated_tuple const& other)
: abstract_tuple()
, m_decorated(other.m_decorated)
, m_mappings(other.m_mappings)
{
}
decorated_tuple& operator=(const decorated_tuple&) = delete;
decorated_tuple& operator=(decorated_tuple const&) = delete;
};
......
......@@ -91,16 +91,16 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
uniform_type_info* m_meta;
std::function<void (const uniform_type_info*,
const void*,
std::function<void (uniform_type_info const*,
void const*,
serializer* )> m_serialize;
std::function<void (const uniform_type_info*,
std::function<void (uniform_type_info const*,
void*,
deserializer* )> m_deserialize;
member(const member&) = delete;
member& operator=(const member&) = delete;
member(member const&) = delete;
member& operator=(member const&) = delete;
void swap(member& other)
{
......@@ -122,13 +122,13 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
template<typename R, class C>
member(uniform_type_info* mtptr, R C::*mem_ptr) : m_meta(mtptr)
{
m_serialize = [mem_ptr] (const uniform_type_info* mt,
const void* obj,
m_serialize = [mem_ptr] (uniform_type_info const* mt,
void const* obj,
serializer* s)
{
mt->serialize(&(*reinterpret_cast<const C*>(obj).*mem_ptr), s);
mt->serialize(&(*reinterpret_cast<C const*>(obj).*mem_ptr), s);
};
m_deserialize = [mem_ptr] (const uniform_type_info* mt,
m_deserialize = [mem_ptr] (uniform_type_info const* mt,
void* obj,
deserializer* d)
{
......@@ -145,14 +145,14 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
typedef typename util::rm_ref<SArg>::type setter_arg;
static_assert(std::is_same<getter_result, setter_arg>::value,
"getter result doesn't match setter argument");
m_serialize = [getter] (const uniform_type_info* mt,
const void* obj,
m_serialize = [getter] (uniform_type_info const* mt,
void const* obj,
serializer* s)
{
GRes v = (*reinterpret_cast<const C*>(obj).*getter)();
GRes v = (*reinterpret_cast<C const*>(obj).*getter)();
mt->serialize(&v, s);
};
m_deserialize = [setter] (const uniform_type_info* mt,
m_deserialize = [setter] (uniform_type_info const* mt,
void* obj,
deserializer* d)
{
......@@ -173,11 +173,11 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
{
return {
mtptr,
[] (const uniform_type_info* mt, const void* obj, serializer* s)
[] (uniform_type_info const* mt, void const* obj, serializer* s)
{
mt->serialize(obj, s);
},
[] (const uniform_type_info* mt, void* obj, deserializer* d)
[] (uniform_type_info const* mt, void* obj, deserializer* d)
{
mt->deserialize(obj, d);
}
......@@ -195,7 +195,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
return *this;
}
inline void serialize(const void* parent, serializer* s) const
inline void serialize(void const* parent, serializer* s) const
{
m_serialize(m_meta, parent, s);
}
......@@ -322,7 +322,7 @@ class default_uniform_type_info_impl : public util::abstract_uniform_type_info<T
}
}
void serialize(const void* obj, serializer* s) const
void serialize(void const* obj, serializer* s) const
{
s->begin_object(this->name());
for (auto& m : m_members)
......
......@@ -5,7 +5,7 @@
namespace cppa { namespace detail {
std::string demangle(const char* typeid_name);
std::string demangle(char const* typeid_name);
} } // namespace cppa::detail
......
......@@ -11,9 +11,9 @@ struct empty_tuple : cppa::detail::abstract_tuple
size_t size() const;
void* mutable_at(size_t);
abstract_tuple* copy() const;
const void* at(size_t) const;
bool equals(const abstract_tuple& other) const;
const uniform_type_info& utype_info_at(size_t) const;
void const* at(size_t) const;
bool equals(abstract_tuple const& other) const;
uniform_type_info const& utype_info_at(size_t) const;
};
......
......@@ -36,7 +36,7 @@ class ftor_behavior<true, true, F, Args...> : public scheduled_actor
public:
ftor_behavior(F ptr, const Args&... args) : m_fun(ptr), m_args(args...) { }
ftor_behavior(F ptr, Args const&... args) : m_fun(ptr), m_args(args...) { }
virtual void act() { invoke(m_fun, m_args); }
......@@ -50,7 +50,7 @@ class ftor_behavior<false, false, F> : public scheduled_actor
public:
ftor_behavior(const F& arg) : m_fun(arg) { }
ftor_behavior(F const& arg) : m_fun(arg) { }
ftor_behavior(F&& arg) : m_fun(std::move(arg)) { }
......@@ -69,11 +69,11 @@ class ftor_behavior<false, true, F, Args...> : public scheduled_actor
public:
ftor_behavior(const F& f, const Args&... args) : m_fun(f), m_args(args...)
ftor_behavior(F const& f, Args const&... args) : m_fun(f), m_args(args...)
{
}
ftor_behavior(F&& f,const Args&... args) : m_fun(std::move(f))
ftor_behavior(F&& f,Args const&... args) : m_fun(std::move(f))
, m_args(args...)
{
}
......@@ -106,8 +106,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,false>, F&& ftor)
template<typename F, typename Arg0, typename... Args>
scheduled_actor* get_behavior(std::integral_constant<bool,true>,
F fptr,
const Arg0& arg0,
const Args&... args)
Arg0 const& arg0,
Args const&... args)
{
static_assert(std::is_convertible<decltype(fptr(arg0, args...)), scheduled_actor*>::value == false,
"Spawning a function returning an actor_behavior? "
......@@ -120,8 +120,8 @@ scheduled_actor* get_behavior(std::integral_constant<bool,true>,
template<typename F, typename Arg0, typename... Args>
scheduled_actor* get_behavior(std::integral_constant<bool,false>,
F ftor,
const Arg0& arg0,
const Args&... args)
Arg0 const& arg0,
Args const&... args)
{
static_assert(std::is_convertible<decltype(ftor(arg0, args...)), scheduled_actor*>::value == false,
"Spawning a functor returning an actor_behavior? "
......
......@@ -16,8 +16,8 @@ class group_manager
group_manager();
intrusive_ptr<group> get(const std::string& module_name,
const std::string& group_identifier);
intrusive_ptr<group> get(std::string const& module_name,
std::string const& group_identifier);
void add_module(group::module*);
......
......@@ -17,20 +17,20 @@ template<typename T>
struct implicit_conversions
{
typedef typename util::replace_type<T, std::string,
std::is_same<T, const char*>,
std::is_same<T, char const*>,
std::is_same<T, char*>,
util::is_array_of<T, char>,
util::is_array_of<T, const char> >::type
subtype1;
typedef typename util::replace_type<subtype1, std::u16string,
std::is_same<subtype1, const char16_t*>,
std::is_same<subtype1, char16_t const*>,
std::is_same<subtype1, char16_t*>,
util::is_array_of<subtype1, char16_t>>::type
subtype2;
typedef typename util::replace_type<subtype2, std::u32string,
std::is_same<subtype2, const char32_t*>,
std::is_same<subtype2, char32_t const*>,
std::is_same<subtype2, char32_t*>,
util::is_array_of<subtype2, char32_t>>::type
subtype3;
......
......@@ -8,8 +8,8 @@ namespace cppa { namespace detail {
class intermediate
{
intermediate(const intermediate&) = delete;
intermediate& operator=(const intermediate&) = delete;
intermediate(intermediate const&) = delete;
intermediate& operator=(intermediate const&) = delete;
public:
......@@ -53,7 +53,7 @@ class intermediate_impl<Impl, void> : public intermediate
public:
intermediate_impl(const Impl& impl) : m_impl(impl) { }
intermediate_impl(Impl const& impl) : m_impl(impl) { }
intermediate_impl(Impl&& impl) : m_impl(std::move(impl)) { }
......
......@@ -19,14 +19,14 @@ namespace cppa { namespace detail {
class invokable_base
{
invokable_base(const invokable_base&) = delete;
invokable_base& operator=(const invokable_base&) = delete;
invokable_base(invokable_base const&) = delete;
invokable_base& operator=(invokable_base const&) = delete;
public:
invokable_base() = default;
virtual ~invokable_base();
virtual bool invoke(const any_tuple&) const = 0;
virtual bool invoke(any_tuple const&) const = 0;
};
......@@ -37,11 +37,11 @@ class timed_invokable : public invokable_base
protected:
timed_invokable(const util::duration&);
timed_invokable(util::duration const&);
public:
inline const util::duration& timeout() const
inline util::duration const& timeout() const
{
return m_timeout;
}
......@@ -58,12 +58,12 @@ class timed_invokable_impl : public timed_invokable
public:
timed_invokable_impl(const util::duration& d, const TargetFun& tfun)
timed_invokable_impl(util::duration const& d, TargetFun const& tfun)
: super(d), m_target(tfun)
{
}
bool invoke(const any_tuple&) const
bool invoke(any_tuple const&) const
{
m_target();
return true;
......@@ -76,7 +76,7 @@ class invokable : public invokable_base
public:
virtual intermediate* get_intermediate(const any_tuple&) = 0;
virtual intermediate* get_intermediate(any_tuple const&) = 0;
};
......@@ -87,10 +87,10 @@ class invokable_impl : public invokable
struct iimpl : intermediate
{
const TargetFun& m_target;
TargetFun const& m_target;
TupleView m_args;
iimpl(const TargetFun& tf) : m_target(tf)
iimpl(TargetFun const& tf) : m_target(tf)
{
}
......@@ -109,12 +109,12 @@ class invokable_impl : public invokable
public:
invokable_impl(std::unique_ptr<Pattern>&& pptr, const TargetFun& mt)
invokable_impl(std::unique_ptr<Pattern>&& pptr, TargetFun const& mt)
: m_pattern(std::move(pptr)), m_target(mt), m_iimpl(m_target)
{
}
bool invoke(const any_tuple& data) const
bool invoke(any_tuple const& data) const
{
vector_type mv;
......@@ -137,7 +137,7 @@ class invokable_impl : public invokable
return false;
}
intermediate* get_intermediate(const any_tuple& data)
intermediate* get_intermediate(any_tuple const& data)
{
vector_type mv;
if ((*m_pattern)(data, &mv))
......@@ -164,9 +164,9 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
struct iimpl : intermediate
{
const TargetFun& m_target;
TargetFun const& m_target;
iimpl(const TargetFun& tf) : m_target(tf)
iimpl(TargetFun const& tf) : m_target(tf)
{
}
......@@ -182,12 +182,12 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
public:
invokable_impl(std::unique_ptr<Pattern>&& pptr, const TargetFun& mt)
invokable_impl(std::unique_ptr<Pattern>&& pptr, TargetFun const& mt)
: m_pattern(std::move(pptr)), m_target(mt), m_iimpl(m_target)
{
}
bool invoke(const any_tuple& data) const
bool invoke(any_tuple const& data) const
{
if ((*m_pattern)(data, nullptr))
{
......@@ -197,7 +197,7 @@ class invokable_impl<TupleClass<>, Pattern, TargetFun> : public invokable
return false;
}
intermediate* get_intermediate(const any_tuple& data)
intermediate* get_intermediate(any_tuple const& data)
{
return ((*m_pattern)(data, nullptr)) ? &m_iimpl : nullptr;
}
......
......@@ -11,7 +11,7 @@ struct list_member_util
{
typedef typename List::value_type value_type;
static constexpr primitive_type vptype = type_to_ptype<value_type>::ptype;
void operator()(const List& list, serializer* s) const
void operator()(List const& list, serializer* s) const
{
s->begin_sequence(list.size());
for (auto i = list.begin(); i != list.end(); ++i)
......@@ -37,13 +37,13 @@ struct list_member_util<List, false>
{
typedef typename List::value_type value_type;
const uniform_type_info* m_value_type;
uniform_type_info const* m_value_type;
list_member_util() : m_value_type(uniform_typeid<value_type>())
{
}
void operator()(const List& list, serializer* s) const
void operator()(List const& list, serializer* s) const
{
s->begin_sequence(list.size());
for (auto i = list.begin(); i != list.end(); ++i)
......@@ -76,9 +76,9 @@ class list_member : public util::abstract_uniform_type_info<List>
public:
void serialize(const void* obj, serializer* s) const
void serialize(void const* obj, serializer* s) const
{
auto& list = *reinterpret_cast<const List*>(obj);
auto& list = *reinterpret_cast<List const*>(obj);
m_helper(list, s);
}
......
......@@ -15,9 +15,9 @@ struct mailman_send_job
process_information_ptr target_peer;
addressed_message msg;
inline mailman_send_job(process_information_ptr piptr,
const actor_ptr& from,
const channel_ptr& to,
const any_tuple& content)
actor_ptr const& from,
channel_ptr const& to,
any_tuple const& content)
: target_peer(piptr), msg(from, to, content)
{
}
......@@ -28,7 +28,7 @@ struct mailman_add_peer
native_socket_type sockfd;
process_information_ptr pinfo;
inline mailman_add_peer(native_socket_type fd,
const process_information_ptr& piptr)
process_information_ptr const& piptr)
: sockfd(fd), pinfo(piptr)
{
}
......@@ -49,11 +49,11 @@ class mailman_job
};
mailman_job(process_information_ptr piptr,
const actor_ptr& from,
const channel_ptr& to,
const any_tuple& omsg);
actor_ptr const& from,
channel_ptr const& to,
any_tuple const& omsg);
mailman_job(native_socket_type sockfd, const process_information_ptr& pinfo);
mailman_job(native_socket_type sockfd, process_information_ptr const& pinfo);
static mailman_job* kill_job();
......
......@@ -23,7 +23,7 @@ struct map_member_util<T, false, true>
{
primitive_member<T> impl;
void serialize_value(const T& what, serializer* s) const
void serialize_value(T const& what, serializer* s) const
{
impl.serialize(&what, s);
}
......@@ -41,13 +41,13 @@ struct map_member_util<T, false, true>
template<typename T>
struct map_member_util<T, false, false>
{
const uniform_type_info* m_type;
uniform_type_info const* m_type;
map_member_util() : m_type(uniform_typeid<T>())
{
}
void serialize_value(const T& what, serializer* s) const
void serialize_value(T const& what, serializer* s) const
{
m_type->serialize(&what, s);
}
......@@ -73,7 +73,7 @@ struct map_member_util<T, true, false>
pair_member<first_type, second_type> impl;
void serialize_value(const T& what, serializer* s) const
void serialize_value(T const& what, serializer* s) const
{
// impl needs a pair without const modifier
std::pair<first_type, second_type> p(what.first, what.second);
......@@ -105,11 +105,11 @@ class map_member : public util::abstract_uniform_type_info<Map>
public:
void serialize(const void* obj, serializer* s) const
void serialize(void const* obj, serializer* s) const
{
auto& mp = *reinterpret_cast<const Map*>(obj);
auto& mp = *reinterpret_cast<Map const*>(obj);
s->begin_sequence(mp.size());
for (const auto& val : mp)
for (auto const& val : mp)
{
m_helper.serialize_value(val, s);
}
......
......@@ -16,12 +16,12 @@ namespace cppa { namespace detail {
#ifdef CPPA_WINDOWS
typedef SOCKET native_socket_type;
typedef const char* socket_send_ptr;
typedef char const* socket_send_ptr;
typedef char* socket_recv_ptr;
constexpr SOCKET invalid_socket = INVALID_SOCKET;
#else
typedef int native_socket_type;
typedef const void* socket_send_ptr;
typedef void const* socket_send_ptr;
typedef void* socket_recv_ptr;
constexpr int invalid_socket = -1;
void closesocket(native_socket_type s);
......
......@@ -19,14 +19,14 @@ class object_array : public detail::abstract_tuple
object_array(object_array&& other);
object_array(const object_array& other);
object_array(object_array const& other);
/**
* @pre
*/
void push_back(object&& what);
void push_back(const object& what);
void push_back(object const& what);
void* mutable_at(size_t pos);
......@@ -34,11 +34,11 @@ class object_array : public detail::abstract_tuple
abstract_tuple* copy() const;
const void* at(size_t pos) const;
void const* at(size_t pos) const;
bool equals(const cppa::detail::abstract_tuple&) const;
bool equals(cppa::detail::abstract_tuple const&) const;
const uniform_type_info& utype_info_at(size_t pos) const;
uniform_type_info const& utype_info_at(size_t pos) const;
};
......
......@@ -6,7 +6,7 @@
namespace cppa {
template<typename T>
const utype& uniform_type_info();
utype const& uniform_type_info();
}
......@@ -17,11 +17,11 @@ struct obj_impl : object
{
T m_value;
obj_impl() : m_value() { }
obj_impl(const T& v) : m_value(v) { }
obj_impl(T const& v) : m_value(v) { }
virtual object* copy() const { return new obj_impl(m_value); }
virtual const utype& type() const { return uniform_type_info<T>(); }
virtual utype const& type() const { return uniform_type_info<T>(); }
virtual void* mutable_value() { return &m_value; }
virtual const void* value() const { return &m_value; }
virtual void const* value() const { return &m_value; }
virtual void serialize(serializer& s) const
{
s << m_value;
......
......@@ -25,9 +25,9 @@ class pair_member : public util::abstract_uniform_type_info<std::pair<T1,T2>>
public:
void serialize(const void* obj, serializer* s) const
void serialize(void const* obj, serializer* s) const
{
auto& p = *reinterpret_cast<const pair_type*>(obj);
auto& p = *reinterpret_cast<pair_type const*>(obj);
primitive_variant values[2] = { p.first, p.second };
s->write_tuple(2, values);
}
......
......@@ -35,9 +35,9 @@ struct fill_vecs_util
inline static void _(size_t pos,
size_t dt_size,
bool* dt_invalids,
const DataTuple& dt,
const cppa::uniform_type_info** utis,
const void** data_ptrs)
DataTuple const& dt,
cppa::uniform_type_info const* * utis,
void const* * data_ptrs)
{
utis[pos] = uniform_typeid<T0>();
if (pos < dt_size && dt_invalids[pos] == false)
......@@ -58,9 +58,9 @@ struct fill_vecs_util<anything>
inline static void _(size_t pos,
size_t,
bool*,
const DataTuple&,
const cppa::uniform_type_info** utis,
const void** data_ptrs)
DataTuple const&,
cppa::uniform_type_info const* * utis,
void const* * data_ptrs)
{
utis[pos] = nullptr;
data_ptrs[pos] = nullptr;
......@@ -71,9 +71,9 @@ template<typename DataTuple, typename T0>
void fill_vecs(size_t pos,
size_t dt_size,
bool* dt_invalids,
const DataTuple& dt,
const cppa::uniform_type_info** utis,
const void** data_ptrs)
DataTuple const& dt,
cppa::uniform_type_info const* * utis,
void const* * data_ptrs)
{
fill_vecs_util<T0>::_(pos, dt_size, dt_invalids, dt, utis, data_ptrs);
}
......@@ -82,9 +82,9 @@ template<typename DataTuple, typename T0, typename T1, typename... Tn>
void fill_vecs(size_t pos,
size_t dt_size,
bool* dt_invalids,
const DataTuple& dt,
const cppa::uniform_type_info** utis,
const void** data_ptrs)
DataTuple const& dt,
cppa::uniform_type_info const* * utis,
void const* * data_ptrs)
{
fill_vecs_util<T0>::_(pos, dt_size, dt_invalids,
dt, utis, data_ptrs);
......@@ -112,9 +112,9 @@ struct pattern_arg
{
}
pattern_arg(const pattern_arg&) = default;
pattern_arg(pattern_arg const&) = default;
pattern_arg& operator=(const pattern_arg&) = default;
pattern_arg& operator=(pattern_arg const&) = default;
inline bool at_end() const { return m_pos == m_size; }
......@@ -124,12 +124,12 @@ struct pattern_arg
return *this;
}
inline const uniform_type_info* type() const
inline uniform_type_info const* type() const
{
return m_types[m_pos];
}
inline const void* value() const
inline void const* value() const
{
return m_data[m_pos];
}
......@@ -147,13 +147,13 @@ struct tuple_iterator_arg
util::any_tuple_iterator iter;
vector_type* mapping;
inline tuple_iterator_arg(const any_tuple& tup,
inline tuple_iterator_arg(any_tuple const& tup,
vector_type* mv = nullptr)
: iter(tup), mapping(mv)
{
}
inline tuple_iterator_arg(const util::any_tuple_iterator& from_iter,
inline tuple_iterator_arg(util::any_tuple_iterator const& from_iter,
vector_type* mv = nullptr)
: iter(from_iter), mapping(mv)
{
......@@ -173,12 +173,12 @@ struct tuple_iterator_arg
return *this;
}
inline const uniform_type_info* type() const
inline uniform_type_info const* type() const
{
return &(iter.type());
}
inline const void* value() const
inline void const* value() const
{
return iter.value_ptr();
}
......
......@@ -11,12 +11,12 @@ namespace cppa { namespace detail {
void post_office_loop(int pipe_read_handle, int pipe_write_handle);
void post_office_add_peer(native_socket_type peer_socket,
const process_information_ptr& peer_ptr,
const actor_proxy_ptr& peer_actor_ptr,
process_information_ptr const& peer_ptr,
actor_proxy_ptr const& peer_actor_ptr,
std::unique_ptr<attachable>&& peer_observer);
void post_office_publish(native_socket_type server_socket,
const actor_ptr& published_actor);
actor_ptr const& published_actor);
void post_office_unpublish(actor_id whom);
......
......@@ -33,8 +33,8 @@ class post_office_msg
std::unique_ptr<attachable> attachable_ptr;
add_peer(native_socket_type peer_socket,
const process_information_ptr& peer_ptr,
const actor_proxy_ptr& peer_actor_ptr,
process_information_ptr const& peer_ptr,
actor_proxy_ptr const& peer_actor_ptr,
std::unique_ptr<attachable>&& peer_observer);
};
......@@ -45,24 +45,24 @@ class post_office_msg
native_socket_type server_sockfd;
actor_ptr published_actor;
add_server_socket(native_socket_type ssockfd, const actor_ptr& whom);
add_server_socket(native_socket_type ssockfd, actor_ptr const& whom);
};
struct proxy_exited
{
actor_proxy_ptr proxy_ptr;
inline proxy_exited(const actor_proxy_ptr& who) : proxy_ptr(who) { }
inline proxy_exited(actor_proxy_ptr const& who) : proxy_ptr(who) { }
};
post_office_msg(native_socket_type arg0,
const process_information_ptr& arg1,
const actor_proxy_ptr& arg2,
process_information_ptr const& arg1,
actor_proxy_ptr const& arg2,
std::unique_ptr<attachable>&& arg3);
post_office_msg(native_socket_type arg0, const actor_ptr& arg1);
post_office_msg(native_socket_type arg0, actor_ptr const& arg1);
post_office_msg(const actor_proxy_ptr& proxy_ptr);
post_office_msg(actor_proxy_ptr const& proxy_ptr);
inline bool is_add_peer_msg() const
{
......
......@@ -21,9 +21,9 @@ class primitive_member : public util::abstract_uniform_type_info<T>
public:
void serialize(const void* obj, serializer* s) const
void serialize(void const* obj, serializer* s) const
{
s->write_value(*reinterpret_cast<const T*>(obj));
s->write_value(*reinterpret_cast<T const*>(obj));
}
void deserialize(void* obj, deserializer* d) const
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef RECEIVE_LOOP_HELPER_HPP
#define RECEIVE_LOOP_HELPER_HPP
......
......@@ -9,9 +9,9 @@ class ref_counted_impl
T m_rc;
ref_counted_impl(const ref_counted_impl&) = delete;
ref_counted_impl(ref_counted_impl const&) = delete;
ref_counted_impl& operator=(const ref_counted_impl&) = delete;
ref_counted_impl& operator=(ref_counted_impl const&) = delete;
public:
......
......@@ -14,7 +14,7 @@ template<typename List, size_t Pos = 0>
struct serialize_tuple
{
template<typename T>
inline static void _(serializer& s, const T* tup)
inline static void _(serializer& s, T const* tup)
{
s << uniform_typeid<typename List::head_type>()->name()
<< *reinterpret_cast<const typename List::head_type*>(tup->at(Pos));
......@@ -26,7 +26,7 @@ template<size_t Pos>
struct serialize_tuple<util::type_list<>, Pos>
{
template<typename T>
inline static void _(serializer&, const T*) { }
inline static void _(serializer&, T const*) { }
};
} } // namespace cppa::detail
......
......@@ -29,17 +29,17 @@ struct tdata<>
throw std::out_of_range("");
}
const tdata<>& tail() const
tdata<> const& tail() const
{
throw std::out_of_range("");
}
inline const void* at(size_t) const
inline void const* at(size_t) const
{
throw std::out_of_range("");
}
inline bool operator==(const tdata&) const
inline bool operator==(tdata const&) const
{
return true;
}
......@@ -56,15 +56,15 @@ struct tdata<Head, Tail...> : tdata<Tail...>
inline tdata() : super(), head() { }
//tdata(const Head& v0, const Tail&... vals) : super(vals...), head(v0) { }
//tdata(Head const& v0, Tail const&... vals) : super(vals...), head(v0) { }
// allow partial initialization
template<typename... Args>
tdata(const Head& v0, const Args&... vals) : super(vals...), head(v0) { }
tdata(Head const& v0, Args const&... vals) : super(vals...), head(v0) { }
// allow initialization with wrapped<Head> (uses the default constructor)
template<typename... Args>
tdata(const util::wrapped<Head>&, const Args&... vals)
tdata(util::wrapped<Head> const&, Args const&... vals)
: super(vals...), head()
{
}
......@@ -75,18 +75,18 @@ struct tdata<Head, Tail...> : tdata<Tail...>
return *this;
}
inline const tdata<Tail...>& tail() const
inline tdata<Tail...> const& tail() const
{
// upcast
return *this;
}
inline bool operator==(const tdata& other) const
inline bool operator==(tdata const& other) const
{
return head == other.head && tail() == other.tail();
}
inline const void* at(size_t pos) const
inline void const* at(size_t pos) const
{
return (pos == 0) ? &head : super::at(pos - 1);
}
......@@ -122,13 +122,13 @@ struct tdata_from_type_list<cppa::util::type_list<T...>>
namespace cppa {
template<typename... Tn>
inline detail::tdata<Tn...> make_tdata(const Tn&... args)
inline detail::tdata<Tn...> make_tdata(Tn const&... args)
{
return detail::tdata<Tn...>(args...);
}
template<size_t N, typename... Tn>
const typename util::at<N, Tn...>::type& get(const detail::tdata<Tn...>& tv)
const typename util::at<N, Tn...>::type& get(detail::tdata<Tn...> const& tv)
{
static_assert(N < sizeof...(Tn), "N >= tv.size()");
return static_cast<const typename detail::tdata_upcast_helper<N, Tn...>::type&>(tv).head;
......
......@@ -18,7 +18,7 @@ namespace this_thread { using namespace boost::this_thread; }
template<class Lock, class Condition>
inline bool wait_until(Lock& lock, Condition& cond,
const boost::system_time& timeout)
boost::system_time const& timeout)
{
return cond.timed_wait(lock, timeout);
}
......@@ -31,7 +31,7 @@ inline boost::system_time now()
} } // namespace cppa::detail
inline boost::system_time& operator+=(boost::system_time& lhs,
const cppa::util::duration& rhs)
cppa::util::duration const& rhs)
{
switch (rhs.unit)
{
......@@ -70,7 +70,7 @@ namespace this_thread { using namespace std::this_thread; }
// returns false if a timeout occured
template<class Lock, class Condition, typename TimePoint>
inline bool wait_until(Lock& lock, Condition& cond, const TimePoint& timeout)
inline bool wait_until(Lock& lock, Condition& cond, TimePoint const& timeout)
{
return cond.wait_until(lock, timeout) != std::cv_status::timeout;
}
......
......@@ -6,8 +6,8 @@
namespace cppa { namespace detail {
std::string to_uniform_name(const std::string& demangled_name);
std::string to_uniform_name(const std::type_info& tinfo);
std::string to_uniform_name(std::string const& demangled_name);
std::string to_uniform_name(std::type_info const& tinfo);
} } // namespace cppa::detail
......
......@@ -32,20 +32,20 @@ class tuple_vals : public abstract_tuple
}
template<typename... Types>
const void* tdata_at(const tdata<Types...>& d, size_t pos) const
void const* tdata_at(tdata<Types...> const& d, size_t pos) const
{
return (pos == 0) ? &(d.head) : tdata_at(d.tail(), pos - 1);
}
public:
tuple_vals(const tuple_vals& other) : super(), m_data(other.m_data) { }
tuple_vals(tuple_vals const& other) : super(), m_data(other.m_data) { }
tuple_vals() : m_data() { }
tuple_vals(const ElementTypes&... args) : m_data(args...) { }
tuple_vals(ElementTypes const&... args) : m_data(args...) { }
inline const data_type& data() const { return m_data; }
inline data_type const& data() const { return m_data; }
inline data_type& data_ref() { return m_data; }
......@@ -64,20 +64,20 @@ class tuple_vals : public abstract_tuple
return new tuple_vals(*this);
}
const void* at(size_t pos) const
void const* at(size_t pos) const
{
return tdata_at(m_data, pos);
}
const uniform_type_info& utype_info_at(size_t pos) const
uniform_type_info const& utype_info_at(size_t pos) const
{
return m_types.at(pos);
}
bool equals(const abstract_tuple& other) const
bool equals(abstract_tuple const& other) const
{
if (size() != other.size()) return false;
const tuple_vals* o = dynamic_cast<const tuple_vals*>(&other);
tuple_vals const* o = dynamic_cast<tuple_vals const*>(&other);
if (o)
{
return m_data == (o->m_data);
......
......@@ -29,19 +29,19 @@ class uniform_type_info_map
~uniform_type_info_map();
inline const int_map& int_names() const
inline int_map const& int_names() const
{
return m_ints;
}
uniform_type_info* by_raw_name(const std::string& name) const;
uniform_type_info* by_raw_name(std::string const& name) const;
uniform_type_info* by_uniform_name(const std::string& name) const;
uniform_type_info* by_uniform_name(std::string const& name) const;
std::vector<uniform_type_info*> get_all() const;
// NOT thread safe!
bool insert(const std::set<std::string>& raw_names, uniform_type_info* uti);
bool insert(std::set<std::string> const& raw_names, uniform_type_info* uti);
private:
......
......@@ -22,7 +22,7 @@ class exception : public std::exception
* @brief Returns the error message.
* @returns The error message as C-string.
*/
const char* what() const throw();
char const* what() const throw();
protected:
......@@ -36,7 +36,7 @@ class exception : public std::exception
* @brief Creates an exception with the error string @p what_str.
* @param what_str Error message as string.
*/
exception(const std::string& what_str);
exception(std::string const& what_str);
private:
......@@ -77,7 +77,7 @@ class network_error : public exception
public:
network_error(std::string&& what_str);
network_error(const std::string& what_str);
network_error(std::string const& what_str);
};
......
......@@ -10,13 +10,13 @@
namespace cppa {
object from_string(const std::string& what);
object from_string(std::string const& what);
template<typename T>
T from_string(const std::string &what)
{
object o = from_string(what);
const std::type_info& tinfo = typeid(T);
std::type_info const& tinfo = typeid(T);
if (o.type() == tinfo)
{
return std::move(get<T>(o));
......
......@@ -17,17 +17,17 @@ template<typename...> class tuple;
// forward declaration of tuple_view
template<typename...> class tuple_view;
// forward declaration of get(const detail::tdata<...>&)
// forward declaration of get(detail::tdata<...> const&)
template<size_t N, typename... Tn>
const typename util::at<N, Tn...>::type& get(const detail::tdata<Tn...>&);
const typename util::at<N, Tn...>::type& get(detail::tdata<Tn...> const&);
// forward declarations of get(const tuple<...>&)
// forward declarations of get(tuple<...> const&)
template<size_t N, typename... Tn>
const typename util::at<N, Tn...>::type& get(const tuple<Tn...>&);
const typename util::at<N, Tn...>::type& get(tuple<Tn...> const&);
// forward declarations of get(const tuple_view<...>&)
// forward declarations of get(tuple_view<...> const&)
template<size_t N, typename... Tn>
const typename util::at<N, Tn...>::type& get(const tuple_view<Tn...>&);
const typename util::at<N, Tn...>::type& get(tuple_view<Tn...> const&);
// forward declarations of get_ref(detail::tdata<...>&)
template<size_t N, typename... Tn>
......
......@@ -15,7 +15,7 @@ namespace cppa {
template<typename... MatchRules>
typename tuple_view_type_from_type_list<typename util::filter_type_list<anything, util::type_list<MatchRules...>>::type>::type
get_view(const any_tuple& ut)
get_view(any_tuple const& ut)
{
pattern<MatchRules...> p;
typename pattern<MatchRules...>::mapping_vector mapping;
......
......@@ -27,9 +27,9 @@ class group : public channel
group(std::string&& id, std::string&& mod_name);
group(const std::string& id, const std::string& mod_name);
group(std::string const& id, std::string const& mod_name);
virtual void unsubscribe(const channel_ptr& who) = 0;
virtual void unsubscribe(channel_ptr const& who) = 0;
public:
......@@ -49,14 +49,14 @@ class group : public channel
public:
unsubscriber(const channel_ptr& s, const intrusive_ptr<group>& g);
unsubscriber(channel_ptr const& s, intrusive_ptr<group> const& g);
~unsubscriber();
void actor_exited(std::uint32_t);
// matches on m_group
bool matches(const attachable::token& what);
bool matches(attachable::token const& what);
};
......@@ -73,7 +73,7 @@ class group : public channel
protected:
module(std::string&& module_name);
module(const std::string& module_name);
module(std::string const& module_name);
public:
......@@ -82,14 +82,14 @@ class group : public channel
* @returns The name of this module implementation.
* @threadsafe
*/
const std::string& name();
std::string const& name();
/**
* @brief Get a pointer to the group associated with
* the name @p group_name.
* @threadsafe
*/
virtual intrusive_ptr<group> get(const std::string& group_name) = 0;
virtual intrusive_ptr<group> get(std::string const& group_name) = 0;
};
......@@ -98,28 +98,28 @@ class group : public channel
* @returns The group identifier as string (e.g. "224.0.0.1" for IPv4
* multicast or a user-defined string for local groups).
*/
const std::string& identifier() const;
std::string const& identifier() const;
/**
* @brief The name of the module.
* @returns The module name of this group (e.g. "local").
*/
const std::string& module_name() const;
std::string const& module_name() const;
/**
* @brief Subscribe @p who to this group.
* @returns A {@link subscription} object that unsubscribes @p who
* if the lifetime of @p who ends.
*/
virtual subscription subscribe(const channel_ptr& who) = 0;
virtual subscription subscribe(channel_ptr const& who) = 0;
/**
* @brief Get a pointer to the group associated with
* @p group_identifier from the module @p module_name.
* @threadsafe
*/
static intrusive_ptr<group> get(const std::string& module_name,
const std::string& group_identifier);
static intrusive_ptr<group> get(std::string const& module_name,
std::string const& group_identifier);
/**
* @brief Add a new group module to the libcppa group management.
......
......@@ -16,7 +16,7 @@ struct convertible
{
To convert() const
{
return static_cast<const From*>(this)->do_convert();
return static_cast<From const*>(this)->do_convert();
}
};
......@@ -25,7 +25,7 @@ struct convertible
* @relates ref_counted
*/
template<typename T>
class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
class intrusive_ptr : util::comparable<intrusive_ptr<T>, T const*>,
util::comparable<intrusive_ptr<T>>
{
......@@ -43,7 +43,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
intrusive_ptr(T* raw_ptr) { set_ptr(raw_ptr); }
intrusive_ptr(const intrusive_ptr& other)
intrusive_ptr(intrusive_ptr const& other)
{
set_ptr(other.m_ptr);
}
......@@ -59,7 +59,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
}
template<typename Y>
intrusive_ptr(const intrusive_ptr<Y>& other)
intrusive_ptr(intrusive_ptr<Y> const& other)
{
static_assert(std::is_convertible<Y*, T*>::value,
"Y* is not assignable to T*");
......@@ -83,7 +83,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
inline T* get() { return m_ptr; }
inline const T* get() const { return m_ptr; }
inline T const* get() const { return m_ptr; }
T* take()
{
......@@ -109,7 +109,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
return *this;
}
intrusive_ptr& operator=(const intrusive_ptr& other)
intrusive_ptr& operator=(intrusive_ptr const& other)
{
intrusive_ptr tmp(other);
swap(tmp);
......@@ -124,7 +124,7 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
}
template<typename Y>
intrusive_ptr& operator=(const intrusive_ptr<Y>& other)
intrusive_ptr& operator=(intrusive_ptr<Y> const& other)
{
static_assert(std::is_convertible<Y*, T*>::value,
"Y* is not assignable to T*");
......@@ -154,18 +154,18 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
inline T& operator*() { return *m_ptr; }
inline const T* operator->() const { return m_ptr; }
inline T const* operator->() const { return m_ptr; }
inline const T& operator*() const { return *m_ptr; }
inline T const& operator*() const { return *m_ptr; }
inline explicit operator bool() const { return m_ptr != nullptr; }
inline ptrdiff_t compare(const T* ptr) const
inline ptrdiff_t compare(T const* ptr) const
{
return static_cast<ptrdiff_t>(get() - ptr);
}
inline ptrdiff_t compare(const intrusive_ptr& other) const
inline ptrdiff_t compare(intrusive_ptr const& other) const
{
return compare(other.get());
}
......@@ -173,13 +173,13 @@ class intrusive_ptr : util::comparable<intrusive_ptr<T>, const T*>,
};
template<typename X, typename Y>
bool operator==(const intrusive_ptr<X>& lhs, const intrusive_ptr<Y>& rhs)
bool operator==(intrusive_ptr<X> const& lhs, intrusive_ptr<Y> const& rhs)
{
return lhs.get() == rhs.get();
}
template<typename X, typename Y>
inline bool operator!=(const intrusive_ptr<X>& lhs, const intrusive_ptr<Y>& rhs)
inline bool operator!=(intrusive_ptr<X> const& lhs, intrusive_ptr<Y> const& rhs)
{
return !(lhs == rhs);
}
......
......@@ -25,7 +25,7 @@ struct invoke_helper
typedef typename rlist::head_type back_type;
typedef typename util::element_at<N, Tuple>::type tuple_val_type;
typedef typename util::pop_back<ArgTypeList>::type next_list;
inline static ResultType _(F& f, const Tuple& t, const Args&... args)
inline static ResultType _(F& f, Tuple const& t, Args const&... args)
{
static_assert(std::is_convertible<tuple_val_type, back_type>::value,
"tuple element is not convertible to expected argument");
......@@ -37,7 +37,7 @@ struct invoke_helper
template<size_t N, typename F, typename ResultType, class Tuple, typename... Args>
struct invoke_helper<N, F, ResultType, Tuple, util::type_list<>, Args...>
{
inline static ResultType _(F& f, const Tuple&, const Args&... args)
inline static ResultType _(F& f, Tuple const&, Args const&... args)
{
return f(args...);
}
......@@ -59,7 +59,7 @@ struct invoke_impl<true, F, Tuple<TTypes...> >
typedef Tuple<TTypes...> tuple_type;
inline static result_type _(F& f, const tuple_type& t)
inline static result_type _(F& f, tuple_type const& t)
{
return invoke_helper<sizeof...(TTypes) - 1, F, result_type, tuple_type, arg_types>::_(f, t);
}
......@@ -79,7 +79,7 @@ struct invoke_impl<false, F, Tuple<TTypes...> >
typedef Tuple<TTypes...> tuple_type;
inline static result_type _(F& f, const tuple_type& t)
inline static result_type _(F& f, tuple_type const& t)
{
return invoke_helper<sizeof...(TTypes) - 1, F, result_type, tuple_type, arg_types>::_(f, t);
}
......@@ -92,7 +92,7 @@ namespace cppa {
template<typename F, class Tuple>
typename detail::invoke_impl<std::is_function<typename std::remove_pointer<F>::type>::value, F, Tuple>::result_type
invoke(F what, const Tuple& args)
invoke(F what, Tuple const& args)
{
typedef typename std::remove_pointer<F>::type f_type;
static constexpr bool is_fun = std::is_function<f_type>::value;
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#ifndef INVOKE_RULES_HPP
#define INVOKE_RULES_HPP
......@@ -89,7 +61,7 @@ class invoke_rules_base
* @returns @p true if a pattern matched @p data;
* otherwise @p false.
*/
bool operator()(const any_tuple& data) const;
bool operator()(any_tuple const& data) const;
/**
* @brief Tries to match @p data with one of the stored patterns.
......@@ -97,7 +69,7 @@ class invoke_rules_base
* @returns An {@link intermediate} instance that could invoke
* the corresponding callback; otherwise @p nullptr.
*/
detail::intermediate* get_intermediate(const any_tuple& data) const;
detail::intermediate* get_intermediate(any_tuple const& data) const;
};
......@@ -111,8 +83,8 @@ class timed_invoke_rules : public invoke_rules_base
friend class invoke_rules;
timed_invoke_rules(const timed_invoke_rules&) = delete;
timed_invoke_rules& operator=(const timed_invoke_rules&) = delete;
timed_invoke_rules(timed_invoke_rules const&) = delete;
timed_invoke_rules& operator=(timed_invoke_rules const&) = delete;
timed_invoke_rules(invokable_list&& prepended_list,
timed_invoke_rules&& other);
......@@ -127,7 +99,7 @@ public:
timed_invoke_rules& operator=(timed_invoke_rules&&);
const util::duration& timeout() const;
util::duration const& timeout() const;
void handle_timeout() const;
......@@ -147,8 +119,8 @@ class invoke_rules : public invoke_rules_base
friend class timed_invoke_rules;
invoke_rules(const invoke_rules&) = delete;
invoke_rules& operator=(const invoke_rules&) = delete;
invoke_rules(invoke_rules const&) = delete;
invoke_rules& operator=(invoke_rules const&) = delete;
public:
......
......@@ -15,11 +15,11 @@ namespace cppa {
// forward declarations
class object;
bool operator==(const object& lhs, const object& rhs);
bool operator==(object const& lhs, object const& rhs);
class uniform_type_info;
const uniform_type_info* uniform_typeid(const std::type_info&);
bool operator==(const uniform_type_info& lhs, const std::type_info& rhs);
uniform_type_info const* uniform_typeid(std::type_info const&);
bool operator==(uniform_type_info const& lhs, std::type_info const& rhs);
/**
* @brief Grants mutable access to the stored value of @p obj.
......@@ -39,7 +39,7 @@ T& get_ref(object& obj);
* @throws std::invalid_argument if <tt>obj.type() != typeid(T)</tt>
*/
template<typename T>
const T& get(const object& obj);
T const& get(object const& obj);
/**
* @brief An abstraction class that stores an instance of
......@@ -48,7 +48,7 @@ const T& get(const object& obj);
class object
{
friend bool operator==(const object& lhs, const object& rhs);
friend bool operator==(object const& lhs, object const& rhs);
public:
......@@ -59,7 +59,7 @@ class object
* @warning {@link object} takes ownership of @p val.
* @pre {@code val != nullptr && utinfo != nullptr}
*/
object(void* val, const uniform_type_info* utinfo);
object(void* val, uniform_type_info const* utinfo);
/**
* @brief Creates an empty object.
......@@ -77,7 +77,7 @@ class object
* @brief Creates a (deep) copy of @p other.
* @post {*this == other}
*/
object(const object& other);
object(object const& other);
/**
* @brief Moves the content from @p other to this.
......@@ -89,21 +89,21 @@ class object
* @brief Creates a (deep) copy of @p other and assigns it to @p this.
* @return @p *this
*/
object& operator=(const object& other);
object& operator=(object const& other);
/**
* @brief Gets the RTTI of this object.
* @returns A {@link uniform_type_info} describing the current
* type of @p this.
*/
const uniform_type_info& type() const;
uniform_type_info const& type() const;
/**
* @brief Gets the stored value.
* @returns A const pointer to the currently stored value.
* @see get(const object&)
* @see get(object const&)
*/
const void* value() const;
void const* value() const;
/**
* @brief Gets the stored value.
......@@ -125,7 +125,7 @@ class object
private:
void* m_value;
const uniform_type_info* m_type;
uniform_type_info const* m_type;
void swap(object& other);
......@@ -140,7 +140,7 @@ object object::from(T&& what)
return { new value_type(std::forward<T>(what)), rtti };
}
inline bool operator!=(const object& lhs, const object& rhs)
inline bool operator!=(object const& lhs, object const& rhs)
{
return !(lhs == rhs);
}
......@@ -159,7 +159,7 @@ T& get_ref(object& obj)
}
template<typename T>
const T& get(const object& obj)
T const& get(object const& obj)
{
static_assert(util::disjunction<std::is_pointer<T>,
std::is_reference<T>>::value == false,
......@@ -168,7 +168,7 @@ const T& get(const object& obj)
{
throw std::invalid_argument("obj.type() != typeid(T)");
}
return *reinterpret_cast<const T*>(obj.value());
return *reinterpret_cast<T const*>(obj.value());
}
} // namespace cppa
......
......@@ -33,7 +33,7 @@ class timed_invoke_rule_builder
public:
constexpr timed_invoke_rule_builder(const util::duration& d) : m_timeout(d)
constexpr timed_invoke_rule_builder(util::duration const& d) : m_timeout(d)
{
}
......@@ -67,7 +67,7 @@ class invoke_rule_builder
public:
template<typename... Args>
invoke_rule_builder(const Args&... args)
invoke_rule_builder(Args const&... args)
{
m_pattern.reset(new pattern_type(args...));
}
......@@ -86,16 +86,19 @@ class on_the_fly_invoke_rule_builder
public:
constexpr on_the_fly_invoke_rule_builder()
{
}
template<typename F>
invoke_rules operator>>(F&& f)
invoke_rules operator>>(F&& f) const
{
typedef typename util::get_callable_trait<F>::type ctrait;
using namespace ::cppa::util;
typedef typename get_callable_trait<F>::type ctrait;
typedef typename ctrait::arg_types raw_types;
static_assert(raw_types::size > 0, "functor has no arguments");
typedef typename util::type_list_apply<raw_types, util::rm_ref>::type
types;
typedef typename pattern_type_from_type_list<types>::type
pattern_type;
typedef typename type_list_apply<raw_types,rm_ref>::type types;
typedef typename pattern_type_from_type_list<types>::type pattern_type;
typedef typename pattern_type::tuple_view_type tuple_view_type;
typedef invokable_impl<tuple_view_type, pattern_type, F> impl;
std::unique_ptr<pattern_type> pptr(new pattern_type);
......@@ -114,18 +117,14 @@ constexpr typename detail::boxed<T>::type val()
return typename detail::boxed<T>::type();
}
//constexpr detail::boxed<anything> any_vals = detail::boxed<anything>();
constexpr anything any_vals = anything();
constexpr detail::on_the_fly_invoke_rule_builder on_arg_match()
{
return { };
}
constexpr detail::on_the_fly_invoke_rule_builder on_arg_match;
template<typename Arg0, typename... Args>
detail::invoke_rule_builder<typename detail::unboxed<Arg0>::type,
typename detail::unboxed<Args>::type...>
on(const Arg0& arg0, const Args&... args)
on(Arg0 const& arg0, Args const&... args)
{
return { arg0, args... };
}
......
......@@ -24,8 +24,8 @@ template<typename T0, typename... Tn>
class pattern<T0, Tn...>
{
pattern(const pattern&) = delete;
pattern& operator=(const pattern&) = delete;
pattern(pattern const&) = delete;
pattern& operator=(pattern const&) = delete;
public:
......@@ -41,12 +41,9 @@ class pattern<T0, Tn...>
typedef typename tuple_view_type::mapping_vector mapping_vector;
//typedef typename detail::tdata_from_type_list<filtered_tpl_args>::type
// data_type;
pattern()
{
const cppa::uniform_type_info** iter = m_utis;
cppa::uniform_type_info const* * iter = m_utis;
detail::fill_uti_vec<decltype(iter), T0, Tn...>(iter);
for (size_t i = 0; i < size; ++i)
{
......@@ -55,7 +52,7 @@ class pattern<T0, Tn...>
}
template<typename Arg0, typename... Args>
pattern(const Arg0& arg0, const Args&... args) : m_data(arg0, args...)
pattern(Arg0 const& arg0, Args const&... args) : m_data(arg0, args...)
{
bool invalid_args[] = { detail::is_boxed<Arg0>::value,
detail::is_boxed<Args>::value... };
......@@ -66,8 +63,7 @@ class pattern<T0, Tn...>
m_utis, m_data_ptr);
}
// todo: calculate expected vector type
bool operator()(const cppa::any_tuple& msg,
bool operator()(cppa::any_tuple const& msg,
mapping_vector* mapping = nullptr) const
{
detail::pattern_arg arg0(size, m_data_ptr, m_utis);
......@@ -77,10 +73,9 @@ class pattern<T0, Tn...>
private:
//typename detail::tdata_from_type_list<filtered_tpl_args>::type m_data;
detail::tdata<T0, Tn...> m_data;
const cppa::uniform_type_info* m_utis[size];
const void* m_data_ptr[size];
cppa::uniform_type_info const* m_utis[size];
void const* m_data_ptr[size];
};
......
......@@ -30,7 +30,7 @@ enum primitive_type
pt_null /**< equivalent of @p void */
};
constexpr const char* primitive_type_names[] =
constexpr char const* primitive_type_names[] =
{
"pt_int8", "pt_int16", "pt_int32", "pt_int64",
"pt_uint8", "pt_uint16", "pt_uint32", "pt_uint64",
......@@ -45,7 +45,7 @@ constexpr const char* primitive_type_names[] =
* @param ptype Requestet @p primitive_type.
* @returns A C-string representation of @p ptype.
*/
constexpr const char* primitive_type_name(primitive_type ptype)
constexpr char const* primitive_type_name(primitive_type ptype)
{
return primitive_type_names[static_cast<int>(ptype)];
}
......
......@@ -34,7 +34,7 @@ namespace cppa {
class primitive_variant;
template<typename T>
const T& get(const primitive_variant& pv);
T const& get(primitive_variant const& pv);
template<typename T>
T& get_ref(primitive_variant& pv);
......@@ -46,11 +46,11 @@ T& get_ref(primitive_variant& pv);
class primitive_variant
{
friend bool operator==(const primitive_variant& lhs,
const primitive_variant& rhs);
friend bool operator==(primitive_variant const& lhs,
primitive_variant const& rhs);
template<typename T>
friend const T& get(const primitive_variant& pv);
friend T const& get(primitive_variant const& pv);
template<typename T>
friend T& get_ref(primitive_variant& pv);
......@@ -185,7 +185,7 @@ class primitive_variant
* @brief Creates a copy from @p other.
* @param other A primitive variant.
*/
primitive_variant(const primitive_variant& other);
primitive_variant(primitive_variant const& other);
/**
* @brief Creates a new variant and move the value from @p other to it.
......@@ -223,7 +223,7 @@ class primitive_variant
* @param other A primitive variant.
* @returns <tt>*this</tt>.
*/
primitive_variant& operator=(const primitive_variant& other);
primitive_variant& operator=(primitive_variant const& other);
/**
* @brief Moves the content of @p other to @p this.
......@@ -244,7 +244,7 @@ class primitive_variant
* otherwise typeid(T) is returned, where T is the C++ type
* of @p this.
*/
const std::type_info& type() const;
std::type_info const& type() const;
~primitive_variant();
......@@ -259,7 +259,7 @@ class primitive_variant
* @throws <tt>std::logic_error</tt> if @p pv is not of type @p T.
*/
template<typename T>
const T& get(const primitive_variant& pv)
T const& get(primitive_variant const& pv)
{
static const primitive_type ptype = detail::type_to_ptype<T>::ptype;
return pv.get_as<ptype>();
......@@ -291,7 +291,7 @@ T& get_ref(primitive_variant& pv)
* @returns A const reference to the value of @p pv of type @p T.
*/
template<primitive_type PT>
const T& get_ref(const primitive_variant& pv);
T const& get_ref(primitive_variant const& pv);
/**
* @ingroup TypeSystem
......@@ -308,7 +308,7 @@ T& get_ref(primitive_variant& pv);
template<primitive_type PT>
inline const typename detail::ptype_to_type<PT>::type&
get(const primitive_variant& pv)
get(primitive_variant const& pv)
{
static_assert(PT != pt_null, "PT == pt_null");
return get<typename detail::ptype_to_type<PT>::type>(pv);
......@@ -324,17 +324,17 @@ get_ref(primitive_variant& pv)
#endif
bool operator==(const primitive_variant& lhs, const primitive_variant& rhs);
bool operator==(primitive_variant const& lhs, primitive_variant const& rhs);
inline
bool operator!=(const primitive_variant& lhs, const primitive_variant& rhs)
bool operator!=(primitive_variant const& lhs, primitive_variant const& rhs)
{
return !(lhs == rhs);
}
template<typename T>
typename util::enable_if<util::is_primitive<T>, bool>::type
operator==(const T& lhs, const primitive_variant& rhs)
operator==(T const& lhs, primitive_variant const& rhs)
{
static constexpr primitive_type ptype = detail::type_to_ptype<T>::ptype;
static_assert(ptype != pt_null, "T is an incompatible type");
......@@ -343,21 +343,21 @@ operator==(const T& lhs, const primitive_variant& rhs)
template<typename T>
typename util::enable_if<util::is_primitive<T>, bool>::type
operator==(const primitive_variant& lhs, const T& rhs)
operator==(primitive_variant const& lhs, T const& rhs)
{
return (rhs == lhs);
}
template<typename T>
typename util::enable_if<util::is_primitive<T>, bool>::type
operator!=(const primitive_variant& lhs, const T& rhs)
operator!=(primitive_variant const& lhs, T const& rhs)
{
return !(lhs == rhs);
}
template<typename T>
typename util::enable_if<util::is_primitive<T>, bool>::type
operator!=(const T& lhs, const primitive_variant& rhs)
operator!=(T const& lhs, primitive_variant const& rhs)
{
return !(lhs == rhs);
}
......
......@@ -28,11 +28,11 @@ class process_information : public ref_counted,
//process_information();
process_information(std::uint32_t process_id, const node_id_type& node_id);
process_information(std::uint32_t process_id, node_id_type const& node_id);
process_information(std::uint32_t process_id, const std::string& hash);
process_information(std::uint32_t process_id, std::string const& hash);
process_information(const process_information& other);
process_information(process_information const& other);
/**
* @brief Identifies the running process.
......@@ -45,16 +45,16 @@ class process_information : public ref_counted,
* A hash build from the MAC address of the first network device
* and the serial number from the root HD (mounted in "/" or "C:").
*/
inline const node_id_type& node_id() const { return m_node_id; }
inline node_id_type const& node_id() const { return m_node_id; }
/**
* @brief Returns the proccess_information for the running process.
* @returns
*/
static const intrusive_ptr<process_information>& get();
static intrusive_ptr<process_information> const& get();
// "inherited" from comparable<process_information>
int compare(const process_information& other) const;
int compare(process_information const& other) const;
private:
......@@ -63,24 +63,24 @@ class process_information : public ref_counted,
};
void node_id_from_string(const std::string& hash,
void node_id_from_string(std::string const& hash,
process_information::node_id_type& node_id);
bool equal(const std::string& hash,
const process_information::node_id_type& node_id);
bool equal(std::string const& hash,
process_information::node_id_type const& node_id);
inline bool equal(const process_information::node_id_type& node_id,
const std::string& hash)
inline bool equal(process_information::node_id_type const& node_id,
std::string const& hash)
{
return equal(hash, node_id);
}
std::string to_string(const process_information& what);
std::string to_string(process_information const& what);
/**
* @brief Converts {@link node_id} to an hexadecimal string.
*/
std::string to_string(const process_information::node_id_type& node_id);
std::string to_string(process_information::node_id_type const& node_id);
/**
* @brief A smart pointer type that manages instances of
......
......@@ -78,8 +78,8 @@ class scheduler
virtual attachable* register_hidden_context();
template<typename Duration, typename... Data>
void future_send(const actor_ptr& to,
const Duration& rel_time, const Data&... data)
void future_send(actor_ptr const& to,
Duration const& rel_time, Data const&... data)
{
static_assert(sizeof...(Data) > 0, "no message to send");
any_tuple tup = make_tuple(util::duration(rel_time), to, data...);
......
......@@ -27,8 +27,8 @@ class self_type : public convertible<self_type, actor*>
static local_actor* get_impl();
self_type(const self_type&) = delete;
self_type& operator=(const self_type&) = delete;
self_type(self_type const&) = delete;
self_type& operator=(self_type const&) = delete;
public:
......
......@@ -19,8 +19,8 @@ class primitive_variant;
class serializer
{
serializer(const serializer&) = delete;
serializer& operator=(const serializer&) = delete;
serializer(serializer const&) = delete;
serializer& operator=(serializer const&) = delete;
public:
......@@ -33,7 +33,7 @@ class serializer
* named @p type_name.
* @param type_name The platform-independent @p libcppa type name.
*/
virtual void begin_object(const std::string& type_name) = 0;
virtual void begin_object(std::string const& type_name) = 0;
/**
* @brief Ends serialization of an object.
......@@ -54,19 +54,19 @@ class serializer
* @brief Writes a single value to the data sink.
* @param value A primitive data value.
*/
virtual void write_value(const primitive_variant& value) = 0;
virtual void write_value(primitive_variant const& value) = 0;
/**
* @brief Writes @p num values as a tuple to the data sink.
* @param num Size of the array @p values.
* @param values An array of size @p num of primitive data values.
*/
virtual void write_tuple(size_t num, const primitive_variant* values) = 0;
virtual void write_tuple(size_t num, primitive_variant const* values) = 0;
};
template<typename T>
serializer& operator<<(serializer& s, const T& what)
serializer& operator<<(serializer& s, T const& what)
{
auto mtype = uniform_typeid<T>();
if (mtype == nullptr)
......
......@@ -7,7 +7,7 @@ namespace cppa {
namespace detail {
std::string to_string_impl(const void* what, const uniform_type_info* utype);
std::string to_string_impl(void const* what, uniform_type_info const* utype);
} // namespace detail
......@@ -17,7 +17,7 @@ std::string to_string_impl(const void* what, const uniform_type_info* utype);
* @returns A string representation of @p what.
*/
template<typename T>
std::string to_string(const T& what)
std::string to_string(T const& what)
{
auto utype = uniform_typeid<T>();
if (utype == nullptr)
......
......@@ -69,7 +69,7 @@ class tuple
* @brief Initializes the tuple with @p args.
* @param args Initialization values.
*/
tuple(const ElementTypes&... args) : m_vals(new vals_t(args...))
tuple(ElementTypes const&... args) : m_vals(new vals_t(args...))
{
}
......@@ -87,7 +87,7 @@ class tuple
* @brief Gets a pointer to the internal data.
* @returns A const void pointer to the <tt>N</tt>th element.
*/
inline const void* at(size_t p) const
inline void const* at(size_t p) const
{
return m_vals->at(p);
}
......@@ -97,7 +97,7 @@ class tuple
* of an element.
* @returns The uniform type of the <tt>N</tt>th element.
*/
inline const uniform_type_info* utype_at(size_t p) const
inline uniform_type_info const* utype_at(size_t p) const
{
return m_vals->utype_info_at(p);
}
......@@ -109,7 +109,7 @@ class tuple
*/
cow_ptr<InternalData> vals() const;
# else
inline const cow_ptr<vals_t>& vals() const
inline cow_ptr<vals_t> const& vals() const
{
return m_vals;
}
......@@ -137,7 +137,7 @@ struct tuple_type_from_type_list<util::type_list<Types...>>
* @relates tuple
*/
template<size_t N, typename T>
const T& get(const tuple<...>& tup);
T const& get(tuple<...> const& tup);
/**
* @ingroup CopyOnWrite
......@@ -159,12 +159,12 @@ T& get_ref(tuple<...>& tup);
* @relates tuple
*/
template<typename... Types>
tuple<Types...> make_tuple(const Types&... args);
tuple<Types...> make_tuple(Types const&... args);
#else
template<size_t N, typename... Types>
const typename util::at<N, Types...>::type& get(const tuple<Types...>& tup)
const typename util::at<N, Types...>::type& get(tuple<Types...> const& tup)
{
return get<N>(tup.vals()->data());
}
......@@ -179,7 +179,7 @@ template<typename... Types>
typename tuple_type_from_type_list<
typename util::type_list_apply<util::type_list<Types...>,
detail::implicit_conversions>::type>::type
make_tuple(const Types&... args)
make_tuple(Types const&... args)
{
return { args... };
}
......@@ -194,8 +194,8 @@ make_tuple(const Types&... args)
* @relates tuple
*/
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator==(const tuple<LhsTypes...>& lhs,
const tuple<RhsTypes...>& rhs)
inline bool operator==(tuple<LhsTypes...> const& lhs,
tuple<RhsTypes...> const& rhs)
{
return util::compare_tuples(lhs, rhs);
}
......@@ -208,8 +208,8 @@ inline bool operator==(const tuple<LhsTypes...>& lhs,
* @relates tuple
*/
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator!=(const tuple<LhsTypes...>& lhs,
const tuple<RhsTypes...>& rhs)
inline bool operator!=(tuple<LhsTypes...> const& lhs,
tuple<RhsTypes...> const& rhs)
{
return !(lhs == rhs);
}
......
......@@ -42,7 +42,7 @@ class tuple_view
tuple_view() : m_vals(tuple<ElementTypes...>().vals()) { }
static tuple_view from(const vals_t& vals)
static tuple_view from(vals_t const& vals)
{
return tuple_view(vals);
}
......@@ -52,7 +52,7 @@ class tuple_view
return tuple_view(std::move(vals));
}
tuple_view(const vals_t& vals, mapping_vector& mapping)
tuple_view(vals_t const& vals, mapping_vector& mapping)
: m_vals(new detail::decorated_tuple<ElementTypes...>(vals, mapping))
{
}
......@@ -61,7 +61,7 @@ class tuple_view
{
}
tuple_view& operator=(const tuple_view& other)
tuple_view& operator=(tuple_view const& other)
{
m_vals = other.m_vals;
return *this;
......@@ -73,9 +73,9 @@ class tuple_view
return *this;
}
tuple_view(const tuple_view&) = default;
tuple_view(tuple_view const&) = default;
inline const vals_t& vals() const
inline vals_t const& vals() const
{
return m_vals;
}
......@@ -88,7 +88,7 @@ class tuple_view
private:
explicit tuple_view(const vals_t& vals) : m_vals(vals)
explicit tuple_view(vals_t const& vals) : m_vals(vals)
{
}
......@@ -101,11 +101,11 @@ class tuple_view
};
template<size_t N, typename... Types>
const typename util::at<N, Types...>::type& get(const tuple_view<Types...>& t)
const typename util::at<N, Types...>::type& get(tuple_view<Types...> const& t)
{
static_assert(N < sizeof...(Types), "N >= t.size()");
typedef typename util::at<N, Types...>::type result_t;
return *reinterpret_cast<const result_t*>(t.vals()->at(N));
return *reinterpret_cast<result_t const*>(t.vals()->at(N));
}
template<size_t N, typename... Types>
......@@ -126,43 +126,43 @@ struct tuple_view_type_from_type_list<util::type_list<Types...>>
};
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator==(const tuple_view<LhsTypes...>& lhs,
const tuple_view<RhsTypes...>& rhs)
inline bool operator==(tuple_view<LhsTypes...> const& lhs,
tuple_view<RhsTypes...> const& rhs)
{
return util::compare_tuples(lhs, rhs);
}
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator==(const tuple<LhsTypes...>& lhs,
const tuple_view<RhsTypes...>& rhs)
inline bool operator==(tuple<LhsTypes...> const& lhs,
tuple_view<RhsTypes...> const& rhs)
{
return util::compare_tuples(lhs, rhs);
}
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator==(const tuple_view<LhsTypes...>& lhs,
const tuple<RhsTypes...>& rhs)
inline bool operator==(tuple_view<LhsTypes...> const& lhs,
tuple<RhsTypes...> const& rhs)
{
return util::compare_tuples(lhs, rhs);
}
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator!=(const tuple_view<LhsTypes...>& lhs,
const tuple_view<RhsTypes...>& rhs)
inline bool operator!=(tuple_view<LhsTypes...> const& lhs,
tuple_view<RhsTypes...> const& rhs)
{
return !(lhs == rhs);
}
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator!=(const tuple<LhsTypes...>& lhs,
const tuple_view<RhsTypes...>& rhs)
inline bool operator!=(tuple<LhsTypes...> const& lhs,
tuple_view<RhsTypes...> const& rhs)
{
return !(lhs == rhs);
}
template<typename... LhsTypes, typename... RhsTypes>
inline bool operator!=(const tuple_view<LhsTypes...>& lhs,
const tuple<RhsTypes...>& rhs)
inline bool operator!=(tuple_view<LhsTypes...> const& lhs,
tuple<RhsTypes...> const& rhs)
{
return !(lhs == rhs);
}
......
......@@ -23,7 +23,7 @@ class serializer;
class deserializer;
class uniform_type_info;
const uniform_type_info* uniform_typeid(const std::type_info&);
uniform_type_info const* uniform_typeid(std::type_info const&);
/**
* @defgroup TypeSystem libcppa's platform-independent type system.
......@@ -121,16 +121,16 @@ class uniform_type_info
friend class object;
friend bool operator==(const uniform_type_info& lhs,
const uniform_type_info& rhs);
friend bool operator==(uniform_type_info const& lhs,
uniform_type_info const& rhs);
// disable copy and move constructors
uniform_type_info(uniform_type_info&&) = delete;
uniform_type_info(const uniform_type_info&) = delete;
uniform_type_info(uniform_type_info const&) = delete;
// disable assignment operators
uniform_type_info& operator=(uniform_type_info&&) = delete;
uniform_type_info& operator=(const uniform_type_info&) = delete;
uniform_type_info& operator=(uniform_type_info const&) = delete;
public:
......@@ -142,7 +142,7 @@ class uniform_type_info
* @returns The instance associated to @p uniform_name.
* @throws std::runtime_error if no type named @p uniform_name was found.
*/
static uniform_type_info* from(const std::string& uniform_name);
static uniform_type_info* from(std::string const& uniform_name);
/**
* @brief Get instance by std::type_info.
......@@ -150,7 +150,7 @@ class uniform_type_info
* @returns An instance describing the same type as @p tinfo.
* @throws std::runtime_error if @p tinfo is not an announced type.
*/
static const uniform_type_info* from(const std::type_info& tinfo);
static uniform_type_info const* from(std::type_info const& tinfo);
/**
* @brief Get all instances.
......@@ -162,7 +162,7 @@ class uniform_type_info
* @brief Get the internal @p libcppa name for this type.
* @returns A string describing the @p libcppa internal type name.
*/
inline const std::string& name() const { return m_name; }
inline std::string const& name() const { return m_name; }
/**
* @brief Creates an object of this type.
......@@ -179,7 +179,7 @@ class uniform_type_info
* type than @p tinfo.
* @returns @p true if @p tinfo describes the same type as @p this.
*/
virtual bool equals(const std::type_info& tinfo) const = 0;
virtual bool equals(std::type_info const& tinfo) const = 0;
/**
* @brief Compares two instances of this type.
......@@ -188,7 +188,7 @@ class uniform_type_info
* @returns @p true if <tt>*instance1 == *instance2</tt>.
* @pre @p instance1 and @p instance2 have the type of @p this.
*/
virtual bool equals(const void* instance1, const void* instance2) const = 0;
virtual bool equals(void const* instance1, void const* instance2) const = 0;
/**
* @brief Serializes @p instance to @p sink.
......@@ -196,7 +196,7 @@ class uniform_type_info
* @param sink Target data sink.
* @pre @p instance has the type of @p this.
*/
virtual void serialize(const void* instance, serializer* sink) const = 0;
virtual void serialize(void const* instance, serializer* sink) const = 0;
/**
* @brief Deserializes @p instance from @p source.
......@@ -208,7 +208,7 @@ class uniform_type_info
protected:
uniform_type_info(const std::string& uniform_name);
uniform_type_info(std::string const& uniform_name);
/**
* @brief Casts @p instance to the native type and deletes it.
......@@ -226,7 +226,7 @@ class uniform_type_info
* with the default constructor.
* @pre @p instance has the type of @p this or is set to @p nullptr.
*/
virtual void* new_instance(const void* instance = nullptr) const = 0;
virtual void* new_instance(void const* instance = nullptr) const = 0;
private:
......@@ -235,41 +235,41 @@ class uniform_type_info
};
template<typename T>
inline const uniform_type_info* uniform_typeid()
inline uniform_type_info const* uniform_typeid()
{
return uniform_typeid(typeid(T));
}
inline bool operator==(const uniform_type_info& lhs,
const uniform_type_info& rhs)
inline bool operator==(uniform_type_info const& lhs,
uniform_type_info const& rhs)
{
// uniform_type_info instances are singletons,
// thus, equal == identical
return &lhs == &rhs;
}
inline bool operator!=(const uniform_type_info& lhs,
const uniform_type_info& rhs)
inline bool operator!=(uniform_type_info const& lhs,
uniform_type_info const& rhs)
{
return !(lhs == rhs);
}
inline bool operator==(const uniform_type_info& lhs, const std::type_info& rhs)
inline bool operator==(uniform_type_info const& lhs, std::type_info const& rhs)
{
return lhs.equals(rhs);
}
inline bool operator!=(const uniform_type_info& lhs, const std::type_info& rhs)
inline bool operator!=(uniform_type_info const& lhs, std::type_info const& rhs)
{
return !(lhs.equals(rhs));
}
inline bool operator==(const std::type_info& lhs, const uniform_type_info& rhs)
inline bool operator==(std::type_info const& lhs, uniform_type_info const& rhs)
{
return rhs.equals(lhs);
}
inline bool operator!=(const std::type_info& lhs, const uniform_type_info& rhs)
inline bool operator!=(std::type_info const& lhs, uniform_type_info const& rhs)
{
return !(rhs.equals(lhs));
}
......
......@@ -14,9 +14,9 @@ template<typename T>
class abstract_uniform_type_info : public uniform_type_info
{
inline static const T& deref(const void* ptr)
inline static T const& deref(void const* ptr)
{
return *reinterpret_cast<const T*>(ptr);
return *reinterpret_cast<T const*>(ptr);
}
inline static T& deref(void* ptr)
......@@ -26,18 +26,18 @@ class abstract_uniform_type_info : public uniform_type_info
protected:
abstract_uniform_type_info(const std::string& uname
abstract_uniform_type_info(std::string const& uname
= detail::to_uniform_name(typeid(T)))
: uniform_type_info(uname)
{
}
bool equals(const void* lhs, const void* rhs) const
bool equals(void const* lhs, void const* rhs) const
{
return deref(lhs) == deref(rhs);
}
void* new_instance(const void* ptr) const
void* new_instance(void const* ptr) const
{
return (ptr) ? new T(deref(ptr)) : new T();
}
......@@ -49,7 +49,7 @@ class abstract_uniform_type_info : public uniform_type_info
public:
bool equals(const std::type_info& tinfo) const
bool equals(std::type_info const& tinfo) const
{
return typeid(T) == tinfo;
}
......
......@@ -8,21 +8,21 @@ namespace cppa { namespace util {
class any_tuple_iterator
{
const any_tuple& m_data;
any_tuple const& m_data;
size_t m_pos;
public:
any_tuple_iterator(const any_tuple& data, size_t pos = 0);
any_tuple_iterator(any_tuple const& data, size_t pos = 0);
inline bool at_end() const;
template<typename T>
inline const T& value() const;
inline T const& value() const;
inline const void* value_ptr() const;
inline void const* value_ptr() const;
inline const cppa::uniform_type_info& type() const;
inline cppa::uniform_type_info const& type() const;
inline size_t position() const;
......@@ -36,17 +36,17 @@ inline bool any_tuple_iterator::at_end() const
}
template<typename T>
inline const T& any_tuple_iterator::value() const
inline T const& any_tuple_iterator::value() const
{
return *reinterpret_cast<const T*>(m_data.at(m_pos));
return *reinterpret_cast<T const*>(m_data.at(m_pos));
}
inline const uniform_type_info& any_tuple_iterator::type() const
inline uniform_type_info const& any_tuple_iterator::type() const
{
return m_data.utype_info_at(m_pos);
}
inline const void* any_tuple_iterator::value_ptr() const
inline void const* any_tuple_iterator::value_ptr() const
{
return m_data.at(m_pos);
}
......
......@@ -16,62 +16,62 @@ template<typename Subclass, typename T = Subclass>
class comparable
{
friend bool operator==(const Subclass& lhs, const T& rhs)
friend bool operator==(Subclass const& lhs, T const& rhs)
{
return lhs.compare(rhs) == 0;
}
friend bool operator==(const T& lhs, const Subclass& rhs)
friend bool operator==(T const& lhs, Subclass const& rhs)
{
return rhs.compare(lhs) == 0;
}
friend bool operator!=(const Subclass& lhs, const T& rhs)
friend bool operator!=(Subclass const& lhs, T const& rhs)
{
return lhs.compare(rhs) != 0;
}
friend bool operator!=(const T& lhs, const Subclass& rhs)
friend bool operator!=(T const& lhs, Subclass const& rhs)
{
return rhs.compare(lhs) != 0;
}
friend bool operator<(const Subclass& lhs, const T& rhs)
friend bool operator<(Subclass const& lhs, T const& rhs)
{
return lhs.compare(rhs) < 0;
}
friend bool operator>(const Subclass& lhs, const T& rhs)
friend bool operator>(Subclass const& lhs, T const& rhs)
{
return lhs.compare(rhs) > 0;
}
friend bool operator<(const T& lhs, const Subclass& rhs)
friend bool operator<(T const& lhs, Subclass const& rhs)
{
return rhs > lhs;
}
friend bool operator>(const T& lhs, const Subclass& rhs)
friend bool operator>(T const& lhs, Subclass const& rhs)
{
return rhs < lhs;
}
friend bool operator<=(const Subclass& lhs, const T& rhs)
friend bool operator<=(Subclass const& lhs, T const& rhs)
{
return lhs.compare(rhs) <= 0;
}
friend bool operator>=(const Subclass& lhs, const T& rhs)
friend bool operator>=(Subclass const& lhs, T const& rhs)
{
return lhs.compare(rhs) >= 0;
}
friend bool operator<=(const T& lhs, const Subclass& rhs)
friend bool operator<=(T const& lhs, Subclass const& rhs)
{
return rhs >= lhs;
}
friend bool operator>=(const T& lhs, const Subclass& rhs)
friend bool operator>=(T const& lhs, Subclass const& rhs)
{
return rhs <= lhs;
}
......@@ -82,32 +82,32 @@ template<typename Subclass>
class comparable<Subclass, Subclass>
{
friend bool operator==(const Subclass& lhs, const Subclass& rhs)
friend bool operator==(Subclass const& lhs, Subclass const& rhs)
{
return lhs.compare(rhs) == 0;
}
friend bool operator!=(const Subclass& lhs, const Subclass& rhs)
friend bool operator!=(Subclass const& lhs, Subclass const& rhs)
{
return lhs.compare(rhs) != 0;
}
friend bool operator<(const Subclass& lhs, const Subclass& rhs)
friend bool operator<(Subclass const& lhs, Subclass const& rhs)
{
return lhs.compare(rhs) < 0;
}
friend bool operator<=(const Subclass& lhs, const Subclass& rhs)
friend bool operator<=(Subclass const& lhs, Subclass const& rhs)
{
return lhs.compare(rhs) <= 0;
}
friend bool operator>(const Subclass& lhs, const Subclass& rhs)
friend bool operator>(Subclass const& lhs, Subclass const& rhs)
{
return lhs.compare(rhs) > 0;
}
friend bool operator>=(const Subclass& lhs, const Subclass& rhs)
friend bool operator>=(Subclass const& lhs, Subclass const& rhs)
{
return lhs.compare(rhs) >= 0;
}
......
......@@ -12,7 +12,7 @@ namespace cppa { namespace detail {
template<size_t N, template<typename...> class Tuple, typename... Types>
const typename util::at<N, Types...>::type&
do_get(const Tuple<Types...>& t)
do_get(Tuple<Types...> const& t)
{
return ::cppa::get<N, Types...>(t);
}
......@@ -20,7 +20,7 @@ do_get(const Tuple<Types...>& t)
template<size_t N, typename LhsTuple, typename RhsTuple>
struct cmp_helper
{
inline static bool cmp(const LhsTuple& lhs, const RhsTuple& rhs)
inline static bool cmp(LhsTuple const& lhs, RhsTuple const& rhs)
{
return do_get<N>(lhs) == do_get<N>(rhs)
&& cmp_helper<N-1, LhsTuple, RhsTuple>::cmp(lhs, rhs);
......@@ -30,7 +30,7 @@ struct cmp_helper
template<typename LhsTuple, typename RhsTuple>
struct cmp_helper<0, LhsTuple, RhsTuple>
{
inline static bool cmp(const LhsTuple& lhs, const RhsTuple& rhs)
inline static bool cmp(LhsTuple const& lhs, RhsTuple const& rhs)
{
return do_get<0>(lhs) == do_get<0>(rhs);
}
......@@ -42,8 +42,8 @@ namespace cppa { namespace util {
template<template<typename...> class LhsTuple, typename... LhsTypes,
template<typename...> class RhsTuple, typename... RhsTypes>
bool compare_tuples(const LhsTuple<LhsTypes...>& lhs,
const RhsTuple<RhsTypes...>& rhs)
bool compare_tuples(LhsTuple<LhsTypes...> const& lhs,
RhsTuple<RhsTypes...> const& rhs)
{
static_assert(sizeof...(LhsTypes) == sizeof...(RhsTypes),
"could not compare tuples of different size");
......@@ -58,8 +58,8 @@ bool compare_tuples(const LhsTuple<LhsTypes...>& lhs,
template<template<typename...> class LhsTuple, typename... LhsTypes,
template<typename...> class RhsTuple, typename... RhsTypes>
bool compare_first_elements(const LhsTuple<LhsTypes...>& lhs,
const RhsTuple<RhsTypes...>& rhs)
bool compare_first_elements(LhsTuple<LhsTypes...> const& lhs,
RhsTuple<RhsTypes...> const& rhs)
{
typedef util::type_list<LhsTypes...> lhs_types;
typedef util::type_list<RhsTypes...> rhs_types;
......
......@@ -55,9 +55,9 @@ class duration
};
bool operator==(const duration& lhs, const duration& rhs);
bool operator==(duration const& lhs, duration const& rhs);
inline bool operator!=(const duration& lhs, const duration& rhs)
inline bool operator!=(duration const& lhs, duration const& rhs)
{
return !(lhs == rhs);
}
......@@ -67,7 +67,7 @@ inline bool operator!=(const duration& lhs, const duration& rhs)
template<class Clock, class Duration>
std::chrono::time_point<Clock, Duration>&
operator+=(std::chrono::time_point<Clock, Duration>& lhs,
const cppa::util::duration& rhs)
cppa::util::duration const& rhs)
{
switch (rhs.unit)
{
......
......@@ -21,7 +21,7 @@ class either
bool m_is_left;
void check_flag(bool flag, const char* side)
void check_flag(bool flag, char const* side)
{
if (m_is_left != flag)
{
......@@ -63,7 +63,7 @@ class either
new (&m_left) Left ();
}
either(const Left& value) : m_is_left(true)
either(Left const& value) : m_is_left(true)
{
cr_left(value);
}
......@@ -73,7 +73,7 @@ class either
cr_left(std::move(value));
}
either(const Right& value) : m_is_left(false)
either(Right const& value) : m_is_left(false)
{
cr_right(value);
}
......@@ -83,7 +83,7 @@ class either
cr_right(std::move(value));
}
either(const either& other) : m_is_left(other.m_is_left)
either(either const& other) : m_is_left(other.m_is_left)
{
if (other.m_is_left)
{
......@@ -112,7 +112,7 @@ class either
destroy();
}
either& operator=(const either& other)
either& operator=(either const& other)
{
if (m_is_left == other.m_is_left)
{
......@@ -186,7 +186,7 @@ class either
return m_left;
}
const Left& left() const
Left const& left() const
{
check_flag(true, "left");
return m_left;
......@@ -198,7 +198,7 @@ class either
return m_right;
}
const Right& right() const
Right const& right() const
{
check_flag(false, "right");
return m_right;
......@@ -225,25 +225,25 @@ bool operator==(const either<Left, Right>& lhs,
}
template<typename Left, typename Right>
bool operator==(const either<Left, Right>& lhs, const Left& rhs)
bool operator==(const either<Left, Right>& lhs, Left const& rhs)
{
return lhs.is_left() && lhs.left() == rhs;
}
template<typename Left, typename Right>
bool operator==(const Left& lhs, const either<Left, Right>& rhs)
bool operator==(Left const& lhs, const either<Left, Right>& rhs)
{
return rhs == lhs;
}
template<typename Left, typename Right>
bool operator==(const either<Left, Right>& lhs, const Right& rhs)
bool operator==(const either<Left, Right>& lhs, Right const& rhs)
{
return lhs.is_right() && lhs.right() == rhs;
}
template<typename Left, typename Right>
bool operator==(const Right& lhs, const either<Left, Right>& rhs)
bool operator==(Right const& lhs, const either<Left, Right>& rhs)
{
return rhs == lhs;
}
......@@ -256,25 +256,25 @@ bool operator!=(const either<Left, Right>& lhs,
}
template<typename Left, typename Right>
bool operator!=(const either<Left, Right>& lhs, const Left& rhs)
bool operator!=(const either<Left, Right>& lhs, Left const& rhs)
{
return !(lhs == rhs);
}
template<typename Left, typename Right>
bool operator!=(const Left& lhs, const either<Left, Right>& rhs)
bool operator!=(Left const& lhs, const either<Left, Right>& rhs)
{
return !(rhs == lhs);
}
template<typename Left, typename Right>
bool operator!=(const either<Left, Right>& lhs, const Right& rhs)
bool operator!=(const either<Left, Right>& lhs, Right const& rhs)
{
return !(lhs == rhs);
}
template<typename Left, typename Right>
bool operator!=(const Right& lhs, const either<Left, Right>& rhs)
bool operator!=(Right const& lhs, const either<Left, Right>& rhs)
{
return !(rhs == lhs);
}
......
......@@ -21,16 +21,16 @@ class fixed_vector
typedef size_t size_type;
typedef T& reference;
typedef const T& const_reference;
typedef T const& const_reference;
typedef T* iterator;
typedef const T* const_iterator;
typedef T const* const_iterator;
constexpr fixed_vector() : m_size(0)
{
}
fixed_vector(const fixed_vector& other) : m_size(other.m_size)
fixed_vector(fixed_vector const& other) : m_size(other.m_size)
{
std::copy(other.m_data, other.m_data + other.m_size, m_data);
}
......@@ -50,7 +50,7 @@ class fixed_vector
return m_size == MaxSize;
}
inline void push_back(const T& what)
inline void push_back(T const& what)
{
m_data[m_size++] = what;
}
......
......@@ -10,13 +10,13 @@ class has_copy_member_fun
{
template<typename A>
static bool hc_help_fun(const A* arg0, decltype(arg0->copy()) = 0)
static bool hc_help_fun(A const* arg0, decltype(arg0->copy()) = 0)
{
return true;
}
template<typename A>
static void hc_help_fun(const A*, void* = 0) { }
static void hc_help_fun(A const*, void* = 0) { }
typedef decltype(hc_help_fun((T*) 0, (T*) 0)) result_type;
......
......@@ -18,14 +18,14 @@ class is_comparable
// candidate and thus decltype(cmp_help_fun(...)) is void.
template<typename A, typename B>
static bool cmp_help_fun(const A* arg0, const B* arg1,
static bool cmp_help_fun(A const* arg0, B const* arg1,
decltype(*arg0 == *arg1)* = nullptr)
{
return true;
}
template<typename A, typename B>
static void cmp_help_fun(const A*, const B*, void* = nullptr) { }
static void cmp_help_fun(A const*, B const*, void* = nullptr) { }
typedef decltype(cmp_help_fun(static_cast<T1*>(nullptr),
static_cast<T2*>(nullptr),
......
......@@ -10,13 +10,13 @@ class is_copyable_
{
template<typename A>
static bool cpy_help_fun(const A* arg0, decltype(new A(*arg0)) = nullptr)
static bool cpy_help_fun(A const* arg0, decltype(new A(*arg0)) = nullptr)
{
return true;
}
template<typename A>
static void cpy_help_fun(const A*, void* = nullptr) { }
static void cpy_help_fun(A const*, void* = nullptr) { }
typedef decltype(cpy_help_fun(static_cast<T*>(nullptr),
static_cast<T*>(nullptr)))
......
......@@ -14,7 +14,7 @@ class is_iterable
template<class C>
static bool sfinae_fun
(
const C* cc,
C const* cc,
// check for 'C::begin()' returning a forward iterator
typename util::enable_if<util::is_forward_iterator<decltype(cc->begin())>>::type* = 0,
// check for 'C::end()' returning the same kind of forward iterator
......@@ -27,7 +27,7 @@ class is_iterable
// SFNINAE default
static void sfinae_fun(...) { }
typedef decltype(sfinae_fun(static_cast<const T*>(nullptr))) result_type;
typedef decltype(sfinae_fun(static_cast<T const*>(nullptr))) result_type;
public:
......
......@@ -10,7 +10,7 @@ struct remove_const_reference
};
template<typename T>
struct remove_const_reference<const T&>
struct remove_const_reference<T const&>
{
typedef T type;
};
......
......@@ -43,7 +43,7 @@
namespace cppa { namespace util {
void ripemd_160(std::array<std::uint8_t, 20>& storage, const std::string& data);
void ripemd_160(std::array<std::uint8_t, 20>& storage, std::string const& data);
} } // namespace cppa::util
......
......@@ -11,7 +11,7 @@ template<typename T>
struct rm_ref { typedef T type; };
template<typename T>
struct rm_ref<const T&> { typedef T type; };
struct rm_ref<T const&> { typedef T type; };
template<typename T>
struct rm_ref<T&> { typedef T type; };
......
......@@ -39,7 +39,7 @@ class single_reader_queue
}
template<typename TimePoint>
element_type* try_pop(const TimePoint& abs_time)
element_type* try_pop(TimePoint const& abs_time)
{
return (timed_wait_for_data(abs_time)) ? take_head() : nullptr;
}
......@@ -157,7 +157,7 @@ class single_reader_queue
detail::condition_variable m_cv;
template<typename TimePoint>
bool timed_wait_for_data(const TimePoint& timeout)
bool timed_wait_for_data(TimePoint const& timeout)
{
if (!m_head && !(m_tail.load()))
{
......
......@@ -9,7 +9,7 @@ namespace cppa {
// forward declarations
class uniform_type_info;
const uniform_type_info* uniform_typeid(const std::type_info&);
uniform_type_info const* uniform_typeid(std::type_info const&);
} // namespace cppa
......@@ -29,6 +29,8 @@ template<typename Head, typename... Tail>
struct type_list<Head, Tail...>
{
typedef uniform_type_info const* uti_ptr;
typedef Head head_type;
typedef type_list<Tail...> tail_type;
......@@ -40,13 +42,13 @@ struct type_list<Head, Tail...>
init<type_list>(m_arr);
}
inline const uniform_type_info& at(size_t pos) const
inline uniform_type_info const& at(size_t pos) const
{
return *m_arr[pos];
}
template<typename TypeList>
static void init(const uniform_type_info** what)
static void init(uti_ptr* what)
{
what[0] = uniform_typeid(typeid(typename TypeList::head_type));
if (TypeList::size > 1)
......@@ -58,7 +60,7 @@ struct type_list<Head, Tail...>
private:
const uniform_type_info* m_arr[size];
uti_ptr m_arr[size];
};
......
......@@ -12,7 +12,7 @@ struct void_type
typedef type_list<> tail_type;
};
inline bool operator==(const void_type&, const void_type&) { return true; }
inline bool operator==(void_type const&, void_type const&) { return true; }
} } // namespace cppa::util
......
......@@ -34,17 +34,18 @@ class observer : public cppa::attachable
namespace cppa {
local_actor* operator<<(local_actor* whom, const any_tuple& what)
const self_type& operator<<(const self_type& s, const any_tuple& what)
{
if (whom) whom->enqueue(self, what);
return whom;
local_actor* sptr = s;
sptr->enqueue(sptr, what);
return s;
}
// matches self << make_tuple(...)
local_actor* operator<<(local_actor* whom, any_tuple&& what)
const self_type& operator<<(const self_type& s, any_tuple&& what)
{
if (whom) whom->enqueue(self, std::move(what));
return whom;
local_actor* sptr = s;
sptr->enqueue(sptr, std::move(what));
return s;
}
void link(actor_ptr& other)
......
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011, Dominik Charousset <dominik.charousset@haw-hamburg.de> *
* *
* This file is part of libcppa. *
* libcppa is free software: you can redistribute it and/or modify it under *
* the terms of the GNU Lesser General Public License as published by the *
* Free Software Foundation, either version 3 of the License *
* or (at your option) any later version. *
* *
* libcppa is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public License *
* along with libcppa. If not, see <http://www.gnu.org/licenses/>. *
\******************************************************************************/
#include "cppa/invoke.hpp"
#include "cppa/invoke_rules.hpp"
#include "cppa/util/duration.hpp"
......
......@@ -25,7 +25,7 @@ void ping()
{
++s_pongs;
get_ref<1>(response) = value + 1;
reply_tuple(response);
last_sender() << response;
}
);
}
......@@ -35,7 +35,7 @@ void pong(actor_ptr ping_actor)
link(ping_actor);
auto pong_tuple = make_tuple(atom("Pong"), 0);
// kickoff
send_tuple(ping_actor, pong_tuple);
ping_actor << pong_tuple;
// invoke rules
receive_loop
(
......@@ -48,7 +48,7 @@ void pong(actor_ptr ping_actor)
on<atom("Ping"), int>() >> [&](int value)
{
get_ref<1>(pong_tuple) = value + 1;
reply_tuple(pong_tuple);
last_sender() << pong_tuple;
}
);
}
......
......@@ -83,7 +83,7 @@ size_t test__pattern()
CPPA_CHECK_EQUAL(value, 1);
lambda_invoked[4] = true;
},
on_arg_match() >> [&](double v1, const float& v2)
on_arg_match >> [&](double v1, const float& v2)
{
CPPA_CHECK_EQUAL(v1, 1.0);
CPPA_CHECK_EQUAL(v2, 2.0f);
......
......@@ -335,7 +335,6 @@ size_t test__spawn()
// link(my_link, spawn(new event_testee));
// }
// send(my_link, atom(":Exit"), exit_reason::user_defined);
return CPPA_TEST_RESULT;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment