summaryrefslogtreecommitdiff
path: root/CIAO/tools/Config_Handlers/RT-CCM/CB_Handler.cpp
blob: 85a06851d78a38bd5a7e16949c6a9863951d416f (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
// $Id$

#include "CB_Handler.h"
#include "CIAOServerResources.hpp"
#include "ace/Basic_Types.h"

namespace CIAO
{
  namespace Config_Handlers
  {
    //    IDREF_Base CB_Handler::IDREF;

    bool
    CB_Handler::connection_band (const ConnectionBandsDef &src,
                                 ::CIAO::DAnCE::ORS_ConnectionBands &dest)
    {
      // Set the number of bands
      CORBA::ULong num (dest.bands.length ());
      dest.bands.length (num + src.count_band ());

      for (ConnectionBandsDef::band_const_iterator i = src.begin_band ();
           i != src.end_band ();
           ++i)
        {
          dest.bands[num].low = static_cast <ACE_INT32> ((i->low ()));
          dest.bands[num].high = static_cast < ACE_INT32 > (i->high ());
          num++;
        }

      if (src.id_p ())
        {
          /*
          ACE_CString cstr (src.id ().c_str ());
          if (!IDD_Handler::IDREF.bind_ref (cstr, dest))
            return false;
          */
          dest.Id = CORBA::string_dup (src.id ().c_str ());
        }

      return true;
    }


    ConnectionBandsDef
    CB_Handler::connection_band (const ::CIAO::DAnCE::ORS_ConnectionBands &src)
    {
      ConnectionBandsDef cb;

      for (CORBA::ULong i = 0;
           i < src.bands.length ();
           ++i)
        {
          cb.add_band (PriorityBandDef (src.bands[i].low,
                                        src.bands[i].high));
        }

      /*
      ACE_CString cstr;
      if (CB_Handler::IDREF.find_ref (src, cstr))
        cb->id (cstr.c_str ());
      */

      if (src.Id.in () != 0)
        cb.id (src.Id.in ());

      return cb;
    }

  }
}