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
430c1fad
Commit
430c1fad
authored
Aug 14, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documentation
parent
303e1841
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
67 additions
and
0 deletions
+67
-0
cppa/util/acceptor.hpp
cppa/util/acceptor.hpp
+21
-0
cppa/util/input_stream.hpp
cppa/util/input_stream.hpp
+17
-0
cppa/util/io_stream.hpp
cppa/util/io_stream.hpp
+6
-0
cppa/util/output_stream.hpp
cppa/util/output_stream.hpp
+23
-0
No files found.
cppa/util/acceptor.hpp
View file @
430c1fad
...
@@ -39,15 +39,36 @@
...
@@ -39,15 +39,36 @@
namespace
cppa
{
namespace
util
{
namespace
cppa
{
namespace
util
{
/**
* @brief A pair of input and output stream pointers.
*/
typedef
std
::
pair
<
input_stream_ptr
,
output_stream_ptr
>
io_stream_ptr_pair
;
typedef
std
::
pair
<
input_stream_ptr
,
output_stream_ptr
>
io_stream_ptr_pair
;
/**
* @brief Accepts connections from client processes.
*/
class
acceptor
{
class
acceptor
{
public:
public:
virtual
~
acceptor
()
{
}
virtual
~
acceptor
()
{
}
/**
* @brief Returns the internal file descriptor. This descriptor is needed
* for socket multiplexing using select().
*/
virtual
native_socket_type
acceptor_file_handle
()
const
=
0
;
virtual
native_socket_type
acceptor_file_handle
()
const
=
0
;
/**
* @brief Accepts a new connection and returns an input/output stream pair.
* @note This member function blocks until a new connection was established.
*/
virtual
io_stream_ptr_pair
accept_connection
()
=
0
;
virtual
io_stream_ptr_pair
accept_connection
()
=
0
;
/**
* @brief Tries to accept a new connection but immediately returns if
* there is no pending connection.
*/
virtual
option
<
io_stream_ptr_pair
>
try_accept_connection
()
=
0
;
virtual
option
<
io_stream_ptr_pair
>
try_accept_connection
()
=
0
;
};
};
...
...
cppa/util/input_stream.hpp
View file @
430c1fad
...
@@ -37,21 +37,38 @@
...
@@ -37,21 +37,38 @@
namespace
cppa
{
namespace
util
{
namespace
cppa
{
namespace
util
{
/**
* @brief An abstract input stream interface.
*/
class
input_stream
:
public
virtual
ref_counted
{
class
input_stream
:
public
virtual
ref_counted
{
public:
public:
/**
* @brief Returns the internal file descriptor. This descriptor is needed
* for socket multiplexing using select().
*/
virtual
native_socket_type
read_file_handle
()
const
=
0
;
virtual
native_socket_type
read_file_handle
()
const
=
0
;
/**
/**
* @brief Reads exactly @p num_bytes from the data source and blocks the
* caller if needed.
* @throws std::ios_base::failure
* @throws std::ios_base::failure
*/
*/
virtual
void
read
(
void
*
buf
,
size_t
num_bytes
)
=
0
;
virtual
void
read
(
void
*
buf
,
size_t
num_bytes
)
=
0
;
/**
* @brief Tries to read up to @p num_bytes from the data source.
* @returns The number of read bytes.
* @throws std::ios_base::failure
*/
virtual
size_t
read_some
(
void
*
buf
,
size_t
num_bytes
)
=
0
;
virtual
size_t
read_some
(
void
*
buf
,
size_t
num_bytes
)
=
0
;
};
};
/**
* @brief An input stream pointer.
*/
typedef
intrusive_ptr
<
input_stream
>
input_stream_ptr
;
typedef
intrusive_ptr
<
input_stream
>
input_stream_ptr
;
}
}
// namespace cppa::util
}
}
// namespace cppa::util
...
...
cppa/util/io_stream.hpp
View file @
430c1fad
...
@@ -36,8 +36,14 @@
...
@@ -36,8 +36,14 @@
namespace
cppa
{
namespace
util
{
namespace
cppa
{
namespace
util
{
/**
* @brief A stream capable of both reading and writing.
*/
class
io_stream
:
public
input_stream
,
public
output_stream
{
};
class
io_stream
:
public
input_stream
,
public
output_stream
{
};
/**
* @brief An IO stream pointer.
*/
typedef
intrusive_ptr
<
io_stream
>
io_stream_ptr
;
typedef
intrusive_ptr
<
io_stream
>
io_stream_ptr
;
}
}
// namespace cppa::util
}
}
// namespace cppa::util
...
...
cppa/util/output_stream.hpp
View file @
430c1fad
...
@@ -37,16 +37,39 @@
...
@@ -37,16 +37,39 @@
namespace
cppa
{
namespace
util
{
namespace
cppa
{
namespace
util
{
/**
* @brief An abstract output stream interface.
*/
class
output_stream
:
public
virtual
ref_counted
{
class
output_stream
:
public
virtual
ref_counted
{
public:
public:
/**
* @brief Returns the internal file descriptor. This descriptor is needed
* for socket multiplexing using select().
*/
virtual
native_socket_type
write_file_handle
()
const
=
0
;
virtual
native_socket_type
write_file_handle
()
const
=
0
;
/**
* @brief Writes @p num_bytes bytes from @p buf to the data sink.
* @note This member function blocks until @p num_bytes were successfully
* written.
* @throws std::ios_base::failure
*/
virtual
void
write
(
const
void
*
buf
,
size_t
num_bytes
)
=
0
;
virtual
void
write
(
const
void
*
buf
,
size_t
num_bytes
)
=
0
;
/**
* @brief Tries to write up to @p num_bytes bytes from @p buf.
* @returns The number of written bytes.
* @throws std::ios_base::failure
*/
virtual
size_t
write_some
(
const
void
*
buf
,
size_t
num_bytes
)
=
0
;
virtual
size_t
write_some
(
const
void
*
buf
,
size_t
num_bytes
)
=
0
;
};
};
/**
* @brief An output stream pointer.
*/
typedef
intrusive_ptr
<
output_stream
>
output_stream_ptr
;
typedef
intrusive_ptr
<
output_stream
>
output_stream_ptr
;
}
}
// namespace cppa::util
}
}
// namespace cppa::util
...
...
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