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
2d771bf0
Commit
2d771bf0
authored
Sep 03, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix formatting, tools, and unit tests
parent
1fdc78ce
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
195 additions
and
207 deletions
+195
-207
examples/curl/curl_fuse.cpp
examples/curl/curl_fuse.cpp
+32
-22
examples/custom_type/custom_types_2.cpp
examples/custom_type/custom_types_2.cpp
+2
-6
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+0
-1
libcaf_core/caf/abstract_group.hpp
libcaf_core/caf/abstract_group.hpp
+0
-1
libcaf_core/caf/detail/type_id_list_builder.hpp
libcaf_core/caf/detail/type_id_list_builder.hpp
+2
-1
libcaf_core/caf/ipv6_address.hpp
libcaf_core/caf/ipv6_address.hpp
+1
-2
libcaf_core/caf/load_inspector.hpp
libcaf_core/caf/load_inspector.hpp
+2
-2
libcaf_core/caf/save_inspector.hpp
libcaf_core/caf/save_inspector.hpp
+2
-2
libcaf_core/caf/tracing_data_factory.hpp
libcaf_core/caf/tracing_data_factory.hpp
+4
-5
libcaf_core/caf/type_id.hpp
libcaf_core/caf/type_id.hpp
+7
-0
libcaf_core/src/detail/parse.cpp
libcaf_core/src/detail/parse.cpp
+4
-4
libcaf_core/src/group_manager.cpp
libcaf_core/src/group_manager.cpp
+43
-53
libcaf_core/src/message.cpp
libcaf_core/src/message.cpp
+13
-14
libcaf_core/src/tracing_data.cpp
libcaf_core/src/tracing_data.cpp
+43
-10
libcaf_core/test/actor_profiler.cpp
libcaf_core/test/actor_profiler.cpp
+10
-10
libcaf_core/test/detail/print.cpp
libcaf_core/test/detail/print.cpp
+0
-41
libcaf_core/test/message.cpp
libcaf_core/test/message.cpp
+4
-3
libcaf_core/test/save_inspector.cpp
libcaf_core/test/save_inspector.cpp
+1
-2
libcaf_core/test/settings.cpp
libcaf_core/test/settings.cpp
+0
-1
libcaf_core/test/tracing_data.cpp
libcaf_core/test/tracing_data.cpp
+17
-20
libcaf_io/test/io/basp_broker.cpp
libcaf_io/test/io/basp_broker.cpp
+2
-2
tools/caf-vec.cpp
tools/caf-vec.cpp
+6
-5
No files found.
examples/curl/curl_fuse.cpp
View file @
2d771bf0
...
@@ -115,11 +115,11 @@ struct base_state {
...
@@ -115,11 +115,11 @@ struct base_state {
}
}
actor_ostream
print
()
{
actor_ostream
print
()
{
return
aout
(
self
)
<<
color
<<
name
<<
" (id = "
<<
self
->
id
()
<<
"): "
;
return
aout
(
self
)
<<
color
<<
self
->
name
()
<<
" (id = "
<<
self
->
id
()
<<
"): "
;
}
}
virtual
bool
init
(
std
::
string
m_name
,
std
::
string
m_color
)
{
virtual
bool
init
(
std
::
string
m_color
)
{
name
=
std
::
move
(
m_name
);
color
=
std
::
move
(
m_color
);
color
=
std
::
move
(
m_color
);
print
()
<<
"started"
<<
color
::
reset_endl
;
print
()
<<
"started"
<<
color
::
reset_endl
;
return
true
;
return
true
;
...
@@ -130,13 +130,18 @@ struct base_state {
...
@@ -130,13 +130,18 @@ struct base_state {
}
}
local_actor
*
self
;
local_actor
*
self
;
std
::
string
name
;
std
::
string
color
;
std
::
string
color
;
};
};
struct
client_job_state
:
base_state
{
static
inline
const
char
*
name
=
"curl.client-job"
;
using
base_state
::
base_state
;
};
// encapsulates an HTTP request
// encapsulates an HTTP request
behavior
client_job
(
stateful_actor
<
base_state
>*
self
,
const
actor
&
parent
)
{
behavior
client_job
(
stateful_actor
<
client_job_state
>*
self
,
if
(
!
self
->
state
.
init
(
"client-job"
,
color
::
blue
))
const
actor
&
parent
)
{
if
(
!
self
->
state
.
init
(
color
::
blue
))
return
{};
// returning an empty behavior terminates the actor
return
{};
// returning an empty behavior terminates the actor
self
->
send
(
parent
,
read_atom_v
,
"http://www.example.com/index.html"
,
self
->
send
(
parent
,
read_atom_v
,
"http://www.example.com/index.html"
,
uint64_t
{
0
},
uint64_t
{
4095
});
uint64_t
{
0
},
uint64_t
{
4095
});
...
@@ -166,26 +171,29 @@ struct client_state : base_state {
...
@@ -166,26 +171,29 @@ struct client_state : base_state {
std
::
random_device
rd
;
std
::
random_device
rd
;
std
::
default_random_engine
re
;
std
::
default_random_engine
re
;
std
::
uniform_int_distribution
<
int
>
dist
;
std
::
uniform_int_distribution
<
int
>
dist
;
static
inline
const
char
*
name
=
"curl.client"
;
};
};
// spawns HTTP requests
// spawns HTTP requests
behavior
client
(
stateful_actor
<
client_state
>*
self
,
const
actor
&
parent
)
{
behavior
client
(
stateful_actor
<
client_state
>*
self
,
const
actor
&
parent
)
{
using
std
::
chrono
::
milliseconds
;
using
std
::
chrono
::
milliseconds
;
self
->
link_to
(
parent
);
self
->
link_to
(
parent
);
if
(
!
self
->
state
.
init
(
"client"
,
color
::
green
))
if
(
!
self
->
state
.
init
(
color
::
green
))
return
{};
// returning an empty behavior terminates the actor
return
{};
// returning an empty behavior terminates the actor
self
->
send
(
self
,
next_atom_v
);
self
->
send
(
self
,
next_atom_v
);
return
{[
=
](
next_atom
)
{
return
{
auto
&
st
=
self
->
state
;
[
=
](
next_atom
)
{
st
.
print
()
<<
"spawn new client_job (nr. "
<<
++
st
.
count
<<
")"
auto
&
st
=
self
->
state
;
<<
color
::
reset_endl
;
st
.
print
()
<<
"spawn new client_job (nr. "
<<
++
st
.
count
<<
")"
// client_job will use IO
<<
color
::
reset_endl
;
// and should thus be spawned in a separate thread
// client_job will use IO
self
->
spawn
<
detached
+
linked
>
(
client_job
,
parent
);
// and should thus be spawned in a separate thread
// compute random delay until next job is launched
self
->
spawn
<
detached
+
linked
>
(
client_job
,
parent
);
auto
delay
=
st
.
dist
(
st
.
re
);
// compute random delay until next job is launched
self
->
delayed_send
(
self
,
milliseconds
(
delay
),
next_atom_v
);
auto
delay
=
st
.
dist
(
st
.
re
);
}};
self
->
delayed_send
(
self
,
milliseconds
(
delay
),
next_atom_v
);
},
};
}
}
struct
curl_state
:
base_state
{
struct
curl_state
:
base_state
{
...
@@ -207,22 +215,23 @@ struct curl_state : base_state {
...
@@ -207,22 +215,23 @@ struct curl_state : base_state {
return
size
;
return
size
;
}
}
bool
init
(
std
::
string
m_
name
,
std
::
string
m_
color
)
override
{
bool
init
(
std
::
string
m_color
)
override
{
curl
=
curl_easy_init
();
curl
=
curl_easy_init
();
if
(
curl
==
nullptr
)
if
(
curl
==
nullptr
)
return
false
;
return
false
;
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
curl_state
::
callback
);
curl_easy_setopt
(
curl
,
CURLOPT_WRITEFUNCTION
,
&
curl_state
::
callback
);
curl_easy_setopt
(
curl
,
CURLOPT_NOSIGNAL
,
1
);
curl_easy_setopt
(
curl
,
CURLOPT_NOSIGNAL
,
1
);
return
base_state
::
init
(
std
::
move
(
m_
name
),
std
::
move
(
m_
color
));
return
base_state
::
init
(
std
::
move
(
m_color
));
}
}
CURL
*
curl
=
nullptr
;
CURL
*
curl
=
nullptr
;
buffer_type
buf
;
buffer_type
buf
;
static
inline
const
char
*
name
=
"curl.worker"
;
};
};
// manages a CURL session
// manages a CURL session
behavior
curl_worker
(
stateful_actor
<
curl_state
>*
self
,
const
actor
&
parent
)
{
behavior
curl_worker
(
stateful_actor
<
curl_state
>*
self
,
const
actor
&
parent
)
{
if
(
!
self
->
state
.
init
(
"curl-worker"
,
color
::
yellow
))
if
(
!
self
->
state
.
init
(
color
::
yellow
))
return
{};
// returning an empty behavior terminates the actor
return
{};
// returning an empty behavior terminates the actor
return
{[
=
](
read_atom
,
const
std
::
string
&
fname
,
uint64_t
offset
,
return
{[
=
](
read_atom
,
const
std
::
string
&
fname
,
uint64_t
offset
,
uint64_t
range
)
->
message
{
uint64_t
range
)
->
message
{
...
@@ -278,10 +287,11 @@ struct master_state : base_state {
...
@@ -278,10 +287,11 @@ struct master_state : base_state {
}
}
std
::
vector
<
actor
>
idle
;
std
::
vector
<
actor
>
idle
;
std
::
vector
<
actor
>
busy
;
std
::
vector
<
actor
>
busy
;
static
inline
const
char
*
name
=
"curl.master"
;
};
};
behavior
curl_master
(
stateful_actor
<
master_state
>*
self
)
{
behavior
curl_master
(
stateful_actor
<
master_state
>*
self
)
{
if
(
!
self
->
state
.
init
(
"curl-master"
,
color
::
magenta
))
if
(
!
self
->
state
.
init
(
color
::
magenta
))
return
{};
// returning an empty behavior terminates the actor
return
{};
// returning an empty behavior terminates the actor
// spawn workers
// spawn workers
for
(
size_t
i
=
0
;
i
<
num_curl_workers
;
++
i
)
for
(
size_t
i
=
0
;
i
<
num_curl_workers
;
++
i
)
...
...
examples/custom_type/custom_types_2.cpp
View file @
2d771bf0
// showcases how to add custom message types to CAF
// showcases how to add custom message types to CAF
// if friend access for serialization is available
// if friend access for serialization is available
#include <utility>
#include <iostream>
#include <iostream>
#include <utility>
#include "caf/all.hpp"
#include "caf/all.hpp"
...
@@ -57,11 +57,7 @@ private:
...
@@ -57,11 +57,7 @@ private:
};
};
behavior
testee
(
event_based_actor
*
self
)
{
behavior
testee
(
event_based_actor
*
self
)
{
return
{
return
{[
=
](
const
foo
&
x
)
{
aout
(
self
)
<<
deep_to_string
(
x
)
<<
endl
;
}};
[
=
](
const
foo
&
x
)
{
aout
(
self
)
<<
deep_to_string
(
x
)
<<
endl
;
}
};
}
}
void
caf_main
(
actor_system
&
sys
)
{
void
caf_main
(
actor_system
&
sys
)
{
...
...
libcaf_core/CMakeLists.txt
View file @
2d771bf0
...
@@ -253,7 +253,6 @@ caf_add_test_suites(caf-core-test
...
@@ -253,7 +253,6 @@ caf_add_test_suites(caf-core-test
detail.parser.read_string
detail.parser.read_string
detail.parser.read_timespan
detail.parser.read_timespan
detail.parser.read_unsigned_integer
detail.parser.read_unsigned_integer
detail.print
detail.ringbuffer
detail.ringbuffer
detail.ripemd_160
detail.ripemd_160
detail.serialized_size
detail.serialized_size
...
...
libcaf_core/caf/abstract_group.hpp
View file @
2d771bf0
...
@@ -75,7 +75,6 @@ public:
...
@@ -75,7 +75,6 @@ public:
return
identifier_
;
return
identifier_
;
}
}
/// @private
/// @private
const
actor
&
dispatcher
()
{
const
actor
&
dispatcher
()
{
return
dispatcher_
;
return
dispatcher_
;
...
...
libcaf_core/caf/detail/type_id_list_builder.hpp
View file @
2d771bf0
...
@@ -38,7 +38,8 @@ public:
...
@@ -38,7 +38,8 @@ public:
~
type_id_list_builder
();
~
type_id_list_builder
();
// -- modifiers ---------------------------------------------------------------
// -- modifiers
// ---------------------------------------------------------------
void
reserve
(
size_t
new_capacity
);
void
reserve
(
size_t
new_capacity
);
...
...
libcaf_core/caf/ipv6_address.hpp
View file @
2d771bf0
...
@@ -116,8 +116,7 @@ public:
...
@@ -116,8 +116,7 @@ public:
// -- inspection -------------------------------------------------------------
// -- inspection -------------------------------------------------------------
template
<
class
Inspector
>
template
<
class
Inspector
>
friend
bool
friend
bool
inspect
(
Inspector
&
f
,
ipv6_address
&
x
)
{
inspect
(
Inspector
&
f
,
ipv6_address
&
x
)
{
return
f
.
object
(
x
).
fields
(
f
.
field
(
"bytes"
,
x
.
bytes_
));
return
f
.
object
(
x
).
fields
(
f
.
field
(
"bytes"
,
x
.
bytes_
));
}
}
...
...
libcaf_core/caf/load_inspector.hpp
View file @
2d771bf0
...
@@ -293,8 +293,8 @@ public:
...
@@ -293,8 +293,8 @@ public:
template
<
class
...
Fields
>
template
<
class
...
Fields
>
bool
fields
(
Fields
&&
...
fs
)
{
bool
fields
(
Fields
&&
...
fs
)
{
using
load_callback_result
=
decltype
(
load_callback
());
using
load_callback_result
=
decltype
(
load_callback
());
if
(
!
(
f
->
begin_object
(
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
if
(
!
(
f
->
begin_object
(
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
return
false
;
return
false
;
if
constexpr
(
std
::
is_same
<
load_callback_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
<
load_callback_result
,
bool
>::
value
)
{
if
(
!
load_callback
())
{
if
(
!
load_callback
())
{
f
->
set_error
(
sec
::
load_callback_failed
);
f
->
set_error
(
sec
::
load_callback_failed
);
...
...
libcaf_core/caf/save_inspector.hpp
View file @
2d771bf0
...
@@ -189,8 +189,8 @@ public:
...
@@ -189,8 +189,8 @@ public:
template
<
class
...
Fields
>
template
<
class
...
Fields
>
bool
fields
(
Fields
&&
...
fs
)
{
bool
fields
(
Fields
&&
...
fs
)
{
using
save_callback_result
=
decltype
(
save_callback
());
using
save_callback_result
=
decltype
(
save_callback
());
if
(
!
(
f
->
begin_object
(
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
if
(
!
(
f
->
begin_object
(
object_name
)
&&
(
fs
(
*
f
)
&&
...)))
return
false
;
return
false
;
if
constexpr
(
std
::
is_same
<
save_callback_result
,
bool
>::
value
)
{
if
constexpr
(
std
::
is_same
<
save_callback_result
,
bool
>::
value
)
{
if
(
!
save_callback
())
{
if
(
!
save_callback
())
{
f
->
set_error
(
sec
::
save_callback_failed
);
f
->
set_error
(
sec
::
save_callback_failed
);
...
...
libcaf_core/caf/tracing_data_factory.hpp
View file @
2d771bf0
...
@@ -31,13 +31,12 @@ public:
...
@@ -31,13 +31,12 @@ public:
/// Deserializes tracing data from `source` and either overrides the content
/// Deserializes tracing data from `source` and either overrides the content
/// of `dst` or allocates a new object if `dst` is null.
/// of `dst` or allocates a new object if `dst` is null.
/// @returns the result of `source`.
/// @returns the result of `source`.
virtual
error
deserialize
(
deserializer
&
source
,
virtual
bool
deserialize
(
deserializer
&
source
,
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
=
0
;
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
=
0
;
/// @copydoc deserialize
/// @copydoc deserialize
virtual
error_code
<
sec
>
virtual
bool
deserialize
(
binary_deserializer
&
source
,
deserialize
(
binary_deserializer
&
source
,
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
=
0
;
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
=
0
;
};
};
}
// namespace caf
}
// namespace caf
libcaf_core/caf/type_id.hpp
View file @
2d771bf0
...
@@ -108,6 +108,13 @@ string_view type_name_or_anonymous() {
...
@@ -108,6 +108,13 @@ string_view type_name_or_anonymous() {
return
"anonymous"
;
return
"anonymous"
;
}
}
/// Returns the type name of given `type` or an empty string if `type` is an
/// invalid ID.
CAF_CORE_EXPORT
string_view
query_type_name
(
type_id_t
type
);
/// Returns the type of given `name` or `invalid_type_id` if no type matches.
CAF_CORE_EXPORT
type_id_t
query_type_id
(
string_view
name
);
}
// namespace caf
}
// namespace caf
/// Starts a code block for registering custom types to CAF. Stores the first ID
/// Starts a code block for registering custom types to CAF. Stores the first ID
...
...
libcaf_core/src/detail/parse.cpp
View file @
2d771bf0
...
@@ -247,14 +247,14 @@ void parse_element(string_parser_state& ps, std::string& x,
...
@@ -247,14 +247,14 @@ void parse_element(string_parser_state& ps, std::string& x,
parser
::
read_string
(
ps
,
make_consumer
(
x
));
parser
::
read_string
(
ps
,
make_consumer
(
x
));
return
;
return
;
}
}
auto
is_legal
auto
is_legal
=
[
=
](
char
c
)
{
=
[
=
](
char
c
)
{
return
c
!=
'\0'
&&
strchr
(
char_blacklist
,
c
)
==
nullptr
;
};
return
c
!=
'\0'
&&
strchr
(
char_blacklist
,
c
)
==
nullptr
;
};
for
(
auto
c
=
ps
.
current
();
is_legal
(
c
);
c
=
ps
.
next
())
for
(
auto
c
=
ps
.
current
();
is_legal
(
c
);
c
=
ps
.
next
())
x
+=
c
;
x
+=
c
;
while
(
!
x
.
empty
()
&&
isspace
(
x
.
back
()))
while
(
!
x
.
empty
()
&&
isspace
(
x
.
back
()))
x
.
pop_back
();
x
.
pop_back
();
ps
.
code
=
ps
.
at_end
()
?
pec
::
success
:
ps
.
code
=
ps
.
at_end
()
?
pec
::
success
:
pec
::
trailing_character
;
pec
::
trailing_character
;
}
}
// -- convenience functions ----------------------------------------------------
// -- convenience functions ----------------------------------------------------
...
...
libcaf_core/src/group_manager.cpp
View file @
2d771bf0
...
@@ -89,11 +89,9 @@ public:
...
@@ -89,11 +89,9 @@ public:
CAF_LOG_TRACE
(
""
);
// serializing who would cause a deadlock
CAF_LOG_TRACE
(
""
);
// serializing who would cause a deadlock
exclusive_guard
guard
(
mtx_
);
exclusive_guard
guard
(
mtx_
);
auto
e
=
subscribers_
.
end
();
auto
e
=
subscribers_
.
end
();
auto
cmp
=
[
&
](
const
strong_actor_ptr
&
lhs
)
{
auto
cmp
=
[
&
](
const
strong_actor_ptr
&
lhs
)
{
return
lhs
.
get
()
==
who
;
};
return
lhs
.
get
()
==
who
;
};
auto
i
=
std
::
find_if
(
subscribers_
.
begin
(),
e
,
cmp
);
auto
i
=
std
::
find_if
(
subscribers_
.
begin
(),
e
,
cmp
);
if
(
i
==
e
)
if
(
i
==
e
)
return
{
false
,
subscribers_
.
size
()};
return
{
false
,
subscribers_
.
size
()};
subscribers_
.
erase
(
i
);
subscribers_
.
erase
(
i
);
return
{
true
,
subscribers_
.
size
()};
return
{
true
,
subscribers_
.
size
()};
...
@@ -134,8 +132,7 @@ using local_group_ptr = intrusive_ptr<local_group>;
...
@@ -134,8 +132,7 @@ using local_group_ptr = intrusive_ptr<local_group>;
class
local_dispatcher
:
public
event_based_actor
{
class
local_dispatcher
:
public
event_based_actor
{
public:
public:
explicit
local_dispatcher
(
actor_config
&
cfg
,
local_group_ptr
g
)
explicit
local_dispatcher
(
actor_config
&
cfg
,
local_group_ptr
g
)
:
event_based_actor
(
cfg
),
:
event_based_actor
(
cfg
),
group_
(
std
::
move
(
g
))
{
group_
(
std
::
move
(
g
))
{
// nop
// nop
}
}
...
@@ -161,34 +158,32 @@ public:
...
@@ -161,34 +158,32 @@ public:
CAF_LOG_TRACE
(
CAF_ARG
(
dm
));
CAF_LOG_TRACE
(
CAF_ARG
(
dm
));
auto
first
=
acquaintances_
.
begin
();
auto
first
=
acquaintances_
.
begin
();
auto
last
=
acquaintances_
.
end
();
auto
last
=
acquaintances_
.
end
();
auto
i
=
std
::
find_if
(
first
,
last
,
[
&
](
const
actor
&
a
)
{
auto
i
=
std
::
find_if
(
first
,
last
,
return
a
==
dm
.
source
;
[
&
](
const
actor
&
a
)
{
return
a
==
dm
.
source
;
});
});
if
(
i
!=
last
)
if
(
i
!=
last
)
acquaintances_
.
erase
(
i
);
acquaintances_
.
erase
(
i
);
});
});
// return behavior
// return behavior
return
{
return
{[
=
](
join_atom
,
const
actor
&
other
)
{
[
=
](
join_atom
,
const
actor
&
other
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
other
));
CAF_LOG_TRACE
(
CAF_ARG
(
other
));
if
(
acquaintances_
.
insert
(
other
).
second
)
{
if
(
acquaintances_
.
insert
(
other
).
second
)
{
monitor
(
other
);
monitor
(
other
);
}
}
},
},
[
=
](
leave_atom
,
const
actor
&
other
)
{
[
=
](
leave_atom
,
const
actor
&
other
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
other
));
CAF_LOG_TRACE
(
CAF_ARG
(
other
));
acquaintances_
.
erase
(
other
);
acquaintances_
.
erase
(
other
);
if
(
acquaintances_
.
erase
(
other
)
>
0
)
if
(
acquaintances_
.
erase
(
other
)
>
0
)
demonitor
(
other
);
demonitor
(
other
);
},
},
[
=
](
forward_atom
,
const
message
&
what
)
{
[
=
](
forward_atom
,
const
message
&
what
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
what
));
CAF_LOG_TRACE
(
CAF_ARG
(
what
));
// local forwarding
// local forwarding
group_
->
send_all_subscribers
(
current_element_
->
sender
,
what
,
group_
->
send_all_subscribers
(
current_element_
->
sender
,
what
,
context
());
context
());
// forward to all acquaintances
// forward to all acquaintances
send_to_acquaintances
(
what
);
send_to_acquaintances
(
what
);
}
}};
};
}
}
private:
private:
...
@@ -216,8 +211,7 @@ using local_group_proxy_ptr = intrusive_ptr<local_group_proxy>;
...
@@ -216,8 +211,7 @@ using local_group_proxy_ptr = intrusive_ptr<local_group_proxy>;
class
proxy_dispatcher
:
public
event_based_actor
{
class
proxy_dispatcher
:
public
event_based_actor
{
public:
public:
proxy_dispatcher
(
actor_config
&
cfg
,
local_group_proxy_ptr
grp
)
proxy_dispatcher
(
actor_config
&
cfg
,
local_group_proxy_ptr
grp
)
:
event_based_actor
(
cfg
),
:
event_based_actor
(
cfg
),
group_
(
std
::
move
(
grp
))
{
group_
(
std
::
move
(
grp
))
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
}
}
...
@@ -235,9 +229,10 @@ class local_group_proxy : public local_group {
...
@@ -235,9 +229,10 @@ class local_group_proxy : public local_group {
public:
public:
local_group_proxy
(
actor_system
&
sys
,
actor
remote_dispatcher
,
local_group_proxy
(
actor_system
&
sys
,
actor
remote_dispatcher
,
local_group_module
&
mod
,
std
::
string
id
,
node_id
nid
)
local_group_module
&
mod
,
std
::
string
id
,
node_id
nid
)
:
local_group
(
mod
,
std
::
move
(
id
),
std
::
move
(
nid
),
std
::
move
(
remote_dispatcher
)),
:
local_group
(
mod
,
std
::
move
(
id
),
std
::
move
(
nid
),
proxy_dispatcher_
{
sys
.
spawn
<
proxy_dispatcher
,
hidden
>
(
this
)},
std
::
move
(
remote_dispatcher
)),
monitor_
{
sys
.
spawn
<
hidden
>
(
dispatcher_monitor_actor
,
this
)}
{
proxy_dispatcher_
{
sys
.
spawn
<
proxy_dispatcher
,
hidden
>
(
this
)},
monitor_
{
sys
.
spawn
<
hidden
>
(
dispatcher_monitor_actor
,
this
)}
{
// nop
// nop
}
}
...
@@ -264,12 +259,12 @@ public:
...
@@ -264,12 +259,12 @@ public:
}
}
}
}
void
enqueue
(
strong_actor_ptr
sender
,
message_id
mid
,
void
enqueue
(
strong_actor_ptr
sender
,
message_id
mid
,
message
msg
,
message
msg
,
execution_unit
*
eu
)
override
{
execution_unit
*
eu
)
override
{
CAF_LOG_TRACE
(
CAF_ARG
(
sender
)
<<
CAF_ARG
(
mid
)
<<
CAF_ARG
(
msg
));
CAF_LOG_TRACE
(
CAF_ARG
(
sender
)
<<
CAF_ARG
(
mid
)
<<
CAF_ARG
(
msg
));
// forward message to the dispatcher
// forward message to the dispatcher
dispatcher_
->
enqueue
(
std
::
move
(
sender
),
mid
,
dispatcher_
->
enqueue
(
std
::
move
(
sender
),
mid
,
make_message
(
forward_atom_v
,
std
::
move
(
msg
)),
eu
);
make_message
(
forward_atom_v
,
std
::
move
(
msg
)),
eu
);
}
}
void
stop
()
override
{
void
stop
()
override
{
...
@@ -279,21 +274,18 @@ public:
...
@@ -279,21 +274,18 @@ public:
private:
private:
static
behavior
dispatcher_monitor_actor
(
event_based_actor
*
self
,
static
behavior
dispatcher_monitor_actor
(
event_based_actor
*
self
,
local_group_proxy
*
grp
)
{
local_group_proxy
*
grp
)
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
""
);
self
->
monitor
(
grp
->
dispatcher_
);
self
->
monitor
(
grp
->
dispatcher_
);
self
->
set_down_handler
([
=
](
down_msg
&
down
)
{
self
->
set_down_handler
([
=
](
down_msg
&
down
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
down
));
CAF_LOG_TRACE
(
CAF_ARG
(
down
));
auto
msg
=
make_message
(
group_down_msg
{
group
(
grp
)});
auto
msg
=
make_message
(
group_down_msg
{
group
(
grp
)});
grp
->
send_all_subscribers
(
self
->
ctrl
(),
std
::
move
(
msg
),
grp
->
send_all_subscribers
(
self
->
ctrl
(),
std
::
move
(
msg
),
self
->
context
());
self
->
context
());
self
->
quit
(
down
.
reason
);
self
->
quit
(
down
.
reason
);
});
});
return
{
return
{[]
{
[]
{
// nop
// nop
}};
}
};
}
}
actor
proxy_dispatcher_
;
actor
proxy_dispatcher_
;
...
@@ -311,11 +303,9 @@ behavior proxy_dispatcher::make_behavior() {
...
@@ -311,11 +303,9 @@ behavior proxy_dispatcher::make_behavior() {
};
};
set_default_handler
(
fwd
);
set_default_handler
(
fwd
);
// return dummy behavior
// return dummy behavior
return
{
return
{[]
{
[]
{
// nop
// nop
}};
}
};
}
}
class
local_group_module
:
public
group_module
{
class
local_group_module
:
public
group_module
{
...
@@ -330,8 +320,8 @@ public:
...
@@ -330,8 +320,8 @@ public:
auto
i
=
instances_
.
find
(
identifier
);
auto
i
=
instances_
.
find
(
identifier
);
if
(
i
!=
instances_
.
end
())
if
(
i
!=
instances_
.
end
())
return
group
{
i
->
second
};
return
group
{
i
->
second
};
auto
tmp
=
make_counted
<
local_group
>
(
*
this
,
identifier
,
auto
tmp
=
make_counted
<
local_group
>
(
*
this
,
identifier
,
system
().
node
(),
system
().
node
(),
none
);
none
);
upgrade_to_unique_guard
uguard
(
guard
);
upgrade_to_unique_guard
uguard
(
guard
);
auto
p
=
instances_
.
emplace
(
identifier
,
tmp
);
auto
p
=
instances_
.
emplace
(
identifier
,
tmp
);
auto
result
=
p
.
first
->
second
;
auto
result
=
p
.
first
->
second
;
...
...
libcaf_core/src/message.cpp
View file @
2d771bf0
...
@@ -278,20 +278,19 @@ save_data(Serializer& sink, const message::data_ptr& data) {
...
@@ -278,20 +278,19 @@ save_data(Serializer& sink, const message::data_ptr& data) {
&&
sink
.
end_sequence
()
//
&&
sink
.
end_sequence
()
//
&&
sink
.
end_field
()
//
&&
sink
.
end_field
()
//
&&
sink
.
end_object
();
&&
sink
.
end_object
();
}
}
auto
type_ids
=
data
->
types
();
auto
type_ids
=
data
->
types
();
GUARDED
(
sink
.
begin_object
(
"message"
)
//
GUARDED
(
sink
.
begin_object
(
"message"
)
//
&&
sink
.
begin_field
(
"values"
)
//
&&
sink
.
begin_field
(
"values"
)
//
&&
sink
.
begin_sequence
(
type_ids
.
size
()));
&&
sink
.
begin_sequence
(
type_ids
.
size
()));
auto
storage
=
data
->
storage
();
auto
storage
=
data
->
storage
();
for
(
auto
id
:
type_ids
)
{
for
(
auto
id
:
type_ids
)
{
auto
&
meta
=
gmos
[
id
];
auto
&
meta
=
gmos
[
id
];
GUARDED
(
sink
.
inject_next_object_type
(
id
)
//
GUARDED
(
sink
.
inject_next_object_type
(
id
)
//
&&
save
(
meta
,
sink
,
storage
));
&&
save
(
meta
,
sink
,
storage
));
storage
+=
meta
.
padded_size
;
storage
+=
meta
.
padded_size
;
}
}
return
sink
.
end_sequence
()
&&
sink
.
end_field
()
&&
sink
.
end_object
();
return
sink
.
end_sequence
()
&&
sink
.
end_field
()
&&
sink
.
end_object
();
}
}
}
// namespace
}
// namespace
...
...
libcaf_core/src/tracing_data.cpp
View file @
2d771bf0
...
@@ -36,31 +36,64 @@ tracing_data::~tracing_data() {
...
@@ -36,31 +36,64 @@ tracing_data::~tracing_data() {
// nop
// nop
}
}
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
tracing_data
&
x
)
{
return
x
.
serialize
(
f
);
}
namespace
{
namespace
{
using
access
=
optional_inspector_access
<
tracing_data_ptr
>
;
template
<
class
Serializer
>
bool
serialize_impl
(
Serializer
&
sink
,
const
tracing_data_ptr
&
x
)
{
if
(
!
x
)
{
return
sink
.
begin_object
(
"tracing_data"
)
//
&&
sink
.
begin_field
(
"value"
,
false
)
//
&&
sink
.
end_field
()
//
&&
sink
.
end_object
();
}
return
sink
.
begin_object
(
"tracing_data"
)
//
&&
sink
.
begin_field
(
"value"
,
true
)
//
&&
x
->
serialize
(
sink
)
//
&&
sink
.
end_field
()
//
&&
sink
.
end_object
();
}
template
<
class
Deserializer
>
bool
deserialize_impl
(
Deserializer
&
source
,
tracing_data_ptr
&
x
)
{
bool
is_present
=
false
;
if
(
!
source
.
begin_object
(
"tracing_data"
)
||
!
source
.
begin_field
(
"value"
,
is_present
))
return
false
;
if
(
!
is_present
)
return
source
.
end_field
()
&&
source
.
end_object
();
auto
ctx
=
source
.
context
();
if
(
ctx
==
nullptr
)
{
source
.
emplace_error
(
sec
::
no_context
,
"cannot deserialize tracing data without context"
);
return
false
;
}
auto
tc
=
ctx
->
system
().
tracing_context
();
if
(
tc
==
nullptr
)
{
source
.
emplace_error
(
sec
::
no_tracing_context
,
"cannot deserialize tracing data without context"
);
return
false
;
}
return
tc
->
deserialize
(
source
,
x
)
//
&&
source
.
end_field
()
//
&&
source
.
end_object
();
}
}
// namespace
}
// namespace
bool
inspect
(
serializer
&
sink
,
const
tracing_data_ptr
&
x
)
{
bool
inspect
(
serializer
&
sink
,
const
tracing_data_ptr
&
x
)
{
return
access
::
apply_object
(
sink
,
detail
::
as_mutable_ref
(
x
)
);
return
serialize_impl
(
sink
,
x
);
}
}
bool
inspect
(
binary_serializer
&
sink
,
const
tracing_data_ptr
&
x
)
{
bool
inspect
(
binary_serializer
&
sink
,
const
tracing_data_ptr
&
x
)
{
return
access
::
apply_object
(
sink
,
detail
::
as_mutable_ref
(
x
)
);
return
serialize_impl
(
sink
,
x
);
}
}
bool
inspect
(
deserializer
&
source
,
tracing_data_ptr
&
x
)
{
bool
inspect
(
deserializer
&
source
,
tracing_data_ptr
&
x
)
{
return
access
::
apply_object
(
source
,
x
);
return
deserialize_impl
(
source
,
x
);
}
}
bool
inspect
(
binary_deserializer
&
source
,
tracing_data_ptr
&
x
)
{
bool
inspect
(
binary_deserializer
&
source
,
tracing_data_ptr
&
x
)
{
return
access
::
apply_object
(
source
,
x
);
return
deserialize_impl
(
source
,
x
);
}
}
}
// namespace caf
}
// namespace caf
libcaf_core/test/actor_profiler.cpp
View file @
2d771bf0
...
@@ -169,11 +169,11 @@ CAF_TEST(profilers record asynchronous messaging) {
...
@@ -169,11 +169,11 @@ CAF_TEST(profilers record asynchronous messaging) {
CAF_CHECK_EQUAL
(
string_list
({
CAF_CHECK_EQUAL
(
string_list
({
"new: foo"
,
"new: foo"
,
"new: bar, parent: foo"
,
"new: bar, parent: foo"
,
"foo sends:
(
\"
hello bar
\"
)"
,
"foo sends:
message(std::string(
\"
hello bar
\"
)
)"
,
"bar got:
(
\"
hello bar
\"
)"
,
"bar got:
message(std::string(
\"
hello bar
\"
)
)"
,
"bar sends:
(
\"
hello foo
\"
)"
,
"bar sends:
message(std::string(
\"
hello foo
\"
)
)"
,
"bar consumed the message"
,
"bar consumed the message"
,
"foo got:
(
\"
hello foo
\"
)"
,
"foo got:
message(std::string(
\"
hello foo
\"
)
)"
,
"delete: bar"
,
"delete: bar"
,
"foo consumed the message"
,
"foo consumed the message"
,
"delete: foo"
,
"delete: foo"
,
...
@@ -210,15 +210,15 @@ CAF_TEST(profilers record request / response messaging) {
...
@@ -210,15 +210,15 @@ CAF_TEST(profilers record request / response messaging) {
"new: worker"
,
"new: worker"
,
"new: server"
,
"new: server"
,
"new: client"
,
"new: client"
,
"client sends:
(19, 23
)"
,
"client sends:
message(int32_t(19), int32_t(23)
)"
,
"server got:
(19, 23
)"
,
"server got:
message(int32_t(19), int32_t(23)
)"
,
"server sends:
(19, 23
)"
,
"server sends:
message(int32_t(19), int32_t(23)
)"
,
"server consumed the message"
,
"server consumed the message"
,
"delete: server"
,
"delete: server"
,
"worker got:
(19, 23
)"
,
"worker got:
message(int32_t(19), int32_t(23)
)"
,
"worker sends:
(42
)"
,
"worker sends:
message(int32_t(42)
)"
,
"worker consumed the message"
,
"worker consumed the message"
,
"client got:
(42
)"
,
"client got:
message(int32_t(42)
)"
,
"client consumed the message"
,
"client consumed the message"
,
"delete: worker"
,
"delete: worker"
,
"delete: client"
,
"delete: client"
,
...
...
libcaf_core/test/detail/print.cpp
deleted
100644 → 0
View file @
1fdc78ce
/******************************************************************************
* ____ _ _____ *
* / ___| / \ | ___| C++ *
* | | / _ \ | |_ Actor *
* | |___ / ___ \| _| Framework *
* \____/_/ \_|_| *
* *
* Copyright 2011-2020 Dominik Charousset *
* *
* Distributed under the terms and conditions of the BSD 3-Clause License or *
* (at your option) under the terms and conditions of the Boost Software *
* License 1.0. See accompanying files LICENSE and LICENSE_ALTERNATIVE. *
* *
* If you did not receive a copy of the license files, see *
* http://opensource.org/licenses/BSD-3-Clause and *
* http://www.boost.org/LICENSE_1_0.txt. *
******************************************************************************/
#define CAF_SUITE detail.print
#include "caf/detail/print.hpp"
#include "caf/test/dsl.hpp"
using
namespace
caf
;
namespace
{
struct
fixture
{
};
}
// namespace
CAF_TEST_FIXTURE_SCOPE
(
print_tests
,
fixture
)
CAF_TEST
(
todo
)
{
// implement me
}
CAF_TEST_FIXTURE_SCOPE_END
()
libcaf_core/test/message.cpp
View file @
2d771bf0
...
@@ -32,10 +32,10 @@
...
@@ -32,10 +32,10 @@
#include "caf/type_id.hpp"
#include "caf/type_id.hpp"
#include "caf/type_id_list.hpp"
#include "caf/type_id_list.hpp"
using
std
::
make_tuple
;
using
std
::
map
;
using
std
::
map
;
using
std
::
string
;
using
std
::
string
;
using
std
::
vector
;
using
std
::
vector
;
using
std
::
make_tuple
;
using
namespace
caf
;
using
namespace
caf
;
...
@@ -92,8 +92,9 @@ CAF_TEST(to_string converts messages to strings) {
...
@@ -92,8 +92,9 @@ CAF_TEST(to_string converts messages to strings) {
CAF_CHECK_EQUAL
(
msg_as_string
(),
"message()"
);
CAF_CHECK_EQUAL
(
msg_as_string
(),
"message()"
);
CAF_CHECK_EQUAL
(
msg_as_string
(
"hello"
,
"world"
),
CAF_CHECK_EQUAL
(
msg_as_string
(
"hello"
,
"world"
),
R"__(message(std::string(hello), std::string(world)))__"
);
R"__(message(std::string(hello), std::string(world)))__"
);
CAF_CHECK_EQUAL
(
msg_as_string
(
svec
{
"one"
,
"two"
,
"three"
}),
CAF_CHECK_EQUAL
(
R"__(message(std::vector<std::string>([one, two, three])))__"
);
msg_as_string
(
svec
{
"one"
,
"two"
,
"three"
}),
R"__(message(std::vector<std::string>([one, two, three])))__"
);
CAF_CHECK_EQUAL
(
CAF_CHECK_EQUAL
(
msg_as_string
(
svec
{
"one"
,
"two"
},
"three"
,
"four"
,
msg_as_string
(
svec
{
"one"
,
"two"
},
"three"
,
"four"
,
svec
{
"five"
,
"six"
,
"seven"
}),
svec
{
"five"
,
"six"
,
"seven"
}),
...
...
libcaf_core/test/save_inspector.cpp
View file @
2d771bf0
...
@@ -48,7 +48,7 @@ struct basics;
...
@@ -48,7 +48,7 @@ struct basics;
template <> \
template <> \
struct type_name<type> { \
struct type_name<type> { \
static constexpr string_view value = #type; \
static constexpr string_view value = #type; \
};
\
}; \
}
}
CAF_TYPE_NAME
(
point_3d
)
CAF_TYPE_NAME
(
point_3d
)
...
@@ -116,7 +116,6 @@ bool inspect(Inspector& f, person& x) {
...
@@ -116,7 +116,6 @@ bool inspect(Inspector& f, person& x) {
class
foobar
{
class
foobar
{
public:
public:
const
std
::
string
&
foo
()
{
const
std
::
string
&
foo
()
{
return
foo_
;
return
foo_
;
}
}
...
...
libcaf_core/test/settings.cpp
View file @
2d771bf0
...
@@ -209,7 +209,6 @@ CAF_TEST(custom type) {
...
@@ -209,7 +209,6 @@ CAF_TEST(custom type) {
CAF_TEST
(
read_config
accepts
the
to_string
output
of
settings
)
{
CAF_TEST
(
read_config
accepts
the
to_string
output
of
settings
)
{
fill
();
fill
();
auto
str
=
to_string
(
x
);
auto
str
=
to_string
(
x
);
printf
(
"%s
\n
"
,
str
.
c_str
());
settings
y
;
settings
y
;
config_option_set
dummy
;
config_option_set
dummy
;
detail
::
config_consumer
consumer
{
dummy
,
y
};
detail
::
config_consumer
consumer
{
dummy
,
y
};
...
...
libcaf_core/test/tracing_data.cpp
View file @
2d771bf0
...
@@ -46,38 +46,36 @@ public:
...
@@ -46,38 +46,36 @@ public:
// nop
// nop
}
}
error
serialize
(
serializer
&
sink
)
const
override
{
bool
serialize
(
serializer
&
sink
)
const
override
{
return
sink
(
value
);
return
inspect_object
(
sink
,
value
);
}
}
error_code
<
sec
>
serialize
(
binary_serializer
&
sink
)
const
override
{
bool
serialize
(
binary_serializer
&
sink
)
const
override
{
return
sink
(
value
);
return
inspect_object
(
sink
,
value
);
}
}
};
};
class
dummy_tracing_data_factory
:
public
tracing_data_factory
{
class
dummy_tracing_data_factory
:
public
tracing_data_factory
{
public:
public:
error
deserialize
(
deserializer
&
source
,
bool
deserialize
(
deserializer
&
source
,
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
override
{
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
override
{
return
deserialize_impl
(
source
,
dst
);
return
deserialize_impl
(
source
,
dst
);
}
}
error_code
<
sec
>
bool
deserialize
(
binary_deserializer
&
source
,
deserialize
(
binary_deserializer
&
source
,
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
override
{
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
override
{
return
deserialize_impl
(
source
,
dst
);
return
deserialize_impl
(
source
,
dst
);
}
}
private:
private:
template
<
class
Deserializer
>
template
<
class
Deserializer
>
typename
Deserializer
::
result_type
bool
deserialize_impl
(
Deserializer
&
source
,
deserialize_impl
(
Deserializer
&
source
,
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
{
std
::
unique_ptr
<
tracing_data
>&
dst
)
const
{
string
value
;
string
value
;
if
(
auto
err
=
source
(
value
))
if
(
!
inspect_object
(
source
,
value
))
return
err
;
return
false
;
dst
.
reset
(
new
dummy_tracing_data
(
std
::
move
(
value
)));
dst
.
reset
(
new
dummy_tracing_data
(
std
::
move
(
value
)));
return
{}
;
return
true
;
}
}
};
};
...
@@ -194,12 +192,11 @@ CAF_TEST(profilers inject tracing data into asynchronous messages) {
...
@@ -194,12 +192,11 @@ CAF_TEST(profilers inject tracing data into asynchronous messages) {
CAF_TEST
(
tracing
data
is
serializable
)
{
CAF_TEST
(
tracing
data
is
serializable
)
{
byte_buffer
buf
;
byte_buffer
buf
;
binary_serializer
sink
{
sys
,
buf
};
binary_serializer
sink
{
sys
,
buf
};
tracing_data_ptr
data
;
tracing_data_ptr
data
{
new
dummy_tracing_data
(
"iTrace"
)};
tracing_data_ptr
copy
;
CAF_CHECK
(
inspect_object
(
sink
,
data
));
data
.
reset
(
new
dummy_tracing_data
(
"iTrace"
));
CAF_CHECK_EQUAL
(
sink
(
data
),
none
);
binary_deserializer
source
{
sys
,
buf
};
binary_deserializer
source
{
sys
,
buf
};
CAF_CHECK_EQUAL
(
source
(
copy
),
none
);
tracing_data_ptr
copy
;
CAF_CHECK
(
inspect_object
(
source
,
copy
));
CAF_REQUIRE_NOT_EQUAL
(
copy
.
get
(),
nullptr
);
CAF_REQUIRE_NOT_EQUAL
(
copy
.
get
(),
nullptr
);
CAF_CHECK_EQUAL
(
dynamic_cast
<
dummy_tracing_data
&>
(
*
copy
).
value
,
"iTrace"
);
CAF_CHECK_EQUAL
(
dynamic_cast
<
dummy_tracing_data
&>
(
*
copy
).
value
,
"iTrace"
);
}
}
...
...
libcaf_io/test/io/basp_broker.cpp
View file @
2d771bf0
...
@@ -109,8 +109,8 @@ public:
...
@@ -109,8 +109,8 @@ public:
.
set
(
"caf.middleman.enable-automatic-connections"
,
autoconn
)
.
set
(
"caf.middleman.enable-automatic-connections"
,
autoconn
)
.
set
(
"caf.middleman.workers"
,
size_t
{
0
})
.
set
(
"caf.middleman.workers"
,
size_t
{
0
})
.
set
(
"caf.scheduler.policy"
,
autoconn
?
"testing"
:
"stealing"
)
.
set
(
"caf.scheduler.policy"
,
autoconn
?
"testing"
:
"stealing"
)
.
set
(
"caf.logger.inline-output"
,
true
)
.
set
(
"caf.logger.inline-output"
,
true
)
.
set
(
"caf.logger.console.verbosity"
,
"debug"
)
.
set
(
"caf.logger.console.verbosity"
,
"debug"
)
.
set
(
"caf.middleman.attach-utility-actors"
,
autoconn
))
{
.
set
(
"caf.middleman.attach-utility-actors"
,
autoconn
))
{
app_ids
.
emplace_back
(
to_string
(
defaults
::
middleman
::
app_identifier
));
app_ids
.
emplace_back
(
to_string
(
defaults
::
middleman
::
app_identifier
));
auto
&
mm
=
sys
.
middleman
();
auto
&
mm
=
sys
.
middleman
();
...
...
tools/caf-vec.cpp
View file @
2d771bf0
...
@@ -208,9 +208,10 @@ struct entity {
...
@@ -208,9 +208,10 @@ struct entity {
template
<
class
Inspector
>
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
entity
&
x
)
{
bool
inspect
(
Inspector
&
f
,
entity
&
x
)
{
return
f
(
f
.
field
(
"aid"
,
x
.
aid
),
f
.
field
(
"tid"
,
x
.
tid
),
f
.
field
(
"nid"
,
x
.
nid
),
return
f
.
object
(
x
).
fields
(
f
.
field
(
"aid"
,
x
.
aid
),
f
.
field
(
"tid"
,
x
.
tid
),
f
.
field
(
"vid"
,
x
.
vid
),
f
.
field
(
"hidden"
,
x
.
hidden
),
f
.
field
(
"nid"
,
x
.
nid
),
f
.
field
(
"vid"
,
x
.
vid
),
f
.
field
(
"pretty_name"
,
x
.
pretty_name
));
f
.
field
(
"hidden"
,
x
.
hidden
),
f
.
field
(
"pretty_name"
,
x
.
pretty_name
));
}
}
mailbox_id
to_mailbox_id
(
const
entity
&
x
)
{
mailbox_id
to_mailbox_id
(
const
entity
&
x
)
{
...
@@ -424,11 +425,11 @@ struct se_event {
...
@@ -424,11 +425,11 @@ struct se_event {
string
to_string
(
const
se_event
&
x
)
{
string
to_string
(
const
se_event
&
x
)
{
string
res
;
string
res
;
res
+=
"node{"
;
res
+=
"node{"
;
res
+=
to_string
(
*
x
.
source
);
res
+=
deep_
to_string
(
*
x
.
source
);
res
+=
", "
;
res
+=
", "
;
res
+=
deep_to_string
(
x
.
vstamp
);
res
+=
deep_to_string
(
x
.
vstamp
);
res
+=
", "
;
res
+=
", "
;
res
+=
to_string
(
x
.
type
);
res
+=
deep_
to_string
(
x
.
type
);
res
+=
", "
;
res
+=
", "
;
res
+=
deep_to_string
(
x
.
fields
);
res
+=
deep_to_string
(
x
.
fields
);
res
+=
"}"
;
res
+=
"}"
;
...
...
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