summaryrefslogtreecommitdiff
path: root/TAO/CIAO/DAnCE/Config_Handlers/ANY_Handler.cpp
blob: c0b6d0db7afbedeb4de30c98b3ada76311661fad (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
// $Id$

#include "ANY_Handler.h"

CIAO::Config_Handlers::ANY_Handler::ANY_Handler()
{}
CIAO::Config_Handlers::ANY_Handler::~ANY_Handler()
{}



using CIAO::Config_Handlers;

CORBA::Any& 
CIAO::Config_Handlers::ANY_Handler::get_Any(
                        CORBA::Any& toconfig, Any& desc)
{ 
 
 //Get the value that should be assigned to the Any.
 DataValue value = desc.value();
 
 //Here, we check each type to see if 
 //it is present. If a type is listed as 
 //present, we can assume that it is the 
 //intended value for the Any. This relieves
 //us from the burden of having to check the
 //type field on <desc>.
 if(value.short_p()){
    toconfig <<= ACE_static_cast (CORBA::Short, 
                                CORBA::Short(value.short_()));
 }
  if(value.ushort_p()){
    toconfig <<= ACE_static_cast (CORBA::UShort,
                                CORBA::UShort(value.ushort()));
 }
 if(value.long_p()){
    toconfig <<= ACE_static_cast (CORBA::Long,
                                CORBA::Long(value.long_()));
 }
 if(value.ulong_p()){
    toconfig <<= ACE_static_cast (CORBA::ULong,
                                CORBA::ULong(value.ulong()));
 }
 if(value.boolean_p()){
    toconfig <<= ACE_static_cast (CORBA::Boolean,
                                CORBA::Boolean(value.boolean()));
 }
 if(value.double_p()){
    toconfig <<= ACE_static_cast (CORBA::Double, 
                                CORBA::Double(value.double_()));
 }
 if(value.float_p()){
    toconfig <<= ACE_static_cast (CORBA::Float, 
                                CORBA::Float(value.float_()));
 }
 if(value.string_p()){
    toconfig <<= CORBA::string_dup (value.string().c_str());
 }
 if(value.octet_p()){
    toconfig <<= CORBA::Any::from_octet ( 
                                CORBA::Octet(value.octet()));
 }
 if(value.longlong_p()){
    toconfig <<= ACE_static_cast (CORBA::LongLong, 
                                CORBA::LongLong(value.longlong()));
 }
 if(value.ulonglong_p()){
    toconfig <<= ACE_static_cast (CORBA::ULongLong, 
                                CORBA::ULongLong(value.ulonglong()));
 }
 //if(value.longdouble_p()){
 //   toconfig <<= ACE_static_cast (CORBA::LongDouble, 
 //                               CORBA::LongDouble(value.longdouble()));
 // }
 
 return toconfig;
}