Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
4fdb2cb4
Commit
4fdb2cb4
authored
Apr 21, 2014
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
got rid of empty tuple singleton
parent
6de99fdc
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
43 additions
and
164 deletions
+43
-164
CMakeLists.txt
CMakeLists.txt
+0
-1
cppa.files
cppa.files
+0
-1
cppa/any_tuple.hpp
cppa/any_tuple.hpp
+2
-2
cppa/detail/empty_tuple.hpp
cppa/detail/empty_tuple.hpp
+0
-70
cppa/detail/singleton_manager.hpp
cppa/detail/singleton_manager.hpp
+0
-3
cppa/match_expr.hpp
cppa/match_expr.hpp
+40
-0
cppa/singletons.hpp
cppa/singletons.hpp
+0
-4
src/any_tuple.cpp
src/any_tuple.cpp
+1
-4
src/empty_tuple.cpp
src/empty_tuple.cpp
+0
-71
src/singleton_manager.cpp
src/singleton_manager.cpp
+0
-8
No files found.
CMakeLists.txt
View file @
4fdb2cb4
...
@@ -174,7 +174,6 @@ set(LIBCPPA_SRC
...
@@ -174,7 +174,6 @@ set(LIBCPPA_SRC
src/demangle.cpp
src/demangle.cpp
src/deserializer.cpp
src/deserializer.cpp
src/duration.cpp
src/duration.cpp
src/empty_tuple.cpp
src/event_based_actor.cpp
src/event_based_actor.cpp
src/exception.cpp
src/exception.cpp
src/execution_unit.cpp
src/execution_unit.cpp
...
...
cppa.files
View file @
4fdb2cb4
...
@@ -38,7 +38,6 @@ cppa/detail/decorated_tuple.hpp
...
@@ -38,7 +38,6 @@ cppa/detail/decorated_tuple.hpp
cppa/detail/default_uniform_type_info.hpp
cppa/detail/default_uniform_type_info.hpp
cppa/detail/demangle.hpp
cppa/detail/demangle.hpp
cppa/detail/disablable_delete.hpp
cppa/detail/disablable_delete.hpp
cppa/detail/empty_tuple.hpp
cppa/detail/execinfo_windows.hpp
cppa/detail/execinfo_windows.hpp
cppa/detail/fd_util.hpp
cppa/detail/fd_util.hpp
cppa/detail/functor_based_actor.hpp
cppa/detail/functor_based_actor.hpp
...
...
cppa/any_tuple.hpp
View file @
4fdb2cb4
...
@@ -73,7 +73,7 @@ class any_tuple {
...
@@ -73,7 +73,7 @@ class any_tuple {
/**
/**
* @brief Creates an empty tuple.
* @brief Creates an empty tuple.
*/
*/
any_tuple
();
any_tuple
()
=
default
;
/**
/**
* @brief Creates a tuple from @p t.
* @brief Creates a tuple from @p t.
...
@@ -345,7 +345,7 @@ inline const std::string* any_tuple::tuple_type_names() const {
...
@@ -345,7 +345,7 @@ inline const std::string* any_tuple::tuple_type_names() const {
inline
size_t
any_tuple
::
size
()
const
{
inline
size_t
any_tuple
::
size
()
const
{
return
m_vals
->
size
()
;
return
m_vals
?
m_vals
->
size
()
:
0
;
}
}
inline
any_tuple
any_tuple
::
take
(
size_t
n
)
const
{
inline
any_tuple
any_tuple
::
take
(
size_t
n
)
const
{
...
...
cppa/detail/empty_tuple.hpp
deleted
100644 → 0
View file @
6de99fdc
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011-2013 *
* 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 2.1 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_EMPTY_TUPLE_HPP
#define CPPA_EMPTY_TUPLE_HPP
#include "cppa/detail/abstract_tuple.hpp"
#include "cppa/detail/singleton_mixin.hpp"
namespace
cppa
{
namespace
detail
{
class
empty_tuple
:
public
singleton_mixin
<
empty_tuple
,
abstract_tuple
>
{
friend
class
singleton_manager
;
friend
class
singleton_mixin
<
empty_tuple
,
abstract_tuple
>
;
typedef
singleton_mixin
<
empty_tuple
,
abstract_tuple
>
super
;
public:
using
abstract_tuple
::
const_iterator
;
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
*
type_at
(
size_t
)
const
;
const
std
::
type_info
*
type_token
()
const
;
const
std
::
string
*
tuple_type_names
()
const
;
private:
empty_tuple
();
inline
void
initialize
()
{
ref
();
}
inline
void
destroy
()
{
deref
();
}
};
}
}
// namespace cppa::detail
#endif // CPPA_EMPTY_TUPLE_HPP
cppa/detail/singleton_manager.hpp
View file @
4fdb2cb4
...
@@ -43,7 +43,6 @@ namespace cppa { namespace opencl { class opencl_metainfo; } }
...
@@ -43,7 +43,6 @@ namespace cppa { namespace opencl { class opencl_metainfo; } }
namespace
cppa
{
namespace
detail
{
namespace
cppa
{
namespace
detail
{
class
empty_tuple
;
class
group_manager
;
class
group_manager
;
class
abstract_tuple
;
class
abstract_tuple
;
class
actor_registry
;
class
actor_registry
;
...
@@ -71,8 +70,6 @@ class singleton_manager {
...
@@ -71,8 +70,6 @@ class singleton_manager {
static
abstract_tuple
*
get_tuple_dummy
();
static
abstract_tuple
*
get_tuple_dummy
();
static
empty_tuple
*
get_empty_tuple
();
static
opencl
::
opencl_metainfo
*
get_opencl_metainfo
();
static
opencl
::
opencl_metainfo
*
get_opencl_metainfo
();
private:
private:
...
...
cppa/match_expr.hpp
View file @
4fdb2cb4
...
@@ -828,6 +828,46 @@ class match_expr {
...
@@ -828,6 +828,46 @@ class match_expr {
template
<
class
Tuple
>
template
<
class
Tuple
>
result_type
apply
(
Tuple
&
tup
)
{
result_type
apply
(
Tuple
&
tup
)
{
if
(
tup
.
empty
())
{
struct
tuple_dummy
{
typedef
util
::
empty_type_list
types
;
typedef
detail
::
tuple_iterator
<
tuple_dummy
>
const_iterator
;
inline
size_t
size
()
const
{
return
0
;
}
inline
void
*
mutable_at
(
size_t
)
{
return
nullptr
;
}
inline
const
void
*
at
(
size_t
)
const
{
return
nullptr
;
}
inline
const
uniform_type_info
*
type_at
(
size_t
)
const
{
return
nullptr
;
}
inline
const
std
::
type_info
*
type_token
()
const
{
return
&
typeid
(
util
::
empty_type_list
);
}
inline
bool
dynamically_typed
()
const
{
return
false
;
}
inline
const_iterator
begin
()
const
{
return
{
this
};
}
inline
const_iterator
end
()
const
{
return
{
this
,
0
};
}
};
tuple_dummy
td
;
auto
td_token_ptr
=
td
.
type_token
();
auto
td_bitmask
=
get_cache_entry
(
td_token_ptr
,
td
);
return
detail
::
unroll_expr
<
result_type
>
(
m_cases
,
td_bitmask
,
idx_token
,
*
td_token_ptr
,
false
,
static_cast
<
void
*>
(
nullptr
),
td
);
}
std
::
integral_constant
<
bool
,
has_manipulator
>
mutator_token
;
std
::
integral_constant
<
bool
,
has_manipulator
>
mutator_token
;
// returns either a reference or a new object
// returns either a reference or a new object
typedef
decltype
(
detail
::
detach_if_needed
(
tup
,
mutator_token
))
detached
;
typedef
decltype
(
detail
::
detach_if_needed
(
tup
,
mutator_token
))
detached
;
...
...
cppa/singletons.hpp
View file @
4fdb2cb4
...
@@ -63,10 +63,6 @@ inline detail::abstract_tuple* get_tuple_dummy() {
...
@@ -63,10 +63,6 @@ inline detail::abstract_tuple* get_tuple_dummy() {
return
detail
::
singleton_manager
::
get_tuple_dummy
();
return
detail
::
singleton_manager
::
get_tuple_dummy
();
}
}
inline
detail
::
empty_tuple
*
get_empty_tuple
()
{
return
detail
::
singleton_manager
::
get_empty_tuple
();
}
}
// namespace cppa
}
// namespace cppa
#endif // CPPA_SINGLETONS_HPP
#endif // CPPA_SINGLETONS_HPP
src/any_tuple.cpp
View file @
4fdb2cb4
...
@@ -30,12 +30,9 @@
...
@@ -30,12 +30,9 @@
#include "cppa/any_tuple.hpp"
#include "cppa/any_tuple.hpp"
#include "cppa/singletons.hpp"
#include "cppa/singletons.hpp"
#include "cppa/detail/empty_tuple.hpp"
namespace
cppa
{
namespace
cppa
{
any_tuple
::
any_tuple
()
:
m_vals
(
get_empty_tuple
())
{
}
any_tuple
::
any_tuple
(
detail
::
abstract_tuple
*
ptr
)
:
m_vals
(
ptr
)
{
}
any_tuple
::
any_tuple
(
detail
::
abstract_tuple
*
ptr
)
:
m_vals
(
ptr
)
{
}
any_tuple
::
any_tuple
(
any_tuple
&&
other
)
:
m_vals
(
std
::
move
(
other
.
m_vals
))
{
}
any_tuple
::
any_tuple
(
any_tuple
&&
other
)
:
m_vals
(
std
::
move
(
other
.
m_vals
))
{
}
...
@@ -48,7 +45,7 @@ any_tuple& any_tuple::operator=(any_tuple&& other) {
...
@@ -48,7 +45,7 @@ any_tuple& any_tuple::operator=(any_tuple&& other) {
}
}
void
any_tuple
::
reset
()
{
void
any_tuple
::
reset
()
{
m_vals
.
reset
(
get_empty_tuple
()
);
m_vals
.
reset
();
}
}
void
*
any_tuple
::
mutable_at
(
size_t
p
)
{
void
*
any_tuple
::
mutable_at
(
size_t
p
)
{
...
...
src/empty_tuple.cpp
deleted
100644 → 0
View file @
6de99fdc
/******************************************************************************\
* ___ __ *
* /\_ \ __/\ \ *
* \//\ \ /\_\ \ \____ ___ _____ _____ __ *
* \ \ \ \/\ \ \ '__`\ /'___\/\ '__`\/\ '__`\ /'__`\ *
* \_\ \_\ \ \ \ \L\ \/\ \__/\ \ \L\ \ \ \L\ \/\ \L\.\_ *
* /\____\\ \_\ \_,__/\ \____\\ \ ,__/\ \ ,__/\ \__/.\_\ *
* \/____/ \/_/\/___/ \/____/ \ \ \/ \ \ \/ \/__/\/_/ *
* \ \_\ \ \_\ *
* \/_/ \/_/ *
* *
* Copyright (C) 2011-2013 *
* 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 2.1 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 <stdexcept>
#include "cppa/detail/empty_tuple.hpp"
namespace
cppa
{
namespace
detail
{
empty_tuple
::
empty_tuple
()
:
super
(
false
)
{
}
size_t
empty_tuple
::
size
()
const
{
return
0
;
}
void
*
empty_tuple
::
mutable_at
(
size_t
)
{
throw
std
::
range_error
(
"empty_tuple::mutable_at()"
);
}
abstract_tuple
*
empty_tuple
::
copy
()
const
{
return
new
empty_tuple
;
}
const
void
*
empty_tuple
::
at
(
size_t
)
const
{
throw
std
::
range_error
(
"empty_tuple::at()"
);
}
const
uniform_type_info
*
empty_tuple
::
type_at
(
size_t
)
const
{
throw
std
::
range_error
(
"empty_tuple::type_at()"
);
}
bool
empty_tuple
::
equals
(
const
abstract_tuple
&
other
)
const
{
return
other
.
size
()
==
0
;
}
const
std
::
type_info
*
empty_tuple
::
type_token
()
const
{
return
&
typeid
(
util
::
empty_type_list
);
}
const
std
::
string
*
empty_tuple
::
tuple_type_names
()
const
{
static
std
::
string
result
=
"@<>"
;
return
&
result
;
}
}
}
// namespace cppa::detail
src/singleton_manager.cpp
View file @
4fdb2cb4
...
@@ -39,7 +39,6 @@
...
@@ -39,7 +39,6 @@
#include "cppa/io/middleman.hpp"
#include "cppa/io/middleman.hpp"
#include "cppa/detail/empty_tuple.hpp"
#include "cppa/detail/group_manager.hpp"
#include "cppa/detail/group_manager.hpp"
#include "cppa/detail/actor_registry.hpp"
#include "cppa/detail/actor_registry.hpp"
#include "cppa/detail/singleton_manager.hpp"
#include "cppa/detail/singleton_manager.hpp"
...
@@ -66,7 +65,6 @@ std::atomic<uniform_type_info_map*> s_uniform_type_info_map;
...
@@ -66,7 +65,6 @@ std::atomic<uniform_type_info_map*> s_uniform_type_info_map;
std
::
atomic
<
io
::
middleman
*>
s_middleman
;
std
::
atomic
<
io
::
middleman
*>
s_middleman
;
std
::
atomic
<
actor_registry
*>
s_actor_registry
;
std
::
atomic
<
actor_registry
*>
s_actor_registry
;
std
::
atomic
<
group_manager
*>
s_group_manager
;
std
::
atomic
<
group_manager
*>
s_group_manager
;
std
::
atomic
<
empty_tuple
*>
s_empty_tuple
;
std
::
atomic
<
scheduler
::
coordinator
*>
s_scheduling_coordinator
;
std
::
atomic
<
scheduler
::
coordinator
*>
s_scheduling_coordinator
;
std
::
atomic
<
logging
*>
s_logger
;
std
::
atomic
<
logging
*>
s_logger
;
...
@@ -85,8 +83,6 @@ void singleton_manager::shutdown() {
...
@@ -85,8 +83,6 @@ void singleton_manager::shutdown() {
destroy
(
s_actor_registry
);
destroy
(
s_actor_registry
);
CPPA_LOGF_DEBUG
(
"shutdown group manager"
);
CPPA_LOGF_DEBUG
(
"shutdown group manager"
);
destroy
(
s_group_manager
);
destroy
(
s_group_manager
);
CPPA_LOGF_DEBUG
(
"destroy empty tuple singleton"
);
destroy
(
s_empty_tuple
);
CPPA_LOGF_DEBUG
(
"clear type info map"
);
CPPA_LOGF_DEBUG
(
"clear type info map"
);
destroy
(
s_uniform_type_info_map
);
destroy
(
s_uniform_type_info_map
);
destroy
(
s_logger
);
destroy
(
s_logger
);
...
@@ -125,8 +121,4 @@ io::middleman* singleton_manager::get_middleman() {
...
@@ -125,8 +121,4 @@ io::middleman* singleton_manager::get_middleman() {
return
lazy_get
(
s_middleman
);
return
lazy_get
(
s_middleman
);
}
}
empty_tuple
*
singleton_manager
::
get_empty_tuple
()
{
return
lazy_get
(
s_empty_tuple
);
}
}
}
// namespace cppa::detail
}
}
// namespace cppa::detail
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment