summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/NodeManager/MonitorController.h
blob: 4c3eadeb2747c76c324cf100807edcd80e02c770 (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
// $Id$
//---------------------------------------------------------------------------------
/**
 *  @file MonitorController.h
 *
 *  @brief The Monitor Controller class.
 *
 *  This class is invoked by the Nodemanager object and it
 *  in turn loads the proper Monitor which is strategised.
 *
 *  @author Nilabja Roy
 */
//----------------------------------------------------------------------------------
#ifndef MONITOR_CONTROLLER_H
#define MONITOR_CONTROLLER_H

#include "TargetManager/TargetManagerC.h"
#include "ace/Task.h"
#include "ace/Auto_Ptr.h"

#include "ace/Synch_Traits.h"
#include "ace/Synch.h"

class MonitorBase;

/**
 *  @class MonitorController
 *
 *  @brief The Controller class
 *
 *  Acts as a facade to the Monitor
 *  module
 *
 */
class MonitorController : public ACE_Task_Base
{
 public:
    /**
     * @function svc.
     * @brief The main function containing the
     * entire activity.
     *
     * This function runs in the context of the
     * thread
     * @return int The status of the function
     */
    int svc (void);
    /**
     * @function terminate.
     * @brief The terminate function
     *
     * This function is called to terminate the
     * thread
     */
    void terminate ();


  /// The Constructor.
  MonitorController (CORBA::ORB_ptr orb,
                    ::Deployment::Domain& domain,
                    ::Deployment::TargetManager_ptr target
                    );
  /// The init function. This function initializes the monitor

    /**
     * @function init.
     * @brief The init function
     *
     * This function is called to during initialization
     */
    int init();

  ~MonitorController ();
 protected:

    /**
     * @function terminating.
     * @brief returns the terminating flag
     * @return bool The terminting state of the thread
     */
    bool terminating ();

    /// The monitor object
    auto_ptr <MonitorBase>  monitor_;

    /// The TargetManagerImpl object
    CIAO::TargetManagerImpl_var target_impl_cmp_;

    /// The TargetManager Facet ....
    Deployment::TargetManager_var target_facet_i_;

    /// The terminate flag_
    bool terminate_flag_;

    //Thread Mutex for synchronizing call
  ACE_SYNCH_MUTEX lock_;

    // the ORB pointer ..
    CORBA::ORB_ptr orb_;

    /// The initial domain
    ::Deployment::Domain initial_domain_;
};

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

#endif