summaryrefslogtreecommitdiff
path: root/modules/CIAO/connectors/dds4ccm/impl/ndds/DomainParticipantFactory.cpp
blob: defdfafe9e7525b53a0dc7211a30a9aa69155738 (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// $Id$

#include "DomainParticipantFactory.h"
#include "DomainParticipant.h"
#include "Utils.h"

#include "ciao/Logger/Log_Macros.h"
#include "dds4ccm/idl/dds4ccm_BaseC.h"

namespace CIAO
{
  namespace DDS4CCM
  {
    namespace RTI
    {
      RTI_DomainParticipantFactory_i::RTI_DomainParticipantFactory_i (void)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::RTI_DomainParticipantFactory_i");
      }

      RTI_DomainParticipantFactory_i::~RTI_DomainParticipantFactory_i (void)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::~RTI_DomainParticipantFactory_i");
      }

      ::DDS::DomainParticipant_ptr
      RTI_DomainParticipantFactory_i::create_participant (::DDS::DomainId_t domain_id,
                                                          const ::DDS::DomainParticipantQos & /*qos*/,
                                                          ::DDS::DomainParticipantListener_ptr /*a_listener*/,
                                                          ::DDS::StatusMask mask)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::create_participant");

        CIAO_DEBUG ((LM_TRACE, CLINFO "RTI_DomainParticipantFactory_i::create_participant - "
                     "Creating domain participant\n"));
        DDSDomainParticipant *part = DDSDomainParticipantFactory::get_instance ()->
          create_participant (domain_id,
                              DDS_PARTICIPANT_QOS_DEFAULT,
                              0,
                              mask);

        if (!part)
          {
            CIAO_ERROR ((LM_ERROR, CLINFO "RTI_DomainParticipantFactory_i::create_participant - "
                         "Error: Unable to create DomainParticipant\n"));
            throw CCM_DDS::InternalError (1, 0);
          }

        ::DDS::DomainParticipant_var retval = new RTI_DomainParticipant_i (part);

        return retval._retn ();
      }


      ::DDS::ReturnCode_t
      RTI_DomainParticipantFactory_i::delete_participant (::DDS::DomainParticipant_ptr a_participant)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::delete_participant");

        RTI_DomainParticipant_i *part = dynamic_cast< RTI_DomainParticipant_i * > (a_participant);

        if (!part)
          {
            CIAO_ERROR ((LM_ERROR, CLINFO "RTI_DomainParticipantFactory_i::delete_participant - "
                         "Unable to cast provided object reference to servant type, bailing.\n"));
            return DDS::RETCODE_ERROR;
          }
        CIAO_DEBUG ((LM_TRACE, CLINFO "RTI_DomainParticipantFactory_i::delete_participant - "
                     "Successfully casted provided object reference to servant type.\n"));

        DDS_ReturnCode_t retval = DDSDomainParticipantFactory::get_instance ()->
            delete_participant (part->get_participant ());

        if (retval != DDS_RETCODE_OK)
          {
            CIAO_ERROR ((LM_ERROR, CLINFO "RTI_DomainParticipantFactory_i::delete_participant - "
                         "RTI delete_participant returned non-ok error code %c\n",
                         translate_retcode (retval)));
          }
        else CIAO_DEBUG ((LM_INFO, CLINFO "RTI_DomainParticipantFactory_i::delete_participant - "
                          "Successfully deleted provided participant.\n"));

        return retval;
      }

      ::DDS::DomainParticipant_ptr
      RTI_DomainParticipantFactory_i::lookup_participant (::DDS::DomainId_t domain_id)
      {
        DDSDomainParticipant* dp = DDSDomainParticipantFactory::get_instance ()->lookup_participant (domain_id);
        ::DDS::DomainParticipant_var retval = new RTI_DomainParticipant_i (dp);
        return retval._retn ();
      }

      ::DDS::ReturnCode_t
      RTI_DomainParticipantFactory_i::set_default_participant_qos (const ::DDS::DomainParticipantQos & /*qos*/)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::set_default_participant_qos");

        throw CORBA::NO_IMPLEMENT ();
      }

      ::DDS::ReturnCode_t
      RTI_DomainParticipantFactory_i::get_default_participant_qos (::DDS::DomainParticipantQos & /*qos*/)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::get_default_participant_qos");

        throw CORBA::NO_IMPLEMENT ();
      }

      ::DDS::ReturnCode_t
      RTI_DomainParticipantFactory_i::set_qos (const ::DDS::DomainParticipantFactoryQos & /*qos*/)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::set_qos");

        throw CORBA::NO_IMPLEMENT ();
      }

      ::DDS::ReturnCode_t
      RTI_DomainParticipantFactory_i::get_qos (::DDS::DomainParticipantFactoryQos & /*qos*/)
      {
        CIAO_TRACE ("RTI_DomainParticipantFactory_i::get_qos");

        throw CORBA::NO_IMPLEMENT ();
      }

    }
  }
}