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
232033c4
Commit
232033c4
authored
Aug 21, 2019
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename {dispatcher => write_packet_decorator}
parent
aee508be
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
40 deletions
+19
-40
libcaf_net/caf/net/write_packet_decorator.hpp
libcaf_net/caf/net/write_packet_decorator.hpp
+19
-40
No files found.
libcaf_net/caf/net/
dispatche
r.hpp
→
libcaf_net/caf/net/
write_packet_decorato
r.hpp
View file @
232033c4
...
@@ -22,70 +22,49 @@ namespace caf {
...
@@ -22,70 +22,49 @@ namespace caf {
namespace
net
{
namespace
net
{
/// Implements the interface for transport and application policies and
/// Implements the interface for transport and application policies and
/// dispatches member functions either to `decorator` or `
fallback
`.
/// dispatches member functions either to `decorator` or `
parent
`.
template
<
class
Decorator
,
class
Fallback
>
template
<
class
Object
,
class
Parent
>
class
dispatche
r
{
class
write_packet_decorato
r
{
public:
public:
dispatcher
(
Decorator
&
decorator
,
Fallback
&
fallback
)
dispatcher
(
Object
&
object
,
Parent
&
parent
)
:
decorator_
(
decorator
),
fallback_
(
fallback
)
{
:
object_
(
object
),
parent_
(
parent
)
{
// nop
// nop
}
}
template
<
class
Header
>
template
<
class
Header
>
void
write_packet
(
const
Header
&
header
,
span
<
const
byte
>
payload
)
{
void
write_packet
(
const
Header
&
header
,
span
<
const
byte
>
payload
)
{
decltype
(
write_packet_delegate_test
<
Decorator
>
(
nullptr
,
header
,
payload
))
x
;
object_
.
write_packet
(
parent_
,
header
,
payload
);
write_packet_delegate
(
x
,
header
,
payload
);
}
}
actor_system
&
system
()
{
actor_system
&
system
()
{
fallback
_
.
system
();
parent
_
.
system
();
}
}
void
cancel_timeout
(
atom_value
type
,
uint64_t
id
)
{
void
cancel_timeout
(
atom_value
type
,
uint64_t
id
)
{
fallback
_
.
cancel_timeout
(
type
,
id
);
parent
_
.
cancel_timeout
(
type
,
id
);
}
}
void
set_timeout
(
timestamp
tout
,
atom_value
type
,
uint64_t
id
)
{
void
set_timeout
(
timestamp
tout
,
atom_value
type
,
uint64_t
id
)
{
fallback
_
.
set_timeout
(
tout
,
type
,
id
);
parent
_
.
set_timeout
(
tout
,
type
,
id
);
}
}
typename
Fallback
::
transport_type
&
transport
()
{
typename
parent
::
transport_type
&
transport
()
{
return
fallback
_
.
transport_
;
return
parent
_
.
transport_
;
}
}
typename
Fallback
::
application_type
&
application
()
{
typename
parent
::
application_type
&
application
()
{
return
fallback
_
.
application_
;
return
parent
_
.
application_
;
}
}
private:
private:
template
<
class
U
,
class
Header
>
Object
&
object_
;
static
auto
write_packet_delegate_test
(
U
*
x
,
const
Header
&
hdr
,
Parent
&
parent_
;
span
<
const
byte
>
payload
)
->
decltype
(
x
->
write_packet
(
hdr
,
payload
),
std
::
true_type
());
template
<
class
U
>
static
auto
write_packet_delegate_test
(...)
->
std
::
false_type
;
template
<
class
Header
>
void
write_packet_delegate
(
std
::
true_type
,
const
Header
&
header
,
span
<
const
byte
>
payload
)
{
decorator_
.
write_packet
(
header
,
payload
);
}
template
<
class
Header
>
void
write_packet_delegate
(
std
::
false_type
,
const
Header
&
header
,
span
<
const
byte
>
payload
)
{
fallback_
.
write_packet
(
header
,
payload
);
}
Object
&
decorator_
;
Fallback
&
fallback_
;
};
};
template
<
class
Decorator
,
class
Fallback
>
template
<
class
Object
,
class
Parent
>
dispatcher
<
Decorator
,
Fallback
>
make_dispatcher
(
Decorator
&
decorator
,
write_packet_decorator
<
Object
,
Parent
>
Fallback
&
fallback
)
{
make_write_packet_decorator
(
Object
&
object
,
Parent
&
parent
)
{
return
{
decorator
,
fallback
};
return
{
object
,
parent
};
}
}
}
// namespace net
}
// namespace net
...
...
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