1 #ifndef SUBORDINATION_KERNEL_KSTREAM_HH     2 #define SUBORDINATION_KERNEL_KSTREAM_HH     6 #include <unistdx/base/log_message>     7 #include <unistdx/net/socket_address>     8 #include <unistdx/net/pstream>    10 #include <subordination/base/error.hh>    11 #include <subordination/kernel/foreign_kernel.hh>    12 #include <subordination/kernel/kernel_error.hh>    13 #include <subordination/kernel/kernel_type_registry.hh>    14 #include <subordination/kernel/kernelbuf.hh>    15 #include <subordination/ppl/kernel_proto_flag.hh>    21         template <
class Router>
    22         struct no_forward: 
public Router {
    24             operator()(foreign_kernel*) {
    29         template <
class Router>
    30         struct forward_to_child: 
public Router {
    32             operator()(foreign_kernel* hdr) {
    33                 this->forward_child(hdr);
    37         template <
class Router>
    38         struct forward_to_parent: 
public Router {
    40             operator()(foreign_kernel* hdr) {
    41                 this->forward_parent(hdr);
    58             forward_child(foreign_kernel*) {}
    61             forward_parent(foreign_kernel*) {}
    69         typedef T kernel_type;
    71         using sys::pstream::operator<<;
    72         using sys::pstream::operator>>;
    76         kstream(sys::packetbuf* buf): sys::pstream(buf) {}
    81             return operator<<(*k);
    86             this->write_foreign(k);
    91         operator<<(kernel_type* k) {
    92             return operator<<(*k);
    96         operator<<(kernel_type& k) {
    97             this->write_native(k);
    98             if (k.carries_parent()) {
   100                 kernel_type* parent = k.parent();
   104                 this->write_native(*parent);
   110         operator>>(kernel_type*& k) {
   111             k = this->read_native();
   112             if (k->carries_parent()) {
   113                 kernel_type* parent = this->read_native();
   121             this->read_foreign(k);
   128         write_native(kernel_type& k) {
   129             auto type = types.find(
typeid(k));
   130             if (type == types.end()) {
   139             return types.read_object(*
this);
   156 #endif // vim:filetype=cpp Definition: kstream.hh:67
 
Definition: foreign_kernel.hh:9