summaryrefslogtreecommitdiff
path: root/ciao/ComponentServer/Client_init.h
blob: d2a7c9323c49ffa84cc0c0876a13d2eff466c60a (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
// -*- C++ -*-
//
// $Id$

/**
 * @file Client_init.h
 *
 * Initializing CIAO client side ORB, if they need to.
 *
 * @author Nanbor Wang <nanbor@cs.wustl.edu>
 */

#ifndef CIAO_CLIENT_INIT_H
#define CIAO_CLIENT_INIT_H

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

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

#include "ace/Hash_Map_Manager_T.h"
#include "tao/orbconf.h"
#include "tao/AnyTypeCode/Any.h"
#include "ccm/CCM_StandardConfiguratorC.h"

#include "ciao/ComponentServer/CIAO_ComponentServer_stub_export.h"

TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace CORBA
{
  class ORB;
  typedef ORB *ORB_ptr;
}
TAO_END_VERSIONED_NAMESPACE_DECL

namespace CIAO
{
  /**
   * The initialize routine for any clients that need to access
   * components. This routine now simply registers various valuetype
   * factories defined in CIAO_Component.pidl.  Currently, this method
   * should be call right after ORB initialization but we should try
   * to register these stuff automatically.
   */
  CIAO_COMPONENTSERVER_STUB_Export int Client_init (CORBA::ORB_ptr o);

  namespace Utility
  {
    typedef ACE_Hash_Map_Manager_Ex<ACE_CString,
                                    CORBA::Any,
                                    ACE_Hash<ACE_CString>,
                                    ACE_Equal_To<ACE_CString>,
                                    ACE_Null_Mutex> CONFIGVALUE_MAP;

    CIAO_COMPONENTSERVER_STUB_Export void build_config_values_map (CONFIGVALUE_MAP &map,
                                                     const ::Components::ConfigValues &config);

    CIAO_COMPONENTSERVER_STUB_Export void build_config_values_sequence (::Components::ConfigValues &config,
                                                          const CONFIGVALUE_MAP &map);
  }
}

#define CIAO_REGISTER_VALUE_FACTORY(ORB,FACTORY,VALUETYPE)       {\
        CORBA::ValueFactory factory = new FACTORY; \
        CORBA::ValueFactory prev_factory = \
          ORB->register_value_factory \
          (VALUETYPE::_tao_obv_static_repository_id (), \
           factory); \
        if (prev_factory) prev_factory->_remove_ref (); \
        factory->_remove_ref ();      }

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

#endif /* CIAO_CLIENT_INIT_H */