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
53f4dacb
Commit
53f4dacb
authored
Mar 18, 2015
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coding style: no more `using namespace std`
parent
22f1a137
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
33 additions
and
35 deletions
+33
-35
examples/brokers/simple_broker.cpp
examples/brokers/simple_broker.cpp
+11
-5
examples/hello_world.cpp
examples/hello_world.cpp
+3
-1
examples/message_passing/dining_philosophers.cpp
examples/message_passing/dining_philosophers.cpp
+3
-1
libcaf_core/src/actor_proxy.cpp
libcaf_core/src/actor_proxy.cpp
+0
-2
libcaf_core/src/behavior_stack.cpp
libcaf_core/src/behavior_stack.cpp
+0
-2
libcaf_core/src/forwarding_actor_proxy.cpp
libcaf_core/src/forwarding_actor_proxy.cpp
+0
-2
libcaf_core/src/get_mac_addresses.cpp
libcaf_core/src/get_mac_addresses.cpp
+4
-8
libcaf_core/src/get_root_uuid.cpp
libcaf_core/src/get_root_uuid.cpp
+7
-6
libcaf_core/src/memory.cpp
libcaf_core/src/memory.cpp
+5
-7
libcaf_io/src/default_multiplexer.cpp
libcaf_io/src/default_multiplexer.cpp
+0
-1
No files found.
examples/brokers/simple_broker.cpp
View file @
53f4dacb
...
@@ -25,7 +25,10 @@
...
@@ -25,7 +25,10 @@
#include "caf/all.hpp"
#include "caf/all.hpp"
#include "caf/io/all.hpp"
#include "caf/io/all.hpp"
using
namespace
std
;
using
std
::
cout
;
using
std
::
cerr
;
using
std
::
endl
;
using
namespace
caf
;
using
namespace
caf
;
using
namespace
caf
::
io
;
using
namespace
caf
::
io
;
...
@@ -35,13 +38,13 @@ using kickoff_atom = atom_constant<atom("kickoff")>;
...
@@ -35,13 +38,13 @@ using kickoff_atom = atom_constant<atom("kickoff")>;
// utility function to print an exit message with custom name
// utility function to print an exit message with custom name
void
print_on_exit
(
const
actor
&
ptr
,
const
std
::
string
&
name
)
{
void
print_on_exit
(
const
actor
&
ptr
,
const
std
::
string
&
name
)
{
ptr
->
attach_functor
([
=
](
std
::
uint32_t
reason
)
{
ptr
->
attach_functor
([
=
](
uint32_t
reason
)
{
aout
(
ptr
)
<<
name
<<
" exited with reason "
<<
reason
<<
endl
;
aout
(
ptr
)
<<
name
<<
" exited with reason "
<<
reason
<<
endl
;
});
});
}
}
behavior
ping
(
event_based_actor
*
self
,
size_t
num_pings
)
{
behavior
ping
(
event_based_actor
*
self
,
size_t
num_pings
)
{
auto
count
=
make_shared
<
size_t
>
(
0
);
auto
count
=
std
::
make_shared
<
size_t
>
(
0
);
return
{
return
{
[
=
](
kickoff_atom
,
const
actor
&
pong
)
{
[
=
](
kickoff_atom
,
const
actor
&
pong
)
{
self
->
send
(
pong
,
ping_atom
::
value
,
int32_t
(
1
));
self
->
send
(
pong
,
ping_atom
::
value
,
int32_t
(
1
));
...
@@ -149,7 +152,8 @@ behavior broker_impl(broker* self, connection_handle hdl, const actor& buddy) {
...
@@ -149,7 +152,8 @@ behavior broker_impl(broker* self, connection_handle hdl, const actor& buddy) {
self
->
send
(
buddy
,
atm
,
ival
);
self
->
send
(
buddy
,
atm
,
ival
);
},
},
others
>>
[
=
]
{
others
>>
[
=
]
{
cout
<<
"unexpected: "
<<
to_string
(
self
->
current_message
())
<<
endl
;
aout
(
self
)
<<
"unexpected: "
<<
to_string
(
self
->
current_message
())
<<
endl
;
}
}
};
};
}
}
...
@@ -167,7 +171,8 @@ behavior server(broker* self, const actor& buddy) {
...
@@ -167,7 +171,8 @@ behavior server(broker* self, const actor& buddy) {
self
->
quit
();
self
->
quit
();
},
},
others
>>
[
=
]
{
others
>>
[
=
]
{
cout
<<
"unexpected: "
<<
to_string
(
self
->
current_message
())
<<
endl
;
aout
(
self
)
<<
"unexpected: "
<<
to_string
(
self
->
current_message
())
<<
endl
;
}
}
};
};
}
}
...
@@ -177,6 +182,7 @@ optional<uint16_t> as_u16(const std::string& str) {
...
@@ -177,6 +182,7 @@ optional<uint16_t> as_u16(const std::string& str) {
}
}
int
main
(
int
argc
,
char
**
argv
)
{
int
main
(
int
argc
,
char
**
argv
)
{
using
std
::
string
;
message_builder
{
argv
+
1
,
argv
+
argc
}.
apply
({
message_builder
{
argv
+
1
,
argv
+
argc
}.
apply
({
on
(
"-s"
,
as_u16
)
>>
[
&
](
uint16_t
port
)
{
on
(
"-s"
,
as_u16
)
>>
[
&
](
uint16_t
port
)
{
cout
<<
"run in server mode"
<<
endl
;
cout
<<
"run in server mode"
<<
endl
;
...
...
examples/hello_world.cpp
View file @
53f4dacb
...
@@ -3,7 +3,9 @@
...
@@ -3,7 +3,9 @@
#include "caf/all.hpp"
#include "caf/all.hpp"
using
namespace
std
;
using
std
::
endl
;
using
std
::
string
;
using
namespace
caf
;
using
namespace
caf
;
behavior
mirror
(
event_based_actor
*
self
)
{
behavior
mirror
(
event_based_actor
*
self
)
{
...
...
examples/message_passing/dining_philosophers.cpp
View file @
53f4dacb
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
#include "caf/all.hpp"
#include "caf/all.hpp"
using
std
::
cout
;
using
std
::
cerr
;
using
std
::
endl
;
using
std
::
chrono
::
seconds
;
using
std
::
chrono
::
seconds
;
using
namespace
std
;
using
namespace
caf
;
using
namespace
caf
;
namespace
{
namespace
{
...
...
libcaf_core/src/actor_proxy.cpp
View file @
53f4dacb
...
@@ -29,8 +29,6 @@
...
@@ -29,8 +29,6 @@
#include "caf/detail/singletons.hpp"
#include "caf/detail/singletons.hpp"
using
namespace
std
;
namespace
caf
{
namespace
caf
{
actor_proxy
::
anchor
::
anchor
(
actor_proxy
*
instance
)
:
m_ptr
(
instance
)
{
actor_proxy
::
anchor
::
anchor
(
actor_proxy
*
instance
)
:
m_ptr
(
instance
)
{
...
...
libcaf_core/src/behavior_stack.cpp
View file @
53f4dacb
...
@@ -23,8 +23,6 @@
...
@@ -23,8 +23,6 @@
#include "caf/local_actor.hpp"
#include "caf/local_actor.hpp"
#include "caf/detail/behavior_stack.hpp"
#include "caf/detail/behavior_stack.hpp"
using
namespace
std
;
namespace
caf
{
namespace
caf
{
namespace
detail
{
namespace
detail
{
...
...
libcaf_core/src/forwarding_actor_proxy.cpp
View file @
53f4dacb
...
@@ -25,8 +25,6 @@
...
@@ -25,8 +25,6 @@
#include "caf/detail/logging.hpp"
#include "caf/detail/logging.hpp"
using
namespace
std
;
namespace
caf
{
namespace
caf
{
forwarding_actor_proxy
::
forwarding_actor_proxy
(
actor_id
aid
,
node_id
nid
,
forwarding_actor_proxy
::
forwarding_actor_proxy
(
actor_id
aid
,
node_id
nid
,
...
...
libcaf_core/src/get_mac_addresses.cpp
View file @
53f4dacb
...
@@ -51,7 +51,7 @@ std::vector<iface_info> get_mac_addresses() {
...
@@ -51,7 +51,7 @@ std::vector<iface_info> get_mac_addresses() {
auto
ifm
=
reinterpret_cast
<
if_msghdr
*>
(
buf
.
get
());
auto
ifm
=
reinterpret_cast
<
if_msghdr
*>
(
buf
.
get
());
auto
sdl
=
reinterpret_cast
<
sockaddr_dl
*>
(
ifm
+
1
);
auto
sdl
=
reinterpret_cast
<
sockaddr_dl
*>
(
ifm
+
1
);
auto
ptr
=
reinterpret_cast
<
unsigned
char
*>
(
LLADDR
(
sdl
));
auto
ptr
=
reinterpret_cast
<
unsigned
char
*>
(
LLADDR
(
sdl
));
auto
uctoi
=
[](
unsigned
char
c
)
->
unsigned
{
auto
uctoi
=
[](
unsigned
char
c
)
->
unsigned
{
return
static_cast
<
unsigned
char
>
(
c
);
return
static_cast
<
unsigned
char
>
(
c
);
};
};
std
::
ostringstream
oss
;
std
::
ostringstream
oss
;
...
@@ -95,8 +95,6 @@ std::vector<iface_info> get_mac_addresses() {
...
@@ -95,8 +95,6 @@ std::vector<iface_info> get_mac_addresses() {
#include <unistd.h>
#include <unistd.h>
#include <iostream>
#include <iostream>
using
namespace
std
;
namespace
caf
{
namespace
caf
{
namespace
detail
{
namespace
detail
{
...
@@ -116,8 +114,8 @@ std::vector<iface_info> get_mac_addresses() {
...
@@ -116,8 +114,8 @@ std::vector<iface_info> get_mac_addresses() {
perror
(
"ioctl(SIOCGIFCONF)"
);
perror
(
"ioctl(SIOCGIFCONF)"
);
return
{};
return
{};
}
}
vector
<
iface_info
>
result
;
std
::
vector
<
iface_info
>
result
;
auto
ctoi
=
[](
char
c
)
->
unsigned
{
auto
ctoi
=
[](
char
c
)
->
unsigned
{
return
static_cast
<
unsigned
char
>
(
c
);
return
static_cast
<
unsigned
char
>
(
c
);
};
};
// iterate through interfaces
// iterate through interfaces
...
@@ -187,14 +185,12 @@ struct c_free {
...
@@ -187,14 +185,12 @@ struct c_free {
}
// namespace <anonymous>
}
// namespace <anonymous>
using
namespace
std
;
namespace
caf
{
namespace
caf
{
namespace
detail
{
namespace
detail
{
std
::
vector
<
iface_info
>
get_mac_addresses
()
{
std
::
vector
<
iface_info
>
get_mac_addresses
()
{
// result vector
// result vector
vector
<
iface_info
>
result
;
std
::
vector
<
iface_info
>
result
;
// flags to pass to GetAdaptersAddresses
// flags to pass to GetAdaptersAddresses
ULONG
flags
=
GAA_FLAG_INCLUDE_PREFIX
;
ULONG
flags
=
GAA_FLAG_INCLUDE_PREFIX
;
// default to unspecified address family (both)
// default to unspecified address family (both)
...
...
libcaf_core/src/get_root_uuid.cpp
View file @
53f4dacb
...
@@ -153,8 +153,6 @@ std::string get_root_uuid() {
...
@@ -153,8 +153,6 @@ std::string get_root_uuid() {
#include <windows.h>
#include <windows.h>
#include <tchar.h>
#include <tchar.h>
using
namespace
std
;
namespace
caf
{
namespace
caf
{
namespace
detail
{
namespace
detail
{
...
@@ -163,7 +161,9 @@ constexpr size_t max_drive_name = MAX_PATH;
...
@@ -163,7 +161,9 @@ constexpr size_t max_drive_name = MAX_PATH;
}
}
// if TCHAR is indeed a char, we can simply move rhs
// if TCHAR is indeed a char, we can simply move rhs
void
mv
(
std
::
string
&
lhs
,
std
::
string
&&
rhs
)
{
lhs
=
std
::
move
(
rhs
);
}
void
mv
(
std
::
string
&
lhs
,
std
::
string
&&
rhs
)
{
lhs
=
std
::
move
(
rhs
);
}
// if TCHAR is defined as WCHAR, we have to do unicode conversion
// if TCHAR is defined as WCHAR, we have to do unicode conversion
void
mv
(
std
::
string
&
lhs
,
const
std
::
basic_string
<
WCHAR
>&
rhs
)
{
void
mv
(
std
::
string
&
lhs
,
const
std
::
basic_string
<
WCHAR
>&
rhs
)
{
...
@@ -194,16 +194,17 @@ std::string get_root_uuid() {
...
@@ -194,16 +194,17 @@ std::string get_root_uuid() {
mv
(
uuid
,
drive_name
.
substr
(
first
,
last
-
first
));
mv
(
uuid
,
drive_name
.
substr
(
first
,
last
-
first
));
// UUIDs are formatted as 8-4-4-4-12 hex digits groups
// UUIDs are formatted as 8-4-4-4-12 hex digits groups
auto
cpy
=
uuid
;
auto
cpy
=
uuid
;
replace_if
(
cpy
.
begin
(),
cpy
.
end
(),
::
isxdigit
,
'F'
);
std
::
replace_if
(
cpy
.
begin
(),
cpy
.
end
(),
::
isxdigit
,
'F'
);
// discard invalid UUID
// discard invalid UUID
if
(
cpy
!=
uuid_format
)
if
(
cpy
!=
uuid_format
)
{
uuid
.
clear
();
uuid
.
clear
();
else
}
else
{
return
uuid
;
// return first valid UUID we get
return
uuid
;
// return first valid UUID we get
}
}
}
}
}
}
}
}
}
return
uuid
;
return
uuid
;
}
}
...
...
libcaf_core/src/memory.cpp
View file @
53f4dacb
...
@@ -24,8 +24,6 @@
...
@@ -24,8 +24,6 @@
#include "caf/mailbox_element.hpp"
#include "caf/mailbox_element.hpp"
using
namespace
std
;
#ifdef CAF_NO_MEM_MANAGEMENT
#ifdef CAF_NO_MEM_MANAGEMENT
int
caf_memory_keep_compiler_happy
()
{
int
caf_memory_keep_compiler_happy
()
{
...
@@ -50,7 +48,7 @@ memory_cache::~memory_cache() {
...
@@ -50,7 +48,7 @@ memory_cache::~memory_cache() {
// nop
// nop
}
}
using
cache_map
=
map
<
const
type_info
*
,
unique_ptr
<
memory_cache
>>
;
using
cache_map
=
std
::
map
<
const
std
::
type_info
*
,
std
::
unique_ptr
<
memory_cache
>>
;
void
cache_map_destructor
(
void
*
ptr
)
{
void
cache_map_destructor
(
void
*
ptr
)
{
delete
reinterpret_cast
<
cache_map
*>
(
ptr
);
delete
reinterpret_cast
<
cache_map
*>
(
ptr
);
...
@@ -67,13 +65,13 @@ cache_map& get_cache_map() {
...
@@ -67,13 +65,13 @@ cache_map& get_cache_map() {
cache
=
new
cache_map
;
cache
=
new
cache_map
;
pthread_setspecific
(
s_key
,
cache
);
pthread_setspecific
(
s_key
,
cache
);
// insert default types
// insert default types
unique_ptr
<
memory_cache
>
tmp
(
new
basic_memory_cache
<
mailbox_element
>
);
std
::
unique_ptr
<
memory_cache
>
tmp
(
new
basic_memory_cache
<
mailbox_element
>
);
cache
->
insert
(
make_pair
(
&
typeid
(
mailbox_element
),
move
(
tmp
)));
cache
->
insert
(
std
::
make_pair
(
&
typeid
(
mailbox_element
),
move
(
tmp
)));
}
}
return
*
cache
;
return
*
cache
;
}
}
memory_cache
*
memory
::
get_cache_map_entry
(
const
type_info
*
tinf
)
{
memory_cache
*
memory
::
get_cache_map_entry
(
const
std
::
type_info
*
tinf
)
{
auto
&
cache
=
get_cache_map
();
auto
&
cache
=
get_cache_map
();
auto
i
=
cache
.
find
(
tinf
);
auto
i
=
cache
.
find
(
tinf
);
if
(
i
!=
cache
.
end
())
{
if
(
i
!=
cache
.
end
())
{
...
@@ -82,7 +80,7 @@ memory_cache* memory::get_cache_map_entry(const type_info* tinf) {
...
@@ -82,7 +80,7 @@ memory_cache* memory::get_cache_map_entry(const type_info* tinf) {
return
nullptr
;
return
nullptr
;
}
}
void
memory
::
add_cache_map_entry
(
const
type_info
*
tinf
,
void
memory
::
add_cache_map_entry
(
const
std
::
type_info
*
tinf
,
memory_cache
*
instance
)
{
memory_cache
*
instance
)
{
auto
&
cache
=
get_cache_map
();
auto
&
cache
=
get_cache_map
();
cache
[
tinf
].
reset
(
instance
);
cache
[
tinf
].
reset
(
instance
);
...
...
libcaf_io/src/default_multiplexer.cpp
View file @
53f4dacb
...
@@ -477,7 +477,6 @@ namespace network {
...
@@ -477,7 +477,6 @@ namespace network {
CAF_LOGF_TRACE
(
"fd = "
<<
e
.
fd
CAF_LOGF_TRACE
(
"fd = "
<<
e
.
fd
<<
", old mask = "
<<
(
e
.
ptr
?
e
.
ptr
->
eventbf
()
:
-
1
)
<<
", old mask = "
<<
(
e
.
ptr
?
e
.
ptr
->
eventbf
()
:
-
1
)
<<
", new mask = "
<<
e
.
mask
);
<<
", new mask = "
<<
e
.
mask
);
using
namespace
std
;
auto
last
=
m_pollset
.
end
();
auto
last
=
m_pollset
.
end
();
auto
i
=
std
::
lower_bound
(
m_pollset
.
begin
(),
last
,
e
.
fd
,
auto
i
=
std
::
lower_bound
(
m_pollset
.
begin
(),
last
,
e
.
fd
,
[](
const
pollfd
&
lhs
,
int
rhs
)
{
[](
const
pollfd
&
lhs
,
int
rhs
)
{
...
...
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