summaryrefslogtreecommitdiff
path: root/TAO/CIAO/tools/Daemon/Daemon_Impl.h
blob: 853b91468fc0de8705be655878dac476c7e472ca (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
// -*- C++ -*-

//=============================================================================
/**
 *  @file    Daemon_Impl.h
 *
 *  $Id$
 *
 *  This file contains servant implementation for CIAO's daemon process control
 *  interface.
 *
 *  @author Nanbor Wang <nanbor@cs.wustl.edu>
 */
//=============================================================================


#ifndef CIAO_DAEMON_IMPL_H
#define CIAO_DAEMON_IMPL_H
#include /**/ "ace/pre.h"

#include "DaemonS.h"

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

#include "ace/Synch.h"
#include "ace/Hash_Map_Manager_T.h"
#include "ace/Functor.h"

namespace CIAO
{
  /**
   * @class Daemon_Impl
   *
   * @brief Servant implementation CIAO's daemon process control interface
   *
   * This class implements the CIAO:Daemon interface.  We use this interface
   * to acquire the
   */
  class Daemon_Impl
    : public virtual POA_CIAO::Daemon,
      public virtual PortableServer::RefCountServantBase
  {
  public:

    /// Constructor
    Daemon_Impl (const char *name,
                 CORBA::ORB_ptr o,
                 PortableServer::POA_ptr p);

    /// Destructor
    virtual ~Daemon_Impl (void);

    /// Get the containing POA.  This operation does *not*
    /// increase the reference count of the POA.
    virtual PortableServer::POA_ptr _default_POA (void);

    /// CIAO::Daemon defined attributes/operations.

    virtual char * name (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    virtual CORBA::Object_ptr get_service (const char * svc_name
                                           ACE_ENV_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException,
                       CIAO::NotFound));

    virtual void shutdown (ACE_ENV_SINGLE_ARG_DECL_WITH_DEFAULTS)
      ACE_THROW_SPEC ((CORBA::SystemException));

    /**
     * @name CIAO::Daemon_Impl internal operations using the
     * canonical ACE_Map methods
     */
    //@{
    int bind (const char *orb_id, CORBA::Object_ptr obj);
    int unbind (const char *orb_id);
    //@}

  protected:
    typedef ACE_Hash_Map_Manager_Ex<const char *, CORBA::Object_ptr, ACE_Hash<const char *>, ACE_Equal_To<const char *>, TAO_SYNCH_MUTEX> Table;
    typedef Table::iterator Iterator;

    /// Keep a pointer to the managing ORB serving this servant.
    CORBA::ORB_var orb_;

    /// Keep a pointer to the managing POA.
    PortableServer::POA_var poa_;

    /// My Canonical name.
    CORBA::String_var name_;

    /// Internal object hash table.
    Table table_;
  };
}

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

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