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
c03cd963
Commit
c03cd963
authored
Feb 11, 2023
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move observer_state to private core-test header
parent
6743514e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
89 additions
and
54 deletions
+89
-54
libcaf_core/CMakeLists.txt
libcaf_core/CMakeLists.txt
+0
-1
libcaf_core/caf/flow/observer.hpp
libcaf_core/caf/flow/observer.hpp
+0
-1
libcaf_core/caf/flow/observer_state.hpp
libcaf_core/caf/flow/observer_state.hpp
+0
-52
libcaf_core/test/core-test.cpp
libcaf_core/test/core-test.cpp
+50
-0
libcaf_core/test/core-test.hpp
libcaf_core/test/core-test.hpp
+39
-0
No files found.
libcaf_core/CMakeLists.txt
View file @
c03cd963
...
@@ -56,7 +56,6 @@ caf_add_component(
...
@@ -56,7 +56,6 @@ caf_add_component(
async.read_result
async.read_result
async.write_result
async.write_result
exit_reason
exit_reason
flow.observer_state
flow.op.state
flow.op.state
intrusive.inbox_result
intrusive.inbox_result
intrusive.task_result
intrusive.task_result
...
...
libcaf_core/caf/flow/observer.hpp
View file @
c03cd963
...
@@ -14,7 +14,6 @@
...
@@ -14,7 +14,6 @@
#include "caf/error.hpp"
#include "caf/error.hpp"
#include "caf/flow/coordinated.hpp"
#include "caf/flow/coordinated.hpp"
#include "caf/flow/coordinator.hpp"
#include "caf/flow/coordinator.hpp"
#include "caf/flow/observer_state.hpp"
#include "caf/flow/subscription.hpp"
#include "caf/flow/subscription.hpp"
#include "caf/intrusive_ptr.hpp"
#include "caf/intrusive_ptr.hpp"
#include "caf/logger.hpp"
#include "caf/logger.hpp"
...
...
libcaf_core/caf/flow/observer_state.hpp
deleted
100644 → 0
View file @
6743514e
// This file is part of CAF, the C++ Actor Framework. See the file LICENSE in
// the main distribution directory for license terms and copyright or visit
// https://github.com/actor-framework/actor-framework/blob/master/LICENSE.
#pragma once
#include "caf/default_enum_inspect.hpp"
#include "caf/detail/core_export.hpp"
namespace
caf
::
flow
{
/// Represents the current state of an @ref observer.
enum
class
observer_state
{
/// Indicates that no callbacks were called yet.
idle
,
/// Indicates that on_subscribe was called.
subscribed
,
/// Indicates that on_complete was called.
completed
,
/// Indicates that on_error was called.
aborted
};
/// Returns whether `x` represents a final state, i.e., `completed`, `aborted`
/// or `disposed`.
constexpr
bool
is_final
(
observer_state
x
)
noexcept
{
return
static_cast
<
int
>
(
x
)
>=
static_cast
<
int
>
(
observer_state
::
completed
);
}
/// Returns whether `x` represents an active state, i.e., `idle` or
/// `subscribed`.
constexpr
bool
is_active
(
observer_state
x
)
noexcept
{
return
static_cast
<
int
>
(
x
)
<=
static_cast
<
int
>
(
observer_state
::
subscribed
);
}
/// @relates sec
CAF_CORE_EXPORT
std
::
string
to_string
(
observer_state
);
/// @relates observer_state
CAF_CORE_EXPORT
bool
from_string
(
std
::
string_view
,
observer_state
&
);
/// @relates observer_state
CAF_CORE_EXPORT
bool
from_integer
(
std
::
underlying_type_t
<
observer_state
>
,
observer_state
&
);
/// @relates observer_state
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
observer_state
&
x
)
{
return
default_enum_inspect
(
f
,
x
);
}
}
// namespace caf::flow
libcaf_core/test/core-test.cpp
View file @
c03cd963
...
@@ -47,6 +47,56 @@ private:
...
@@ -47,6 +47,56 @@ private:
namespace
caf
::
flow
{
namespace
caf
::
flow
{
std
::
string
to_string
(
observer_state
x
)
{
switch
(
x
)
{
default:
return
"???"
;
case
observer_state
:
:
idle
:
return
"caf::flow::observer_state::idle"
;
case
observer_state
:
:
subscribed
:
return
"caf::flow::observer_state::subscribed"
;
case
observer_state
:
:
completed
:
return
"caf::flow::observer_state::completed"
;
case
observer_state
:
:
aborted
:
return
"caf::flow::observer_state::aborted"
;
}
}
bool
from_string
(
std
::
string_view
in
,
observer_state
&
out
)
{
if
(
in
==
"caf::flow::observer_state::idle"
)
{
out
=
observer_state
::
idle
;
return
true
;
}
if
(
in
==
"caf::flow::observer_state::subscribed"
)
{
out
=
observer_state
::
subscribed
;
return
true
;
}
if
(
in
==
"caf::flow::observer_state::completed"
)
{
out
=
observer_state
::
completed
;
return
true
;
}
if
(
in
==
"caf::flow::observer_state::aborted"
)
{
out
=
observer_state
::
aborted
;
return
true
;
}
return
false
;
}
bool
from_integer
(
std
::
underlying_type_t
<
observer_state
>
in
,
observer_state
&
out
)
{
auto
result
=
static_cast
<
observer_state
>
(
in
);
switch
(
result
)
{
default:
return
false
;
case
observer_state
:
:
idle
:
case
observer_state
:
:
subscribed
:
case
observer_state
:
:
completed
:
case
observer_state
:
:
aborted
:
out
=
result
;
return
true
;
}
}
disposable
make_trivial_disposable
()
{
disposable
make_trivial_disposable
()
{
return
disposable
{
make_counted
<
trivial_impl
>
()};
return
disposable
{
make_counted
<
trivial_impl
>
()};
}
}
...
...
libcaf_core/test/core-test.hpp
View file @
c03cd963
...
@@ -20,6 +20,45 @@
...
@@ -20,6 +20,45 @@
namespace
caf
::
flow
{
namespace
caf
::
flow
{
/// Represents the current state of an @ref observer.
enum
class
observer_state
{
/// Indicates that no callbacks were called yet.
idle
,
/// Indicates that on_subscribe was called.
subscribed
,
/// Indicates that on_complete was called.
completed
,
/// Indicates that on_error was called.
aborted
};
/// Returns whether `x` represents a final state, i.e., `completed`, `aborted`
/// or `disposed`.
constexpr
bool
is_final
(
observer_state
x
)
noexcept
{
return
static_cast
<
int
>
(
x
)
>=
static_cast
<
int
>
(
observer_state
::
completed
);
}
/// Returns whether `x` represents an active state, i.e., `idle` or
/// `subscribed`.
constexpr
bool
is_active
(
observer_state
x
)
noexcept
{
return
static_cast
<
int
>
(
x
)
<=
static_cast
<
int
>
(
observer_state
::
subscribed
);
}
/// @relates observer_state
std
::
string
to_string
(
observer_state
);
/// @relates observer_state
bool
from_string
(
std
::
string_view
,
observer_state
&
);
/// @relates observer_state
bool
from_integer
(
std
::
underlying_type_t
<
observer_state
>
,
observer_state
&
);
/// @relates observer_state
template
<
class
Inspector
>
bool
inspect
(
Inspector
&
f
,
observer_state
&
x
)
{
return
default_enum_inspect
(
f
,
x
);
}
/// Returns a trivial disposable that wraps an atomic flag.
/// Returns a trivial disposable that wraps an atomic flag.
disposable
make_trivial_disposable
();
disposable
make_trivial_disposable
();
...
...
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