1 #ifndef SUBORDINATION_KERNEL_KERNEL_HH 2 #define SUBORDINATION_KERNEL_KERNEL_HH 6 #include <unistdx/net/pstream> 8 #include <subordination/kernel/mobile_kernel.hh> 15 using mobile_kernel::id_type;
19 return this->isset(kernel_flag::principal_is_id)
20 ? nullptr : this->_principal;
25 return this->_principal;
29 principal_id()
const {
30 return this->_principal_id;
34 set_principal_id(id_type
id) {
35 this->_principal_id = id;
36 this->setf(kernel_flag::principal_is_id);
41 this->_principal = rhs;
42 this->unsetf(kernel_flag::principal_is_id);
57 return this->_parent_id;
63 this->unsetf(kernel_flag::parent_is_id);
68 const bool b = this->isset(kernel_flag::principal_is_id);
71 ret = this->_principal_id;
73 ret = this->_principal && this->_principal->has_id()
74 ? this->_principal->id()
75 : size_t(this->_principal) /
alignof(size_t);
81 moves_upstream()
const noexcept {
82 return this->return_code() == exit_code::undefined &&
88 moves_downstream()
const noexcept {
89 return this->return_code() != exit_code::undefined &&
95 moves_somewhere()
const noexcept {
96 return this->return_code() == exit_code::undefined &&
102 moves_everywhere()
const noexcept {
103 return !this->_principal && !this->_parent;
107 read(sys::pstream& in)
override;
110 write(sys::pstream& out)
const override;
125 header()
const noexcept {
126 return static_cast<const kernel_header&>(*
this);
131 return static_cast<kernel_header&>(*
this);
145 carry_parent(
kernel* rhs) noexcept {
147 rhs->setf(kernel_flag::carries_parent);
152 return_to_parent(exit_code ret = exit_code::success) noexcept {
153 return_to(_parent, ret);
155 this->to(this->from());
160 return_to(kernel* rhs, exit_code ret = exit_code::success) noexcept {
161 this->principal(rhs);
162 this->return_code(ret);
167 this->principal(
this);
172 mark_as_deleted(It result) noexcept {
173 if (!this->isset(kernel_flag::deleted)) {
174 this->setf(kernel_flag::deleted);
176 this->_parent->mark_as_deleted(result);
186 kernel* _parent =
nullptr;
190 kernel* _principal =
nullptr;
191 id_type _principal_id;
200 operator<<(sys::pstream& out,
const kernel& rhs) {
206 operator>>(sys::pstream& in, kernel& rhs) {
213 #endif // vim:filetype=cpp
Definition: mobile_kernel.hh:9
kernel * call(kernel *rhs) noexcept
New API.
Definition: kernel.hh:139