summaryrefslogtreecommitdiff
path: root/TAO/tao/PI/ORBInitializer_Registry_Impl.h
blob: f6c9de7cd2c989fa134edebd9779c1a16588e064 (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
// -*- C++ -*-

// ===================================================================
/**
 *  @file   ORBInitializer_Registry_Impl.h
 *
 *  @author Ossama Othman <ossama@uci.edu>
 */
// ===================================================================

#ifndef TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H
#define TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H

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

#include "tao/PI/pi_export.h"

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

#include "tao/PI/PI.h"

#include "tao/CORBA_methods.h"
#include "tao/Objref_VarOut_T.h"
#include "tao/ORBInitializer_Registry_Adapter.h"

#include "ace/Array_Base.h"
#include "ace/Service_Config.h"
#include "ace/Recursive_Thread_Mutex.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL

namespace TAO
{
  /**
   * @class ORBInitializer_Registry
   *
   * @brief Global list that contains all portable interceptor ORB
   *        initializers.
   */
  class ORBInitializer_Registry
    : public ORBInitializer_Registry_Adapter
  {
  public:
    ORBInitializer_Registry (void);

    /// Added to provide registration for the several static service
    /// objects, brought in with this ORBInitializer_Registry
    /// implementation. Note that this is more reliable than using
    /// static initializers, since multiple copies of the dynamic
    /// service object will require their own (multiple) copies of the
    /// dependent static service objects. That is just impossible
    /// without registering those static services in the same repo, the
    /// dynamic SO is registered with.
    virtual int init (int, ACE_TCHAR *[]);

    /// Service config fini method, release all ORBInitializers at this
    /// moment
    virtual int fini (void);

    /// Register an ORBInitializer with the underlying ORBInitializer
    /// array.
    virtual void register_orb_initializer (
                   PortableInterceptor::ORBInitializer_ptr init);

    /// Begin initialization of all registered ORBInitializers before
    /// the ORB itself is initialized.
    virtual size_t pre_init (TAO_ORB_Core *orb_core,
                             int argc,
                             char *argv[],
                             PortableInterceptor::SlotId &slotid);

    /// Complete initialization of all registered ORBInitializers after
    /// the ORB has been initialized.
    virtual void post_init (size_t pre_init_count,
                            TAO_ORB_Core *orb_core,
                            int argc,
                            char *argv[],
                            PortableInterceptor::SlotId slotid);

  private:
    // Prevent copying
    ORBInitializer_Registry (const ORBInitializer_Registry &);
    void operator= (const ORBInitializer_Registry &);

  private:
    TAO_SYNCH_RECURSIVE_MUTEX lock_;

    /// Dynamic array containing registered ORBInitializers.
    ACE_Array_Base<PortableInterceptor::ORBInitializer_var> initializers_;
  };
}


ACE_STATIC_SVC_DECLARE (ORBInitializer_Registry)
ACE_FACTORY_DECLARE (TAO_PI, ORBInitializer_Registry)

TAO_END_VERSIONED_NAMESPACE_DECL

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

#endif /* TAO_PI_ORB_INITIALIZER_REGISTRY_IMPL_H */