summaryrefslogtreecommitdiff
path: root/apps/JAWS3/jaws3/IO.cpp
blob: 98e2e6e32f5ca3d279750826aa1dd78ad441ea49 (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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
// $Id$

#ifndef JAWS_BUILD_DLL
#define JAWS_BUILD_DLL
#endif /*JAWS_BUILD_DLL*/

#include "ace/OS_NS_strings.h"

#include "jaws3/IO.h"
#include "jaws3/Asynch_IO.h"
#include "jaws3/Synch_IO.h"
#include "jaws3/Reactive_IO.h"
#include "jaws3/Options.h"

JAWS_IO::JAWS_IO (JAWS_IO_Impl *impl)
  : impl_ (impl)
{
  // Use synchronous IO by default.  It is the most efficient
  // in terms of calls needed, but provides the least amount
  // of support for concurrency.

  if (this->impl_ == 0)
    {
      const char *io_type = JAWS_Options::instance ()->getenv ("JAWS_IO");
      if (io_type == 0)
        io_type = JAWS_DEFAULT_IO;

      if (ACE_OS::strcasecmp (io_type, "SYNCH") == 0)
        this->impl_ = JAWS_Synch_IO::instance ();
      else if (ACE_OS::strcasecmp (io_type, "ASYNCH") == 0)
        this->impl_ = JAWS_Asynch_IO::instance ();
      else if (ACE_OS::strcasecmp (io_type, "REACTIVE") == 0)
        this->impl_ = JAWS_Reactive_IO::instance ();
      else
        this->impl_ = JAWS_Synch_IO::instance ();
    }
}

JAWS_IO::~JAWS_IO (void)
{
}


void
JAWS_IO::send ( ACE_HANDLE handle
              , ACE_Message_Block *mb
              , JAWS_Event_Completer *completer
              , void *act
              )
{
  this->impl_->send (handle, mb, completer, act);
}


void
JAWS_IO::recv ( ACE_HANDLE handle
              , ACE_Message_Block *mb
              , JAWS_Event_Completer *completer
              , void *act
              )
{
  this->impl_->recv (handle, mb, completer, act);
}


void
JAWS_IO::transmit ( ACE_HANDLE handle
                  , ACE_HANDLE source
                  , JAWS_Event_Completer *completer
                  , void *act
                  , ACE_Message_Block *header
                  , ACE_Message_Block *trailer
                  )
{
  this->impl_->transmit (handle, source, completer, act, header, trailer);
}


void
JAWS_IO::send ( ACE_HANDLE handle
              , ACE_Message_Block *mb
              , JAWS_Event_Completer *completer
              , const ACE_Time_Value &tv
              , void *act
              )
{
  this->impl_->send (handle, mb, completer, tv, act);
}


void
JAWS_IO::recv ( ACE_HANDLE handle
              , ACE_Message_Block *mb
              , JAWS_Event_Completer *completer
              , const ACE_Time_Value &tv
              , void *act
              )
{
  this->impl_->recv (handle, mb, completer, tv, act);
}


void
JAWS_IO::transmit ( ACE_HANDLE handle
                  , ACE_HANDLE source
                  , JAWS_Event_Completer *completer
                  , const ACE_Time_Value &tv
                  , void *act
                  , ACE_Message_Block *header
                  , ACE_Message_Block *trailer
                  )
{
  this->impl_->transmit (handle, source, completer, tv, act, header, trailer);
}