summaryrefslogtreecommitdiff
path: root/modules/CIAO/tools/Config_Handlers/RT-CCM/TP_Handler.cpp
blob: 9d29bec5c4017adcd64f393492af6e3ba70e401f (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
// $Id$Exp lseibert

#include "TP_Handler.h"
#include "CIAOServerResources.hpp"

namespace CIAO
{
  namespace Config_Handlers
  {
    bool TP_Handler::thread_pool (
                                  const ThreadpoolDef &src,
                                  ::CIAO::DAnCE::ORS_Threadpool &dest
                                  )
    {
      dest.Id = CORBA::String_var (src.id ().c_str ());

      dest.stacksize =
        static_cast <ACE_UINT32> (src.stacksize ());

      dest.static_threads =
        static_cast <ACE_UINT32> (src.static_threads( ));

      dest.dynamic_threads =
        static_cast <ACE_UINT32> (src.dynamic_threads());

      dest.default_priority =
        static_cast <ACE_INT16> (src.default_priority ());

      dest.allow_request_buffering = src.allow_request_buffering ();

      dest.max_buffered_requests =
        static_cast <ACE_UINT32> (src.max_buffered_requests ());

      dest.max_request_buffer_size =
        static_cast <ACE_UINT32> (src.max_request_buffered_size ());

      return true;
    }

    ThreadpoolDef
    TP_Handler::thread_pool (
                             const ::CIAO::DAnCE::ORS_Threadpool &src
                             )
    {
      ThreadpoolDef tp (
                        XMLSchema::unsignedLong (src.stacksize),
                        XMLSchema::unsignedLong (src.static_threads),
                        XMLSchema::unsignedLong (src.dynamic_threads),
                        Priority (src.default_priority),
                        XMLSchema::boolean (src.allow_request_buffering),
                        XMLSchema::unsignedLong (src.max_buffered_requests),
                        XMLSchema::unsignedLong (src.max_request_buffer_size)
                        );

      if (src.Id.in () == 0)
        {
          tp.id (src.Id.in ());
        }

      return tp;
    }
  }
}