summaryrefslogtreecommitdiff
path: root/TAO/tao/Strategies/GIOP_Message_NonReactive_Handler.h
blob: a8d9642a1b173f056ab18042e6c4b710618111fb (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
// This may look like C, but it's really -*- C++ -*-
// -*- C++ -*-
// ===================================================================
/**
 *  @file   GIOP_Message_NonReactive_Handler.h
 *
 *  $Id$
 *
 *  @author Balachandran Natarajan <bala@cs.wustl.edu>
 **/
// ===================================================================

#ifndef TAO_GIOP_MESSAGE_NON_REACTIVE_HANDLER_H
#define TAO_GIOP_MESSAGE_NON_REACTIVE_HANDLER_H
#include "ace/pre.h"

#include "strategies_export.h"

#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */

#include "tao/CDR.h"
#include "tao/GIOP_Message_Reactive_Handler.h"

class TAO_Transport;
class TAO_ORB_Core;
class TAO_GIOP_Message_NonReactive_Base;



/**
 * @class TAO_GIOP_Message_NonReactive_Handler
 *
 * @brief GIOP specific non-reactive message handler class
 *
 * This class does some of the message handling for GIOP. The class
 * is non-reactive, in the sense that the read calls on the socket
 * wait till all the data relevant for a GIOP message is read. This
 * strategy can be used by protocols which uses the reactor for
 * signaling rather than for data arrival.
 *
 * @todo Need to investigate why this strategy would be required at a
 *  higher level??
 */

class TAO_Strategies_Export TAO_GIOP_Message_NonReactive_Handler : public TAO_GIOP_Message_Reactive_Handler
{
public:

  /// Ctor
  TAO_GIOP_Message_NonReactive_Handler (TAO_ORB_Core *orb_core,
                                        TAO_GIOP_Message_NonReactive_Base *mesg_base,
                                        size_t input_cdr_size = ACE_CDR::DEFAULT_BUFSIZE);

  /// This call reads the message out of the socket and does parsing
  /// of the GIOP header.
  int read_parse_message (TAO_Transport *transport,
                          ACE_Time_Value *max_wait_time = 0);

  /// Return the CDR stream
  TAO_InputCDR &input_cdr (void);

private:

  /// Helper function that reads data from the transport to the buffer
  /// pointed by <buf> of size <size>. We assume that the transport
  /// has been set in the blocking mode for reading. Read is performed
  /// as long as we get all the data.
  int read_message (TAO_Transport *transport,
                    char *buf,
                    size_t size,
                    ACE_Time_Value *max_wait_time);

private:

  /// Our Message base
  TAO_GIOP_Message_NonReactive_Base *mesg_base_;


};

#if defined (__ACE_INLINE__)
# include "GIOP_Message_NonReactive_Handler.inl"
#endif /* __ACE_INLINE__ */

#include "ace/post.h"
#endif /*TAO_GIOP_MESSAGE_NON_REACTIVE_HANDLER_H*/