1 #include "RT_Properties.h"
3 #include "tao/ORB_Constants.h"
5 #include "ace/OS_NS_stdio.h"
6 #include "ace/OS_NS_string.h"
8 RT_Properties::RT_Properties ()
11 ior_source_
= ACE_TEXT("poa_default.ior");
15 RT_Properties::read_from (const ACE_TCHAR
*file_name
)
17 FILE *fp
= ACE_OS::fopen (file_name
, "r");
19 RT_Properties
*rt_properties
= 0;
21 ACE_NEW_THROW_EX (rt_properties
,
23 CORBA::NO_MEMORY (TAO::VMCID
,
24 CORBA::COMPLETED_NO
));
26 // @@ Angelo: what if the length is more than 255?
27 char string_field
[256];
32 while (fscanf (fp
, "%s", string_field
) != EOF
)
34 if (ACE_OS::strcmp (string_field
, "Priority") == 0)
36 n_matched
= fscanf (fp
, "%d", &int_field
);
37 ACE_UNUSED_ARG (n_matched
);
39 rt_properties
->priority (int_field
);
41 else if (ACE_OS::strcmp (string_field
, "Priority_Bands") == 0)
43 n_matched
= fscanf (fp
, "%d", &int_field
);
44 ACE_UNUSED_ARG (n_matched
);
46 rt_properties
->priority_bands_
.length (int_field
);
48 else if (ACE_OS::strcmp (string_field
, "Priority_Range") == 0)
50 n_matched
= fscanf (fp
, "%d", &int_field
);
51 ACE_UNUSED_ARG (n_matched
);
53 rt_properties
->priority_bands_
[i
].low
= int_field
;
55 n_matched
= fscanf (fp
, "%d", &int_field
);
56 ACE_UNUSED_ARG (n_matched
);
58 rt_properties
->priority_bands_
[i
].high
= int_field
;
68 RT_Properties::priority (RTCORBA::Priority priority
)
70 this->priority_
= priority
;
74 RT_Properties::priority ()
76 return this->priority_
;
80 RT_Properties::priority_bands (const RTCORBA::PriorityBands
& priority_bands
)
82 this->priority_bands_
= priority_bands
;
85 const RTCORBA::PriorityBands
&
86 RT_Properties::priority_bands ()
88 return this->priority_bands_
;
92 RT_Properties::ior_source (const ACE_TCHAR
*s
)
94 this->ior_source_
= s
;
98 RT_Properties::ior_source ()
100 return this->ior_source_
.c_str ();