summaryrefslogtreecommitdiff
path: root/protocols/ace/RMCast/Stack.h
blob: e371370977de6d539b44291115a13f38e52f7be3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// file      : ace/RMCast/Stack.h
// author    : Boris Kolpackov <boris@kolpackov.net>
// cvs-id    : $Id$

#ifndef ACE_RMCAST_STACK_H
#define ACE_RMCAST_STACK_H

#include <ace/RMCast/Protocol.h>

namespace ACE_RMCast
{
  struct Out_Element
  {
    virtual
    ~Out_Element ()
    {
    }

    Out_Element ()
        : out_ (0)
    {
    }

    virtual void
    out_start (Out_Element* out)
    {
      out_ = out;
    }

    virtual void
    send (Message_ptr m)
    {
      if (out_) out_->send (m);
    }

    virtual void
    out_stop ()
    {
      out_ = 0;
    }

  protected:
    Out_Element* out_;
  };


  struct In_Element
  {
    virtual
    ~In_Element ()
    {
    }

    In_Element ()
        : in_ (0)
    {
    }

    virtual void
    in_start (In_Element* in)
    {
      in_ = in;
    }

    virtual void
    recv (Message_ptr m)
    {
      if (in_) in_->recv (m);
    }

    virtual void
    in_stop ()
    {
      in_ = 0;
    }

  protected:
    In_Element* in_;
  };

  struct Element : In_Element, Out_Element
  {
  };

}

#endif  // ACE_RMCAST_STACK_H