void TAO_ExtValueDef_i::fill_exceptions (CORBA::ExcDescriptionSeq &exceptions, ACE_Configuration_Section_Key &key, const char *sub_section) { ACE_Configuration_Section_Key excepts_key; int status = this->repo_->config ()->open_section (key, sub_section, 0, excepts_key); if (status != 0) { exceptions.length (0); return; } CORBA::ULong count = 0; this->repo_->config ()->get_integer_value (excepts_key, "count", count); exceptions.length (count); char *stringified = 0; ACE_TString holder; ACE_Configuration_Section_Key except_key; for (CORBA::ULong i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->get_string_value (excepts_key, stringified, holder); this->repo_->config ()->expand_path (this->repo_->root_key (), holder, except_key, 0); this->repo_->config ()->get_string_value (except_key, "name", holder); exceptions[i].name = holder.fast_rep (); this->repo_->config ()->get_string_value (except_key, "id", holder); exceptions[i].id = holder.fast_rep (); TAO_ExceptionDef_i impl (this->repo_); impl.section_key (except_key); exceptions[i].type = impl.type_i (); this->repo_->config ()->get_string_value (except_key, "container_id", holder); exceptions[i].defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (except_key, "version", holder); exceptions[i].version = holder.fast_rep (); } }
void ConfigTreeCtrl::LoadSection(wxTreeItemId& ParentItem, const ACE_Configuration_Section_Key& Key) { ACE_TString Name; int Index = 0; while(!m_pConfig->enumerate_sections(Key, Index, Name)) { wxTreeItemId Item = AppendItem(ParentItem, Name.fast_rep()); ACE_Configuration_Section_Key Child; m_pConfig->open_section(Key, Name.fast_rep(), 0, Child); LoadSection( Item, Child); ++Index; } }
CORBA::Contained::Description * TAO_EventPortDef_i::describe_i (void) { CORBA::ComponentIR::EventPortDescription epd; TAO_IFR_Desc_Utils<CORBA::ComponentIR::EventPortDescription, TAO_EventPortDef_i>::fill_desc_begin ( epd, this->repo_, this->section_key_ ); ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "base_type", holder); epd.event = holder.fast_rep (); CORBA::Contained::Description *retval = 0; ACE_NEW_RETURN (retval, CORBA::Contained::Description, 0); retval->kind = this->def_kind (); retval->value <<= epd; return retval; }
// Process service configuration directives from the files queued for // processing int ACE_Service_Gestalt::process_directives (bool ) { ACE_TRACE ("ACE_Service_Gestalt::process_directives"); if (this->svc_conf_file_queue_ == 0 || this->svc_conf_file_queue_->is_empty ()) { return 0; } ACE_TString *sptr = 0; int failed = 0; // Iterate through all the svc.conf files. for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_); iter.next (sptr) != 0; iter.advance ()) { int result = this->process_file (sptr->fast_rep ()); if (result < 0) return result; failed += result; } return failed; } /* process_directives () */
void TAO_Port_Desc_Seq_Utils<T_desc_seq>::port_base_type (T_desc_seq &desc_seq, ACE_TString &holder, CORBA::ULong index) { desc_seq[index].interface_type = holder.fast_rep (); }
// Process service configuration directives from the files queued for // processing int ACE_Service_Gestalt::process_directives (bool ignore_default_svc_conf_file) { ACE_TRACE ("ACE_Service_Gestalt::process_directives"); if (this->svc_conf_file_queue_ == 0 || this->svc_conf_file_queue_->is_empty ()) return 0; ACE_TString *sptr = 0; ACE_TString default_svc_conf (ACE_DEFAULT_SVC_CONF); // Iterate through all the svc.conf files. for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_conf_file_queue_); iter.next (sptr) != 0; iter.advance ()) { if (*sptr == default_svc_conf && ignore_default_svc_conf_file) continue; int result = this->process_file (sptr->fast_rep ()); if (result < 0) return result; } return 0; } /* process_directives () */
int ACE_Service_Gestalt::process_commandline_directives (void) { int result = 0; if (this->svc_queue_ != 0) { ACE_TString *sptr = 0; for (ACE_SVC_QUEUE_ITERATOR iter (*this->svc_queue_); iter.next (sptr) != 0; iter.advance ()) { // Process just a single directive. if (this->process_directive ((sptr->fast_rep ())) != 0) { ACELIB_ERROR ((LM_ERROR, ACE_TEXT ("ACE (%P|%t) %p\n"), ACE_TEXT ("process_directive"))); result = -1; } } delete this->svc_queue_; this->svc_queue_ = 0; } return result; } /* process_commandline_directives () */
void TAO_Port_Desc_Seq_Utils<CORBA::ComponentIR::EventPortDescriptionSeq>::port_base_type ( CORBA::ComponentIR::EventPortDescriptionSeq &desc_seq, ACE_TString &holder, CORBA::ULong index ) { desc_seq[index].event = holder.fast_rep (); }
CORBA::ComponentIR::EventDef_ptr TAO_EventPortDef_i::event_i ( ) { ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "base_type", holder); CORBA::Contained_var obj = this->repo_->lookup_id (holder.fast_rep ()); return CORBA::ComponentIR::EventDef::_narrow (obj.in ()); }
void ValueListCtrl::OnModify(wxCommandEvent& event) { long Item = GetSelectedItem(); if(Item == -1) { return ; } wxListItem ListItem; ACE_Configuration::VALUETYPE Type = (ACE_Configuration::VALUETYPE)GetItemData(Item); wxString Name = GetItemText(Item); switch(Type) { case ACE_Configuration::STRING: { ACE_TString Value; m_pConfig->get_string_value(m_Key, Name, Value); wxString ValueText(Value.fast_rep()); ValueDlg Dlg(this, Name, ValueText); if(Dlg.ShowModal() != wxID_OK) { return; } Value = (const char*)Dlg.GetStringValue(); m_pConfig->set_string_value(m_Key, Name, Value); } break; case ACE_Configuration::INTEGER: { u_int Value; m_pConfig->get_integer_value(m_Key, Name, Value); ValueDlg Dlg(this, Name, Value); if(Dlg.ShowModal() != wxID_OK) { return; } Value = Dlg.GetUINTValue(); m_pConfig->set_integer_value(m_Key, Name, Value); } break; case ACE_Configuration::BINARY: { wxMessageBox("Binary modification not supported (why don't you implement it?)"); //assert(0); } break; } DisplaySection(m_Key); }
CORBA::Boolean TAO_InterfaceDef_i::is_a_i (const char *interface_id) { if (ACE_OS::strcmp (interface_id, "IDL:omg.org/CORBA/Object:1.0") == 0) { return 1; } ACE_TString id; this->repo_->config ()->get_string_value (this->section_key_, "id", id); // Is it our type? if (ACE_OS::strcmp (id.fast_rep (), interface_id) == 0) { return 1; } // Is it one of our ancestors' types? CORBA::InterfaceDefSeq_var bases = this->base_interfaces_i (); CORBA::ULong length = bases->length (); PortableServer::ObjectId_var oid; char *base_path = 0; ACE_Configuration_Section_Key base_key; for (CORBA::ULong i = 0; i < length; ++i) { base_path = TAO_IFR_Service_Utils::reference_to_path (bases[i]); this->repo_->config ()->expand_path (this->repo_->root_key (), base_path, base_key, 0); TAO_InterfaceDef_i impl (this->repo_); impl.section_key (base_key); CORBA::Boolean success = impl.is_a_i (interface_id); if (success == 1) { return 1; } } return 0; }
void ValueListCtrl::DisplaySection(const ACE_Configuration_Section_Key& Key) { m_Key = Key; DeleteAllItems(); m_pConfig = MainFrame::Instance()->GetpConfig(); ACE_TString Name; int Index = 0; ACE_Configuration::VALUETYPE Type; ACE_TString StringValue; u_int UINTValue; while(!m_pConfig->enumerate_values(Key, Index, Name, Type)) { int Row = InsertItem(0, Name.fast_rep()); switch(Type) { case ACE_Configuration::STRING: SetItem(Row, 1, "String"); m_pConfig->get_string_value(Key, Name.fast_rep(), StringValue); SetItem(Row, 2, StringValue.fast_rep()); break; case ACE_Configuration::INTEGER: { SetItem(Row, 1, "Integer"); m_pConfig->get_integer_value(Key, Name.fast_rep(), UINTValue); wxString Text; Text.sprintf("%d", UINTValue); SetItem(Row, 2, Text); } break; case ACE_Configuration::BINARY: SetItem(Row, 1, "Binary"); break; } SetItemData(Row, Type); ++Index; } }
CORBA::InterfaceDef_ptr TAO_UsesDef_i::interface_type_i (void) { ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "base_type", holder); this->repo_->config ()->get_string_value (this->repo_->repo_ids_key (), holder.fast_rep (), holder); CORBA::Object_var obj = TAO_IFR_Service_Utils::path_to_ir_object (holder, this->repo_); return CORBA::InterfaceDef::_narrow (obj.in ()); }
void ConfigTreeCtrl::OnNewUINT(wxCommandEvent& event) { ValueDlg Dlg(this, false); if(Dlg.ShowModal() != wxID_OK) { return; } u_int Value = Dlg.GetUINTValue(); ACE_TString Name = Dlg.GetName(); // Get the key for this node wxTreeItemId ItemID = GetSelection(); ACE_Configuration_Section_Key Key; ResolveKey(ItemID, Key); m_pConfig->set_integer_value(Key, Name.fast_rep(), Value); m_pListCtrl->DisplaySection(Key); }
CORBA::Boolean TAO_EventPortDef_i::is_a_i ( const char *event_id ) { ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "base_type", holder); this->repo_->config ()->get_string_value (this->repo_->repo_ids_key (), holder.fast_rep (), holder); ACE_Configuration_Section_Key key; this->repo_->config ()->expand_path (this->repo_->root_key (), holder, key, 0); TAO_EventDef_i impl (this->repo_); impl.section_key (key); return impl.is_a_i (event_id); }
void TAO_IFR_Desc_Utils<T_desc,T_impl>::fill_desc_begin ( T_desc &desc, TAO_Repository_i *repo, ACE_Configuration_Section_Key &key ) { T_impl impl (repo); impl.section_key (key); desc.name = impl.name_i (); desc.id = impl.id_i (); ACE_TString holder; repo->config ()->get_string_value (key, "container_id", holder); desc.defined_in = holder.fast_rep (); desc.version = impl.version_i (); }
void TAO_IFR_Strseq_Utils<T_strseq> ::fill_string_seq ( const char *section_name, ACE_Configuration *config, ACE_Configuration_Section_Key &key, T_strseq &seq ) { ACE_Configuration_Section_Key section_key; int status = config->open_section (key, section_name, 0, section_key); if (status != 0) { seq.length (0); return; } CORBA::ULong count = 0; config->get_integer_value (section_key, "count", count); seq.length (count); char *stringified = 0; ACE_TString holder; for (CORBA::ULong i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); config->get_string_value (section_key, stringified, holder); seq[i] = holder.fast_rep (); } }
CORBA::Contained::Description * TAO_InterfaceDef_i::describe_i (void) { CORBA::Contained::Description *desc_ptr = 0; ACE_NEW_THROW_EX (desc_ptr, CORBA::Contained::Description, CORBA::NO_MEMORY ()); CORBA::Contained::Description_var retval = desc_ptr; retval->kind = this->def_kind (); CORBA::InterfaceDescription ifd; ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "name", holder); ifd.name = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "id", holder); ifd.id = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "container_id", holder); ifd.defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "version", holder); ifd.version = holder.fast_rep (); CORBA::ULong i = 0; CORBA::InterfaceDefSeq_var bases = this->base_interfaces_i (); CORBA::ULong length = bases->length (); CORBA::RepositoryIdSeq repo_ids (length); repo_ids.length (length); char *base_path = 0; ACE_Configuration_Section_Key base_key; for (i = 0; i < length; ++i) { base_path = TAO_IFR_Service_Utils::reference_to_path (bases[i]); this->repo_->config ()->expand_path (this->repo_->root_key (), base_path, base_key, 0); TAO_InterfaceDef_i impl (this->repo_); impl.section_key (base_key); repo_ids[i] = impl.id_i (); } ifd.base_interfaces = repo_ids; retval->value <<= ifd; return retval._retn (); }
CORBA::InterfaceDef::FullInterfaceDescription * TAO_InterfaceDef_i::describe_interface_i (void) { CORBA::InterfaceDef::FullInterfaceDescription *fifd = 0; ACE_NEW_RETURN (fifd, CORBA::InterfaceDef::FullInterfaceDescription, 0); CORBA::InterfaceDef::FullInterfaceDescription_var retval = fifd; ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "name", holder); fifd->name = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "id", holder); fifd->id = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "container_id", holder); fifd->defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "version", holder); fifd->version = holder.fast_rep (); CORBA::ULong i = 0; CORBA::ULong j = 0; ACE_Unbounded_Queue<ACE_Configuration_Section_Key> key_queue; // Store our section key for later restoration after we have // traversed entries for inherited interfaces. ACE_Configuration_Section_Key key_holder = this->section_key_; // Operations this->inherited_operations (key_queue); // Restore our original section key. // I am not sure this is needed but it will not hurt. this->section_key (key_holder); ACE_Configuration_Section_Key ops_key, op_key; int status = this->repo_->config ()->open_section (this->section_key_, "ops", 0, ops_key); CORBA::ULong count = 0; if (status == 0) { this->repo_->config ()->get_integer_value (ops_key, "count", count); for (j = 0; j < count; ++j) { char *stringified = TAO_IFR_Service_Utils::int_to_string (j); status = this->repo_->config ()->open_section (ops_key, stringified, 0, op_key); if (status == 0) { key_queue.enqueue_tail (op_key); } } } CORBA::ULong size = static_cast<CORBA::ULong> (key_queue.size ()); fifd->operations.length (size); for (i = 0; i < size; ++i) { ACE_Configuration_Section_Key key; key_queue.dequeue_head (key); TAO_OperationDef_i op (this->repo_); op.section_key (key); op.make_description (fifd->operations[i]); } // Restore our original section key. // It may have been overwritten by a superclass key as part of the // make_description() call. this->section_key (key_holder); // Attributes this->inherited_attributes (key_queue); // Restore our original section key. // I am not sure this is needed but it will not hurt. this->section_key (key_holder); ACE_Configuration_Section_Key attrs_key; status = this->repo_->config ()->open_section (this->section_key_, "attrs", 0, attrs_key); count = 0; if (status == 0) { this->repo_->config ()->get_integer_value (attrs_key, "count", count); for (j = 0; j < count; ++j) { ACE_Configuration_Section_Key attr_key; char *stringified = TAO_IFR_Service_Utils::int_to_string (j); status = this->repo_->config ()->open_section (attrs_key, stringified, 0, attr_key); if (status == 0) { key_queue.enqueue_tail (attr_key); } } } size = static_cast<CORBA::ULong> (key_queue.size ()); fifd->attributes.length (size); for (i = 0; i < size; ++i) { ACE_Configuration_Section_Key key; key_queue.dequeue_head (key); TAO_AttributeDef_i attr (this->repo_); attr.section_key (key); attr.make_description (fifd->attributes[i]); } // Restore our original section key. // It may have been overwritten by a superclass key as part of the // make_description() call. this->section_key (key_holder); CORBA::InterfaceDefSeq_var bases = this->base_interfaces_i (); CORBA::ULong length = bases->length (); CORBA::RepositoryIdSeq repo_ids (length); repo_ids.length (length); PortableServer::ObjectId_var oid; char *base_path = 0; ACE_Configuration_Section_Key base_key; for (i = 0; i < length; ++i) { base_path = TAO_IFR_Service_Utils::reference_to_path (bases[i]); this->repo_->config ()->expand_path (this->repo_->root_key (), base_path, base_key, 0); TAO_InterfaceDef_i impl (this->repo_); impl.section_key (base_key); repo_ids[i] = impl.id_i (); } fifd->base_interfaces = repo_ids; fifd->type = this->type_i (); return retval._retn (); }
CORBA::Contained::Description * TAO_ComponentDef_i::describe_i (void) { CORBA::ComponentIR::ComponentDescription cd; TAO_IFR_Desc_Utils<CORBA::ComponentIR::ComponentDescription, TAO_ComponentDef_i>::fill_desc_begin ( cd, this->repo_, this->section_key_ ); ACE_TString holder; int status = this->repo_->config ()->get_string_value (this->section_key_, "base_component", holder); if (status == 0) { ACE_Configuration_Section_Key base_key; this->repo_->config ()->expand_path (this->repo_->root_key (), holder, base_key, 0); this->repo_->config ()->get_string_value (base_key, "id", holder); } // If status wasn't 0, holder will contain the empty string. cd.base_component = holder.fast_rep (); CORBA::ULong count = 0; ACE_Configuration_Section_Key supports_key; status = this->repo_->config ()->open_section (this->section_key_, "supported", 0, supports_key); if (status == 0) { this->repo_->config ()->get_integer_value (supports_key, "count", count); } cd.supported_interfaces.length (count); char *stringified = 0; CORBA::ULong i = 0; for (i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->get_string_value (supports_key, stringified, holder); cd.supported_interfaces[i] = holder.c_str (); } TAO_Port_Desc_Seq_Utils< CORBA::ComponentIR::ProvidesDescriptionSeq >::port_descriptions (cd.provided_interfaces, this->repo_->config (), this->section_key_, "provides"); TAO_Port_Desc_Seq_Utils< CORBA::ComponentIR::UsesDescriptionSeq >::port_descriptions (cd.used_interfaces, this->repo_->config (), this->section_key_, "uses"); TAO_Port_Desc_Seq_Utils< CORBA::ComponentIR::EventPortDescriptionSeq >::port_descriptions (cd.emits_events, this->repo_->config (), this->section_key_, "emits"); TAO_Port_Desc_Seq_Utils< CORBA::ComponentIR::EventPortDescriptionSeq >::port_descriptions (cd.publishes_events, this->repo_->config (), this->section_key_, "publishes"); TAO_Port_Desc_Seq_Utils< CORBA::ComponentIR::EventPortDescriptionSeq >::port_descriptions (cd.consumes_events, this->repo_->config (), this->section_key_, "consumes"); count = 0; ACE_Configuration_Section_Key attrs_key; status = this->repo_->config ()->open_section (this->section_key_, "attrs", 0, attrs_key); if (status == 0) { this->repo_->config ()->get_integer_value (attrs_key, "count", count); } cd.attributes.length (count); ACE_Configuration_Section_Key attr_key; for (i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->open_section (attrs_key, stringified, 0, attr_key); TAO_ExtAttributeDef_i impl (this->repo_); impl.section_key (attr_key); impl.fill_description (cd.attributes[i]); } cd.type = this->type_i (); CORBA::Contained::Description *cont_desc_ptr = 0; ACE_NEW_THROW_EX (cont_desc_ptr, CORBA::Contained::Description, CORBA::NO_MEMORY ()); CORBA::Contained::Description_var retval = cont_desc_ptr; cont_desc_ptr->kind = CORBA::dk_Component; cont_desc_ptr->value <<= cd; return retval._retn (); }
void TAO_IFR_Service_Utils::fill_valuemember_seq ( CORBA::ValueMemberSeq &vm_seq, ACE_Configuration_Section_Key &key, TAO_Repository_i *repo ) { ACE_Configuration_Section_Key members_key; int status = repo->config ()->open_section (key, "members", 0, members_key); if (status != 0) { vm_seq.length (0); return; } CORBA::ULong count = 0; repo->config ()->get_integer_value (members_key, "count", count); vm_seq.length (count); char *stringified = 0; ACE_Configuration_Section_Key member_key, type_key; ACE_TString holder; CORBA::ULong access = 0; for (CORBA::ULong i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); repo->config ()->open_section (members_key, stringified, 0, member_key); repo->config ()->get_string_value (member_key, "name", holder); vm_seq[i].name = holder.fast_rep (); repo->config ()->get_string_value (member_key, "id", holder); vm_seq[i].id = holder.fast_rep (); repo->config ()->get_string_value (key, "id", holder); vm_seq[i].defined_in = holder.fast_rep (); repo->config ()->get_string_value (member_key, "version", holder); vm_seq[i].version = holder.fast_rep (); repo->config ()->get_string_value (member_key, "type_path", holder); TAO_IDLType_i *impl = TAO_IFR_Service_Utils::path_to_idltype (holder, repo); vm_seq[i].type = impl->type_i (); repo->config ()->get_integer_value (member_key, "access", access); vm_seq[i].access = static_cast<CORBA::Visibility> (access); } }
int ACE_Registry_ImpExp::export_section (const ACE_Configuration_Section_Key& section, const ACE_TString& path, FILE* out) { // don't export the root if (path.length ()) { // Write out the section header ACE_TString header = ACE_TEXT ("["); header += path; header += ACE_TEXT ("]"); header += ACE_TEXT ("\n"); if (ACE_WRITE_STRING (header.fast_rep (), out) < 0) return -1; // Write out each value int index = 0; ACE_TString name; ACE_Configuration::VALUETYPE type; ACE_TString line; ACE_TCHAR int_value[32]; ACE_TCHAR bin_value[3]; void* binary_data; size_t binary_length; ACE_TString string_value; while (!config_.enumerate_values (section, index, name, type)) { line = ACE_TEXT ("\"") + name + ACE_TEXT ("\"="); switch (type) { case ACE_Configuration::INTEGER: { u_int value; if (config_.get_integer_value (section, name.fast_rep (), value)) return -2; ACE_OS::snprintf (int_value, 32, ACE_TEXT ("%08x"), value); line += ACE_TEXT ("dword:"); line += int_value; break; } case ACE_Configuration::STRING: { if (config_.get_string_value (section, name.fast_rep (), string_value)) return -2; line += ACE_TEXT ("\""); line += string_value + ACE_TEXT ("\""); break; } #ifdef ACE_WIN32 case ACE_Configuration::INVALID: break; #endif case ACE_Configuration::BINARY: { // not supported yet - maybe use BASE64 codeing? if (config_.get_binary_value (section, name.fast_rep (), binary_data, binary_length)) return -2; line += ACE_TEXT ("hex:"); unsigned char* ptr = (unsigned char*)binary_data; while (binary_length) { if (ptr != binary_data) { line += ACE_TEXT (","); } ACE_OS::snprintf (bin_value, 3, ACE_TEXT ("%02x"), *ptr); line += bin_value; --binary_length; ++ptr; } #if defined (ACE_HAS_ALLOC_HOOKS) ACE_Allocator::instance()->free(binary_data); #else delete [] (char*) binary_data; #endif /* ACE_HAS_ALLOC_HOOKS */ break; } default: return -3; } line += ACE_TEXT ("\n"); if (ACE_WRITE_STRING (line.fast_rep (), out) < 0) return -4; ++index; } } // Export all sub sections int index = 0; ACE_TString name; ACE_Configuration_Section_Key sub_key; ACE_TString sub_section; while (!config_.enumerate_sections (section, index, name)) { ACE_TString sub_section (path); if (path.length ()) sub_section += ACE_TEXT ("\\"); sub_section += name; if (config_.open_section (section, name.fast_rep (), 0, sub_key)) return -5; if (export_section (sub_key, sub_section.fast_rep (), out)) return -6; ++index; } return 0; }
CORBA::ExtInitializerSeq * TAO_ExtValueDef_i::ext_initializers_i ( ) { CORBA::ExtInitializerSeq *iseq = 0; ACE_NEW_RETURN (iseq, CORBA::ExtInitializerSeq, 0); CORBA::ExtInitializerSeq_var retval = iseq; ACE_Configuration_Section_Key initializers_key; int status = this->repo_->config ()->open_section (this->section_key_, "initializers", 0, initializers_key); if (status != 0) { iseq->length (0); return retval._retn (); } CORBA::ULong count = 0; this->repo_->config ()->get_integer_value (initializers_key, "count", count); iseq->length (count); char *stringified = 0; ACE_Configuration_Section_Key initializer_key, params_key, arg_key; ACE_TString holder; CORBA::ULong arg_count = 0; for (CORBA::ULong i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->open_section (initializers_key, stringified, 0, initializer_key); this->repo_->config ()->get_string_value (initializer_key, "name", holder); retval[i].name = holder.fast_rep (); status = this->repo_->config ()->open_section (initializer_key, "params", 0, params_key); if (status != 0) { retval[i].members.length (0); continue; } this->repo_->config ()->get_integer_value (params_key, "count", arg_count); retval[i].members.length (arg_count); CORBA::Object_var obj; for (CORBA::ULong j = 0; j < arg_count; ++j) { stringified = TAO_IFR_Service_Utils::int_to_string (j); this->repo_->config ()->open_section (params_key, stringified, 0, arg_key); this->repo_->config ()->get_string_value (arg_key, "arg_name", holder); retval[i].members[j].name = holder.fast_rep (); this->repo_->config ()->get_string_value (arg_key, "arg_path", holder); TAO_IDLType_i *impl = TAO_IFR_Service_Utils::path_to_idltype (holder, this->repo_); retval[i].members[j].type = impl->type_i (); obj = TAO_IFR_Service_Utils::path_to_ir_object (holder, this->repo_); retval[i].members[j].type_def = CORBA::IDLType::_narrow (obj.in ()); } this->fill_exceptions (retval[i].exceptions, initializer_key, "excepts"); } return retval._retn (); }
int ACE_Ini_ImpExp::export_section (const ACE_Configuration_Section_Key& section, const ACE_TString& path, FILE* out) { // don't export the root if (path.length ()) { // Write out the section header ACE_TString header = ACE_TEXT ("["); header += path; header += ACE_TEXT ("]\n"); if (ACE_OS::fputs (header.fast_rep (), out) < 0) return -1; // Write out each value int index = 0; ACE_TString name; ACE_Configuration::VALUETYPE type; ACE_TString line; ACE_TCHAR int_value[32]; ACE_TCHAR bin_value[3]; void* binary_data; size_t binary_length; ACE_TString string_value; while (!config_.enumerate_values (section, index, name, type)) { line = name + ACE_TEXT ("="); switch (type) { case ACE_Configuration::INTEGER: { u_int value; if (config_.get_integer_value (section, name.fast_rep (), value)) return -2; ACE_OS::sprintf (int_value, ACE_TEXT ("%08x"), value); line += int_value; break; } case ACE_Configuration::STRING: { if (config_.get_string_value (section, name.fast_rep (), string_value)) return -2; line += string_value; break; } #ifdef _WIN32 case ACE_Configuration::INVALID: break; // JDO added break. Otherwise INVALID is processed // like BINARY. If that's correct, please remove the // break and these comments #endif case ACE_Configuration::BINARY: { // not supported yet - maybe use BASE64 codeing? if (config_.get_binary_value (section, name.fast_rep (), binary_data, binary_length)) return -2; line += ACE_TEXT ("\""); unsigned char* ptr = (unsigned char*)binary_data; while (binary_length) { if (ptr != binary_data) { line += ACE_TEXT (","); } ACE_OS::sprintf (bin_value, ACE_TEXT ("%02x"), *ptr); line += bin_value; --binary_length; ++ptr; } line += ACE_TEXT ("\""); delete [] (char *) binary_data; break; } default: return -3; }// end switch on type line += ACE_TEXT ("\n"); if (ACE_OS::fputs (line.fast_rep (), out) < 0) return -4; ++index; }// end while enumerating values } // Export all sub sections int index = 0; ACE_TString name; ACE_Configuration_Section_Key sub_key; ACE_TString sub_section; while (!config_.enumerate_sections (section, index, name)) { ACE_TString sub_section (path); if (path.length ()) sub_section += ACE_TEXT ("\\"); sub_section += name; if (config_.open_section (section, name.fast_rep (), 0, sub_key)) return -5; if (export_section (sub_key, sub_section.fast_rep (), out)) return -6; ++index; } return 0; }
CORBA::ExtValueDef::ExtFullValueDescription * TAO_ExtValueDef_i::describe_ext_value_i ( ) { CORBA::ExtValueDef::ExtFullValueDescription *fv_desc = 0; ACE_NEW_RETURN (fv_desc, CORBA::ExtValueDef::ExtFullValueDescription, 0); CORBA::ExtValueDef::ExtFullValueDescription_var retval = fv_desc; ACE_TString holder; this->repo_->config ()->get_string_value (this->section_key_, "name", holder); fv_desc->name = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "id", holder); fv_desc->id = holder.fast_rep (); CORBA::ULong val = 0; this->repo_->config ()->get_integer_value (this->section_key_, "is_abstract", val); fv_desc->is_abstract = static_cast<CORBA::Boolean> (val); this->repo_->config ()->get_integer_value (this->section_key_, "is_custom", val); fv_desc->is_custom = static_cast<CORBA::Boolean> (val); this->repo_->config ()->get_string_value (this->section_key_, "container_id", holder); fv_desc->defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "version", holder); fv_desc->version = holder.fast_rep (); // Operations. fv_desc->operations.length (0); ACE_Configuration_Section_Key ops_key; int status = this->repo_->config ()->open_section (this->section_key_, "ops", 0, ops_key); CORBA::ULong count = 0; CORBA::ULong param_count = 0; char *stringified = 0; CORBA::ULong i = 0; CORBA::ULong j = 0; TAO_IDLType_i *idl_type = 0; CORBA::Object_var obj; ACE_Configuration_Section_Key params_key, excepts_key, except_def_key; if (status == 0) { this->repo_->config ()->get_integer_value (ops_key, "count", count); fv_desc->operations.length (count); ACE_Configuration_Section_Key op_key, result_key, contexts_key; for (i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->open_section (ops_key, stringified, 0, op_key); this->repo_->config ()->get_string_value (op_key, "name", holder); fv_desc->operations[i].name = holder.fast_rep (); this->repo_->config ()->get_string_value (op_key, "id", holder); fv_desc->operations[i].id = holder.fast_rep (); this->repo_->config ()->get_string_value (this->section_key_, "id", holder); fv_desc->operations[i].defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (op_key, "result", holder); idl_type = TAO_IFR_Service_Utils::path_to_idltype (holder, this->repo_); fv_desc->operations[i].result = idl_type->type_i (); this->repo_->config ()->get_integer_value (op_key, "mode", val); fv_desc->operations[i].mode = static_cast<CORBA::OperationMode> (val); CORBA::TCKind kind = fv_desc->operations[i].result->kind (); if (fv_desc->operations[i].mode == CORBA::OP_ONEWAY && kind != CORBA::tk_void) { throw CORBA::BAD_PARAM ( CORBA::OMGVMCID | 31, CORBA::COMPLETED_NO); } // Operation contexts. TAO_IFR_Strseq_Utils<CORBA::ContextIdSeq>::fill_string_seq ( "contexts", this->repo_->config (), op_key, fv_desc->operations[i].contexts ); // Operation parameters. fv_desc->operations[i].parameters.length (0); status = this->repo_->config ()->open_section (op_key, "params", 0, params_key); if (status == 0) { ACE_Configuration_Section_Key param_key; this->repo_->config ()->get_integer_value (params_key, "count", param_count); fv_desc->operations[i].parameters.length (param_count); for (j = 0; j < param_count; ++j) { stringified = TAO_IFR_Service_Utils::int_to_string (j); this->repo_->config ()->open_section (params_key, stringified, 0, param_key); this->repo_->config ()->get_string_value (param_key, "name", holder); fv_desc->operations[i].parameters[j].name = holder.fast_rep (); this->repo_->config ()->get_string_value (param_key, "type_path", holder); idl_type = TAO_IFR_Service_Utils::path_to_idltype (holder, this->repo_); fv_desc->operations[i].parameters[j].type = idl_type->type_i (); obj = TAO_IFR_Service_Utils::path_to_ir_object ( holder, this->repo_ ); fv_desc->operations[i].parameters[j].type_def = CORBA::IDLType::_narrow (obj.in ()); this->repo_->config ()->get_integer_value (param_key, "mode", val); fv_desc->operations[i].parameters[j].mode = static_cast<CORBA::ParameterMode> (val); } } // Operation exceptions. status = this->repo_->config ()->open_section (op_key, "excepts", 0, excepts_key); fv_desc->operations[i].exceptions.length (0); if (status == 0) { CORBA::ULong excep_count = 0; this->repo_->config ()->get_integer_value (excepts_key, "count", excep_count); fv_desc->operations[i].exceptions.length (excep_count); ACE_Configuration_Section_Key except_def_key; for (j = 0; j < excep_count; ++j) { stringified = TAO_IFR_Service_Utils::int_to_string (j); this->repo_->config ()->get_string_value (excepts_key, stringified, holder); this->repo_->config ()->expand_path ( this->repo_->root_key (), holder, except_def_key, 0 ); this->repo_->config ()->get_string_value (except_def_key, "name", holder); fv_desc->operations[i].exceptions[j].name = holder.fast_rep (); this->repo_->config ()->get_string_value (except_def_key, "id", holder); fv_desc->operations[i].exceptions[j].id = holder.fast_rep (); this->repo_->config ()->get_string_value (except_def_key, "container_id", holder); fv_desc->operations[i].exceptions[j].defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (except_def_key, "version", holder); fv_desc->operations[i].exceptions[j].version = holder.fast_rep (); TAO_ExceptionDef_i impl (this->repo_); impl.section_key (except_def_key); fv_desc->operations[i].exceptions[j].type = impl.type_i (); } } } } // Attributes.. fv_desc->attributes.length (0); ACE_Configuration_Section_Key attrs_key; status = this->repo_->config ()->open_section (this->section_key_, "attrs", 0, attrs_key); if (status == 0) { this->repo_->config ()->get_integer_value (attrs_key, "count", count); fv_desc->attributes.length (count); ACE_Configuration_Section_Key attr_key, attr_def_key; for (i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->open_section (attrs_key, stringified, 0, attr_key); this->repo_->config ()->get_string_value (attr_key, "name", holder); fv_desc->attributes[i].name = holder.fast_rep (); this->repo_->config ()->get_string_value (attr_key, "id", holder); fv_desc->attributes[i].id = holder.fast_rep (); this->repo_->config ()->get_string_value (attr_key, "version", holder); fv_desc->attributes[i].version = holder.fast_rep (); this->repo_->config ()->get_integer_value (attr_key, "mode", val); fv_desc->attributes[i].mode = static_cast<CORBA::AttributeMode> (val); this->repo_->config ()->get_string_value (attr_key, "type_path", holder); // Use the type path for 'defined_in' and 'type'. idl_type = TAO_IFR_Service_Utils::path_to_idltype (holder, this->repo_); fv_desc->attributes[i].type = idl_type->type_i (); this->repo_->config ()->expand_path (this->repo_->root_key (), holder, attr_def_key, 0); this->repo_->config ()->get_string_value (attr_def_key, "container_id", holder); fv_desc->attributes[i].defined_in = holder.fast_rep (); this->fill_exceptions (fv_desc->attributes[i].get_exceptions, attr_key, "get_excepts"); this->fill_exceptions (fv_desc->attributes[i].put_exceptions, attr_key, "put_excepts"); } } // Members.. fv_desc->members.length (0); ACE_Configuration_Section_Key members_key; status = this->repo_->config ()->open_section (this->section_key_, "members", 0, members_key); if (status == 0) { this->repo_->config ()->get_integer_value (members_key, "count", count); fv_desc->members.length (count); ACE_Configuration_Section_Key member_key, member_def_key; for (i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->open_section (members_key, stringified, 0, member_key); this->repo_->config ()->get_string_value (member_key, "name", holder); fv_desc->members[i].name = holder.fast_rep (); this->repo_->config ()->get_string_value (member_key, "id", holder); fv_desc->members[i].id = holder.fast_rep (); this->repo_->config ()->get_string_value (member_key, "container_id", holder); fv_desc->members[i].defined_in = holder.fast_rep (); this->repo_->config ()->get_string_value (member_key, "version", holder); fv_desc->members[i].version = holder.fast_rep (); this->repo_->config ()->get_integer_value (member_key, "access", val); fv_desc->members[i].access = static_cast<CORBA::Visibility> (val); // Use type path for 'type' and 'type_def', this->repo_->config ()->get_string_value (member_key, "type_path", holder); idl_type = TAO_IFR_Service_Utils::path_to_idltype (holder, this->repo_); fv_desc->members[i].type = idl_type->type_i (); obj = TAO_IFR_Service_Utils::path_to_ir_object (holder, this->repo_); fv_desc->members[i].type_def = CORBA::IDLType::_narrow (obj.in ()); } } // Initializers fv_desc->initializers.length (0); ACE_Configuration_Section_Key initializers_key; status = this->repo_->config ()->open_section (this->section_key_, "initializers", 0, initializers_key); if (status == 0) { this->repo_->config ()->get_integer_value (initializers_key, "count", count); fv_desc->initializers.length (count); ACE_Configuration_Section_Key initializer_key, params_key, arg_key, excepts_key; for (i = 0; i < count; ++i) { stringified = TAO_IFR_Service_Utils::int_to_string (i); this->repo_->config ()->open_section (initializers_key, stringified, 0, initializer_key); this->repo_->config ()->get_string_value (initializer_key, "name", holder); fv_desc->initializers[i].name = holder.fast_rep (); fv_desc->initializers[i].members.length (0); status = this->repo_->config ()->open_section (initializer_key, "params", 0, params_key); if (status == 0) { this->repo_->config ()->get_integer_value (params_key, "count", param_count); fv_desc->initializers[i].members.length (param_count); for (j = 0; j < param_count; ++j) { stringified = TAO_IFR_Service_Utils::int_to_string (j); this->repo_->config ()->open_section (params_key, stringified, 0, arg_key); this->repo_->config ()->get_string_value (arg_key, "arg_name", holder); fv_desc->initializers[i].members[j].name = holder.fast_rep (); this->repo_->config ()->get_string_value (arg_key, "arg_path", holder); TAO_IDLType_i *impl = TAO_IFR_Service_Utils::path_to_idltype (holder, this->repo_); fv_desc->initializers[i].members[j].type = impl->type_i (); obj = TAO_IFR_Service_Utils::path_to_ir_object ( holder, this->repo_ ); fv_desc->initializers[i].members[j].type_def = CORBA::IDLType::_narrow (obj.in ()); } } this->fill_exceptions (fv_desc->initializers[i].exceptions, initializer_key, "excepts"); } } TAO_IFR_Strseq_Utils<CORBA::RepositoryIdSeq>::fill_string_seq ( "supported", this->repo_->config (), this->section_key_, fv_desc->supported_interfaces ); TAO_IFR_Strseq_Utils<CORBA::RepositoryIdSeq>::fill_string_seq ( "abstract_bases", this->repo_->config (), this->section_key_, fv_desc->abstract_base_values ); this->repo_->config ()->get_integer_value (this->section_key_, "is_truncatable", val); fv_desc->is_truncatable = static_cast<CORBA::Boolean> (val); status = this->repo_->config ()->get_string_value (this->section_key_, "base_value", holder); if (status == 0) { ACE_Configuration_Section_Key base_key; this->repo_->config ()->expand_path (this->repo_->root_key (), holder, base_key, 0); this->repo_->config ()->get_string_value (base_key, "id", holder); } // If status isn't 0, then holder will be empty anyway. fv_desc->base_value = holder.fast_rep (); fv_desc->type = this->type_i (); return retval._retn (); }