| 87 | | std::string baseName = name; |
| 88 | | std::string waveformName; |
| | 87 | std::string waveformName = name; |
| | 88 | |
| | 89 | //Check if waveform name already exists |
| | 90 | for (unsigned int i = 0; i < appseq->length(); ++i) { |
| | 91 | if (waveformName == (*appseq)[i]->name()) { |
| | 92 | DEBUG(5, ApplicationFactory, "Error: Waveform name already exists."); |
| | 93 | throw CF::ApplicationFactory::CreateApplicationError(CF::CFEEXIST, "Application name already exists."); |
| | 94 | } |
| | 95 | } |
| 753 | | ///\todo Review code. |
| 754 | | void ApplicationFactory_impl::create_waveform_nc_from_name(std::string &name, CosNaming::NamingContext_ptr &waveformContext, std::string &waveformName) |
| 755 | | { |
| 756 | | |
| 757 | | CORBA::Object_var obj_DN = orb->get_object_from_name("DomainName1"); |
| 758 | | CosNaming::NamingContext_var DomainContext = CosNaming::NamingContext::_narrow(obj_DN); |
| 759 | | |
| 760 | | short waveformCount(0); |
| 761 | | std::ostringstream waveformContextName; |
| 762 | | |
| 763 | | bool found_empty(false); |
| 764 | | CosNaming::Name_var cosName; |
| 765 | | |
| 766 | | do { |
| 767 | | waveformCount++; |
| 768 | | waveformContextName.clear() |
| 769 | | ; |
| 770 | | waveformContextName << "DomainName1/" << name << "_" << waveformCount; |
| 771 | | |
| 772 | | cosName = orb->string_to_CosName(waveformContextName.str().c_str()); |
| 773 | | try { |
| 774 | | orb->inc->resolve(cosName); |
| 775 | | } catch (const CosNaming::NamingContext::NotFound &) { |
| 776 | | DEBUG(5, ApplicationFactory, "Found empty waveform context."); |
| 777 | | found_empty = true; |
| 778 | | |
| 779 | | std::ostringstream wn; |
| 780 | | wn << name << "_" << waveformCount; |
| 781 | | waveformName = wn.str(); |
| 782 | | } |
| 783 | | } while (!found_empty); |
| 784 | | |
| 785 | | DEBUG(5, ApplicationFactory, "Creating new waveform context: " << waveformContextName.str()); |
| | 761 | void ApplicationFactory_impl::create_waveform_nc_from_name(std::string &waveformName, CosNaming::NamingContext_ptr &waveformContext) |
| | 762 | { |
| | 763 | |
| | 764 | std::string tmpStr = "DomainName1/" + waveformName; |
| | 765 | CosNaming::Name_var cosName = orb->string_to_CosName(tmpStr.c_str()); |
| | 766 | |
| | 767 | DEBUG(5, ApplicationFactory, "Creating new waveform context: " << waveformName); |