summaryrefslogtreecommitdiff
path: root/TAO/tao/Resource_Factory.h
blob: 7c7416da2c9d160b9422bc6df7bfd747f07544a6 (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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
// -*- C++ -*-
// $Id$

// ============================================================================
//
// = LIBRARY
//   TAO
//
// = FILENAME
//   Resource_Factory.h
//
// = AUTHOR
//   Chris Cleeland
//   Carlos O'Ryan
//
// ============================================================================

#ifndef TAO_RESOURCE_FACTORY_H
#define TAO_RESOURCE_FACTORY_H

#include "ace/Service_Object.h"

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

#include "ace/Hash_Map_Manager.h"
#include "tao/Pluggable.h"
#include "tao/Protocol_Factory.h"
#include "tao/corbafwd.h"
#include "tao/orbconf.h"
#include "ace/Containers_T.h"
#include "tao/Acceptor_Registry.h"
#include "tao/Connector_Registry.h"

class TAO_POA;
class TAO_Object_Adapter;

// ****************************************************************

class TAO_Cached_Connector_Lock : public ACE_Adaptive_Lock
{
  // TITLE
  //   This lock class determines the type underlying lock
  //   when it gets constructed.
public:
  TAO_Cached_Connector_Lock (void);
  ~TAO_Cached_Connector_Lock (void);
};

// ****************************************************************

class TAO_Export TAO_Protocol_Item
{
public:
  TAO_Protocol_Item (const ACE_CString &name);
  // creator method, the protocol name can only be set when the
  // object is created.

  const ACE_CString &protocol_name (void);
  // return a reference to the character representation of the protocol
  // factories name.

  TAO_Protocol_Factory *factory (void);
  // return a pointer to the protocol factory.

  void factory (TAO_Protocol_Factory *factory);
  // set the factory pointer's valus.

private:
  ACE_CString name_;
  // protocol factory name.

  TAO_Protocol_Factory *factory_;
  // pointer to factory object.
};

// typedefs for containers containing the list of loaded protocol
// factories.
typedef ACE_Unbounded_Set<TAO_Protocol_Item*>
        TAO_ProtocolFactorySet;

typedef ACE_Unbounded_Set_Iterator<TAO_Protocol_Item*>
        TAO_ProtocolFactorySetItor;

// ****************************************************************

class TAO_Export TAO_Resource_Factory : public ACE_Service_Object
{
  // = TITLE
  //   Factory which manufacturers resources for use by the ORB Core.
  //
  // = DESCRIPTION
  //   This class is a factory/repository for critical ORB Core
  //   resources.
  //
public:
  // = Initialization and termination methods.
  TAO_Resource_Factory (void);
  virtual ~TAO_Resource_Factory (void);

  // = Resource Retrieval

  virtual ACE_Reactor *get_reactor (void);
  // Return an <ACE_Reactor> to be utilized.

  virtual ACE_Thread_Manager *get_thr_mgr (void);
  // Return an <ACE_Thread_Manager> to be utilized.

  virtual TAO_Acceptor_Registry *get_acceptor_registry (void);
  // return a reference to the acceptor registry.

  virtual TAO_Connector_Registry *get_connector_registry (void);
  // Return an Connector to be utilized.

  virtual TAO_POA *get_root_poa (void);
  // Return a root poa to be utilized.

  virtual TAO_Object_Adapter *object_adapter (void);
  // Return a object adapter to be utilized.

  virtual ACE_Allocator* input_cdr_dblock_allocator (void);
  virtual ACE_Allocator* input_cdr_buffer_allocator (void);
  // Access the input CDR allocators.

  virtual ACE_Allocator* output_cdr_dblock_allocator (void);
  virtual ACE_Allocator* output_cdr_buffer_allocator (void);
  // Access the output CDR allocators.

  virtual ACE_Data_Block *create_input_cdr_data_block (size_t size);
  // The Message Blocks used for input CDRs must have appropiate
  // locking strategies.

  virtual TAO_ProtocolFactorySet *get_protocol_factories (void);
  // The protocol factory list is implemented in this class since
  // a) it will be a global resource and
  // b) it is initialized at start up and then not altered.
  // Returns a container holding the list of loaded protocols.

  virtual int init_protocol_factories (void);
  // this method will loop through the protocol list and
  // using the protocol name field this method will
  // retrieve a pointer to the associated protocol factory
  // from the service configurator.  It is assumed
  // that only one thread will call this method at ORB initialization.
  // NON-THREAD-SAFE
};

#endif /* TAO_RESOURCE_FACTORY_H */