summaryrefslogtreecommitdiff
path: root/CIAO/tests/DAnCE/Executor-Destructor/Exec_Dest_Status.cpp
blob: 556520b961bcaf358b949f9a852ab20e9ede3eda (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
// $Id$
#include "Exec_Dest_Status.h"

#include "dance/Deployment/Deployment_DeploymentPlanC.h"

namespace dance_test
{
  Exec_Dest_Status::Instance_Status::Instance_Status (void)
    : destructor_ (false)
  {
  }

  Exec_Dest_Status::Exec_Dest_Status (void)
    : instances_ ()
  {

  }

  Exec_Dest_Status::~Exec_Dest_Status (void)
  {
    this->instances_.clear ();
  }

  void
  Exec_Dest_Status::plan (const ::Deployment::DeploymentPlan *plan)
  {
    if (plan == 0)
      {
        ACE_ERROR ((LM_ERROR, "Error:  Nil plan passed to exec_dest_status\n"));
        return;
      }

    for (CORBA::ULong i = 0; i < plan->instance.length (); ++i)
      {
        this->instances_[plan->instance[i].name.in ()] = Instance_Status ();
      }
  }

  void
  Exec_Dest_Status::destructor_called (const std::string &id)
  {
    ACE_DEBUG ((LM_TRACE, "Got destructor invocation for id <%C>\n",
                id.c_str ()));
    this->instances_[id].destructor_ = true;
  }

  bool
  Exec_Dest_Status::check_destructor (const std::string &id)
  {
    return this->instances_[id].destructor_;
  }
}