summaryrefslogtreecommitdiff
path: root/TAO/orbsvcs/orbsvcs/PortableGroup/miop_resource.h
blob: a4cfac1b51d277ea770fadbd29d7f8a897cf5534 (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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// -*- C++ -*-

//=============================================================================
/**
 *  @file   miop_resource.h
 *
 *  $Id$
 *
 *  @author Vladimir Zykov <vz@prismtech.com>
 */
//=============================================================================


#ifndef TAO_MIOP_RESOURCE_H
#define TAO_MIOP_RESOURCE_H

#include /**/ "ace/pre.h"

#include "orbsvcs/PortableGroup/portablegroup_export.h"

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

#include "tao/orbconf.h"
#include "tao/Versioned_Namespace.h"

#include "ace/Service_Object.h"
#include "ace/Service_Config.h"
#include "ace/Time_Value.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO_PG
{
  class Fragments_Cleanup_Strategy;
}

/**
 * @class TAO_MIOP_Resource_Factory
 *
 * @brief TAO's MIOP resource factory
 *
 * Using a <{resource source specifier}> as a discriminator, the
 * factory can return resource instances which are, e.g., global,
 * stored in thread-specific storage, stored in shared memory,
 * etc.
 */
class TAO_PortableGroup_Export TAO_MIOP_Resource_Factory
  : public ACE_Service_Object
{
public:

  /// Constructor.
  TAO_MIOP_Resource_Factory (void);

  /// Destructor.
  virtual ~TAO_MIOP_Resource_Factory (void);

  /**
   * @name Service Configurator Hooks
   */
  //@{
  /// Dynamic linking hook
  virtual int init (int argc, ACE_TCHAR *argv[]);
  //@}

  /**
   * @name Member Accessors
   */
  //@{
  TAO_PG::Fragments_Cleanup_Strategy *fragments_cleanup_strategy (void) const;

  /// Get Maximum number of fragments allowed.
  u_long max_fragments (void) const;

  /// Get MTU value (roughly).
  u_long max_fragment_size (void) const;

  /// Get time required for transfering one maximum sized fragment.
  u_long max_fragment_rate (void) const;

  /// Get number of bytes that can be sent without delay.
  u_long send_hi_water_mark (void) const;

  /// Get the desired socket transmit buffer's size in bytes (Zero is unspecified).
  u_long send_buffer_size (void) const;

  /// Get the desired socket receive buffer's size in bytes (Zero is unspecified).
  u_long receive_buffer_size (void) const;
  //@}

private:

  enum Fragments_Cleanup_Strategy_Type
    {
      TAO_MIOP_CLEANUP_TIME_BOUND,
      TAO_MIOP_CLEANUP_NUMBER_BOUND,
      TAO_MIOP_CLEANUP_MEMORY_BOUND
    };

  Fragments_Cleanup_Strategy_Type fragments_cleanup_strategy_type_;

  int fragments_cleanup_bound_;

  mutable TAO_PG::Fragments_Cleanup_Strategy *fragments_cleanup_strategy_;

  /// Maximum number of fragments.
  u_long max_fragments_;

  /// Maximum Size of a single fragment.
  u_long max_fragment_size_;

  /// Time required for transfering one maximum sized fragment.
  u_long max_fragment_rate_;

  /// Number of bytes that can be sent without delay.
  u_long send_hi_water_mark_;

  /// Get the desired socket send buffer's size in bytes.
  u_long send_buffer_size_;

  /// Get the desired socket receive buffer's size in bytes.
  u_long receive_buffer_size_;
};

TAO_END_VERSIONED_NAMESPACE_DECL

ACE_STATIC_SVC_DECLARE (TAO_MIOP_Resource_Factory)
ACE_FACTORY_DECLARE (TAO_PortableGroup, TAO_MIOP_Resource_Factory)

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