void GeneratorBIDL::gen_facet(IR__::ComponentDef_ptr component, t_string_map implemented_facets, t_string_map facet_types) { IR__::ComponentDef_var base = component->base_component(); if(base) { gen_facet(base, implemented_facets, facet_types); } // // inherit from each implemented facet type // IR__::ProvidesDefSeq_var provides_seq = component->provides_interfaces(); CORBA::ULong len = provides_seq->length(); CORBA::ULong i; for (i = 0; i < len; i++) { IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provides_seq[i]->interface_type()); if( CORBA::is_nil(intf) ) { continue; } // // facet not already implemented by segment // if(implemented_facets.find(provides_seq[i]->name()) == implemented_facets.end()) { // if type already inherited, skip it string facet_type = intf->id(); if(facet_types.find(facet_type) == facet_types.end()) { facet_types[facet_type] = true; if(!facet_types.empty()) { out << ", "; } out << getLocalName(intf); } } } // inherit from consumer for each event facet_types.clear(); IR__::ConsumesDefSeq_var consumes_seq = component->consumes_events(); len = consumes_seq->length(); for (i = 0; i < len; i++) { string facet_type = consumes_seq[i]->event()->id(); // if type already inherited, skip it if(facet_types.find(facet_type) == facet_types.end()) { facet_types[facet_type] = true; out << ", " << getLocalName(consumes_seq[i]->event()) << "Consumer"; } } }
static void translateBlock(std::deque<llvm::MCInst>& block) { typedef std::map<std::string, LLVMValueRef>::const_iterator ValRef; std::map<std::string, LLVMValueRef> locals; std::map<std::string, LLVMValueRef> regs; for (InstIter it = block.begin(); it != block.end(); ++it) { llvm::MCInst& inst = *it; const llvm::MCInstrDesc& id = MII->get(inst.getOpcode()); llvm::StringRef iname = MII->getName(inst.getOpcode()); if (iname.startswith("MOV")) { LLVMValueRef lhs; unsigned iop = 0; if (id.OpInfo[0].OperandType == llvm::MCOI::OPERAND_MEMORY) { std::string localName = getLocalName(inst, 0); ValRef pval = locals.find(localName); if (pval == locals.end()) { lhs = LLVMBuildAlloca(llvmBuilder, LLVMInt32Type(), localName.c_str()); locals[localName] = lhs; } else { lhs = pval->second; } if (id.OpInfo[5].OperandType == llvm::MCOI::OPERAND_IMMEDIATE) { const llvm::MCOperand& op = inst.getOperand(5); LLVMBuildStore(llvmBuilder, lhs, LLVMConstInt(LLVMInt32Type(), op.getImm(), 0)); } if (id.OpInfo[5].OperandType == llvm::MCOI::OPERAND_REGISTER) { LLVMBuildStore(llvmBuilder, lhs, regs[getRegName(inst, 5)]); } } else if (id.OpInfo[0].OperandType == llvm::MCOI::OPERAND_REGISTER) { LLVMValueRef rhs; printInst(inst); if (id.OpInfo[1].OperandType == llvm::MCOI::OPERAND_IMMEDIATE) { rhs = LLVMConstInt(LLVMInt32Type(), inst.getOperand(1).getImm(), 0); } else if (id.OpInfo[1].OperandType == llvm::MCOI::OPERAND_MEMORY) { ValRef pval = locals.find(getLocalName(inst, 1)); if (pval == locals.end()) { llvm::outs() << "No such local " << getLocalName(inst, 1) << "\n"; break; } rhs = LLVMBuildLoad(llvmBuilder, pval->second, getRegName(inst, 0)); } else { continue; } regs[getRegName(inst, 0)] = rhs; } } } }
void TreeKey::assureKeyPath(const char *keyBuffer) { if (!keyBuffer) { keyBuffer = unsnappedKeyText; //assert we have something to do before setting root if (!*keyBuffer) return; } char *keybuf = 0; stdstr(&keybuf, keyBuffer); root(); // TODO: change to NOT use strtok. strtok is dangerous. SWBuf tok = strtok(keybuf, "/"); tok.trim(); while (tok.size()) { bool foundkey = false; if (hasChildren()) { firstChild(); if (tok == getLocalName()) { foundkey = true; } else { while (nextSibling()) { if (getLocalName()) { if (tok == getLocalName()) { foundkey = true; break; } } } } if (!foundkey) { append(); setLocalName(tok); save(); } } else { appendChild(); setLocalName(tok); save(); } #ifdef DEBUG // std::cout << getLocalName() << " : " << tok << std::endl; #endif tok = strtok(0, "/"); tok.trim(); } delete [] keybuf; }
QString CSwordTreeKey::getLocalNameUnicode() { //return m_module->getTextCodec()->toUnicode(getLocalName()); //Only UTF-8 and latin1 are legal Sword module encodings Q_ASSERT(m_module); if (m_module->isUnicode()) { return QString::fromUtf8(getLocalName()); } else { return cp1252Codec()->toUnicode(getLocalName()); } }
//============================================================================== // QName::getUniversalName // // This is an attempt at creating a "universal name" ie a name representing // the namespace and localname as a single name. No standard exists for how // this should be represented so we adopt the convention used by John Cowan's // Namespace XML Filter which uses a a caret (^) to seperate the namespace URI // from the local name. // // To deal with special cases like xml:space, when the URI is empty we revert to // using the prefix ":" localname notation. //============================================================================== String QName::getUniversalName() const { if(!m_namespaceURI.empty()) return m_namespaceURI + String(QC_T("^")) + getLocalName(); else return m_rawName; }
void TreeKeyIdx::setText(const char *ikey) { char *buf = 0; stdstr(&buf, ikey); SWBuf leaf = strtok(buf, "/"); leaf.trim(); root(); while ((leaf.size()) && (!popError())) { bool ok, inChild = false; error = KEYERR_OUTOFBOUNDS; for (ok = firstChild(); ok; ok = nextSibling()) { inChild = true; if (leaf == getLocalName()) { error = 0; break; } } leaf = strtok(0, "/"); leaf.trim(); if (!ok) { if (inChild) { // if we didn't find a matching child node, default to first child parent(); firstChild(); } error = KEYERR_OUTOFBOUNDS; } } if (leaf.size()) error = KEYERR_OUTOFBOUNDS; delete [] buf; unsnappedKeyText = ikey; positionChanged(); }
void GeneratorLIDL::doHome(IR__::HomeDef_ptr home) { // // implicit home // out << "//\n// implicit home for " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << "Implicit\n"; out << "{\n"; out.indent(); out << "::Components::EnterpriseComponent create() raises (Components::CreateFailure);\n"; out.unindent(); out << "};\n\n"; // // explicit home // out << "//\n// explicit home for " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << "Explicit : "; IR__::HomeDef_var base = home->base_home(); if(base) { out << getLocalName(base); out << "Explicit"; } else { out << "::Components::HomeExecutorBase"; } // supported interfaces IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces(); for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) { out << ", " << map_absolute_name((*supp_intfs)[i]); }; out << "\n{\n"; out.indent(); managed_component_ = map_absolute_name(home->managed_component()); handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); out.unindent(); out << "};\n\n"; // // home // out << "//\n// " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << " : CCM_" << home->name() << "Implicit, CCM_"; out << home->name() << "Explicit\n{\n};\n\n"; }
void DeleteItem::setChecked(bool arg) { if (m_checked != arg) { m_checked = arg; qDebug()<<"setChecked"<<getLocalName()<<m_checked; emit checkedChanged(arg); } }
const DOMStringType XercesDOM_TextHack::getLocalNameImpl() const { #if defined(XALAN_USE_XERCES_INTERNAL_CLASSES) return getImpl()->getLocalName(); #else return getLocalName(); #endif }
void TypeNode::getFullName(std::string& name) { std::string localName; name.clear(); std::vector<TypeNode*> enclosings; getEnclosings(enclosings); auto it = enclosings.begin(); auto end = enclosings.end(); for (; it != end; ++it) { TypeNode* enclosing = *it; enclosing->getLocalName(localName); name += localName + "::"; } getLocalName(localName); name += localName; }
QualifiedName ParserVocabulary::resolveQualifiedName(const QualifiedNameOrIndex &nameOrIndex) const { assert(nameOrIndex._nameSurrogateIndex == INDEX_NOT_SET); std::string prefix, namespaceName, localName; if (nameOrIndex._prefix._stringIndex == INDEX_NOT_SET) { OCTETS2STRING(nameOrIndex._prefix._literalCharacterString, prefix); } else { prefix = getPrefix(nameOrIndex._prefix._stringIndex); } if (nameOrIndex._namespaceName._stringIndex == INDEX_NOT_SET) { OCTETS2STRING(nameOrIndex._namespaceName._literalCharacterString, namespaceName); } else { namespaceName = getNamespaceName(nameOrIndex._namespaceName._stringIndex); } if (nameOrIndex._localName._stringIndex == INDEX_NOT_SET) { OCTETS2STRING(nameOrIndex._localName._literalCharacterString, localName); } else { localName = getLocalName(nameOrIndex._localName._stringIndex); } return QualifiedName(prefix, namespaceName, localName); }
void GeneratorBusinessH::doComposition(CIDL::CompositionDef_ptr composition) { CORBA::ULong i ; composition_ = CIDL::CompositionDef::_duplicate(composition); filename_ = ""; // // determine whether defined in module (needed for namespace opening and closing) // IR__::Contained_ptr module_def = 0; string id = composition->id(); string::size_type pos = id.find_last_of("/"); if(pos != string::npos) { id.replace(pos, string::npos, ":1.0"); module_def = repository_->lookup_id(id.c_str()); filename_ = getAbsoluteName(module_def, "_"); filename_.append("_"); } filename_.append(composition->name()); string header_name = filename_; filename_.append(".h"); // // parse for user sections and write header in the output file // out.initUserSections(filename_.c_str()); out.open(filename_.c_str()); out << "//\n"; out << "// generated by Qedo\n"; out << "//\n\n"; out << "#ifndef _" << header_name << "_H_\n"; out << "#define _" << header_name << "_H_\n\n\n"; out.insertUserSection("file_pre", 2); out << "#include <CORBA.h>\n"; out << "#include \"" << file_prefix_ << "_BUSINESS.h\"\n"; if(composition->lifecycle()==CIDL::lc_Entity || composition->lifecycle()==CIDL::lc_Process) out << "#include \"" << file_prefix_ << "_PSS.h\"\n"; out << "#include \"valuetypes.h\"\n"; out << "#include \"RefCountBase.h\"\n"; if(composition->lifecycle()==CIDL::lc_Entity) out << "#include \"CCMContext.h\"\n"; out << "#include <string>\n\n\n"; out.insertUserSection("file_post", 2); if(module_def) { open_module(out, module_def); out << "namespace " << mapName(module_def) << "\n{\n"; out.indent(); } CIDL::SegmentDefSeq_var segment_seq = composition->executor_def()->segments(); std::string executor_name = composition->executor_def()->name(); std::string executor_class_name = mapName(executor_name); std::string executor_locator_name = composition->name(); std::string executor_locator_class_name = mapName(executor_locator_name); std::string home_name = composition->home_executor()->name(); std::string home_class_name = mapName(home_name); // // executor // out << "\n//\n// executor\n//\n"; out << "class " << executor_class_name << "\n"; out.indent(); out << ": public virtual CORBA::LocalObject\n"; out << ", public virtual " << mapScopeName(composition) << "::CCM_" << executor_name << "\n"; out.unindent(); out.unindent(); out << "#ifndef MICO_ORB\n"; out.indent(); out.indent(); out << ", public virtual Qedo::RefCountLocalObject\n"; out.unindent(); out.unindent(); out << "#endif\n"; out.indent(); out.indent(); out.insertUserSection(string("INHERITANCE_") + executor_name, 0); out.unindent(); out << "{\n\n"; out << "private:\n\n"; out.indent(); out << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_var context_;\n\n"; out.unindent(); out << "public:\n\n"; out.indent(); switch(composition->lifecycle()) { case CIDL::lc_Session : out << executor_class_name << "();\n"; break; case CIDL::lc_Entity : out << executor_class_name << "(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey);\n"; break; default : out << "// not supported lifecycle\n"; } out << "virtual ~" << executor_class_name << "();\n\n"; out << "void set_context(" << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_ptr context)\n"; out << " throw (CORBA::SystemException, Components::CCMException);\n\n"; out << "void configuration_complete()\n"; out << " throw (CORBA::SystemException, Components::InvalidConfiguration);\n\n"; out << "void remove()\n"; out << " throw (CORBA::SystemException);\n\n"; if(composition->lifecycle() == CIDL::lc_Service) { out << "void preinvoke(const char* comp_id, const char* operation)\n"; out << " throw (CORBA::SystemException);\n\n"; out << "void postinvoke(const char* comp_id, const char* operation)\n"; out << " throw (CORBA::SystemException);\n\n"; } need_push_ = true; doComponent(composition->ccm_component()); out.unindent(); out << "\n"; out.insertUserSection(executor_name); out << "};\n\n"; // // segment // for (i = 0; i < segment_seq->length(); i++) { std::string segment_name = segment_seq[i]->name(); std::string segment_class_name = mapName(segment_name); out << "\n//\n// segment\n//\n"; out << "class " << segment_class_name << "\n"; out.indent(); out << ": public virtual CORBA::LocalObject\n"; out << ", public virtual " << mapScopeName(composition) << "::CCM_" << segment_name << "\n"; out.unindent(); out.unindent(); out << "#ifndef MICO_ORB\n"; out.indent(); out.indent(); out << ", public virtual Qedo::RefCountLocalObject\n"; out.unindent(); out.unindent(); out << "#endif\n"; out.indent(); out.indent(); out.insertUserSection(string("INHERITANCE_") + segment_name, 0); out.unindent(); out << "{\n\n"; out << "private:\n\n"; out.indent(); out << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_var context_;\n\n"; out.unindent(); out << "public:\n\n"; out.indent(); out << segment_class_name << "();\n"; out << "virtual ~" << segment_class_name << "();\n\n"; out << "void set_context(" << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_ptr context)\n"; out << " throw (CORBA::SystemException, Components::CCMException);\n\n"; out << "void configuration_complete()\n"; out << " throw (CORBA::SystemException, Components::InvalidConfiguration);\n\n"; // // for each implemented facet // IR__::ProvidesDefSeq_var provided_seq = segment_seq[i]->provided_facets(); handled_interfaces_.clear(); for (CORBA::ULong ii = 0; ii < provided_seq->length(); ii++) { IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provided_seq[ii]->interface_type()); if( !CORBA::is_nil(intf) ) { doInterface(intf); } } out.unindent(); out << "\n"; out.insertUserSection(segment_name); out << "};\n\n"; } // // executor locator // out << "\n//\n// executor locator\n//\n"; out << "class " << executor_locator_class_name << "\n"; out.indent(); out << ": public virtual CORBA::LocalObject\n"; // // determin the lifecycle // CIDL::LifecycleCategory lc = composition->lifecycle(); switch(lc) { case (CIDL::lc_Service) : { // this is a prelimenary version of container service out << ", public virtual Components::CCMService\n"; } case (CIDL::lc_Session) : { out << ", public virtual Components::SessionExecutorLocator\n"; break; } case (CIDL::lc_Entity) : { out << ", public virtual Components::EntityExecutorLocator\n"; break; } case (CIDL::lc_Extension) : { out << ", public virtual Components::ExtensionExecutorLocator\n"; break; } default: { //unsupported lifecycle category } } out.unindent(); out.unindent(); out << "#ifndef MICO_ORB\n"; out.indent(); out.indent(); out << ", public virtual Qedo::RefCountLocalObject\n"; out.unindent(); out.unindent(); out << "#endif\n"; out.indent(); out.indent(); out.insertUserSection(string("INHERITANCE_") + executor_locator_name, 0); out.unindent(); out << "{\n\n"; out << "private:\n\n"; out.indent(); out << mapFullNameLocal(composition->ccm_component()) << "_ContextImpl_var context_;\n\n"; out << mapName(composition->executor_def()) << "* component_;\n\n"; for (i = 0; i < segment_seq->length(); i++) { out << mapName(segment_seq[i]) << "* " << segment_seq[i]->name() << "_;\n\n"; } out.unindent(); out << "public:\n\n"; out.indent(); switch(composition->lifecycle()) { case CIDL::lc_Session : out << executor_locator_class_name << "();\n"; break; case CIDL::lc_Entity : out << executor_locator_class_name << "(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey);\n"; break; default : out << "// not supported lifecycle\n"; } out << "virtual ~" << executor_locator_class_name << "();\n\n"; IR__::InterfaceDef_ptr executor_locator; switch(lc) { case (CIDL::lc_Service) : { //prelimenary version of container services executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/CCMService:1.0")); break; } case (CIDL::lc_Session) : { executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/SessionExecutorLocator:1.0")); break; } case (CIDL::lc_Entity) : { executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/EntityExecutorLocator:1.0")); break; } case (CIDL::lc_Extension) : { executor_locator = IR__::InterfaceDef::_narrow(repository_->lookup_id("IDL:Components/ExtensionExecutorLocator:1.0")); break; } default: { //unsupported lifecycle category } } doInterface(executor_locator); out.unindent(); out << "\n"; out.insertUserSection(executor_locator_name); out << "};\n\n"; // // home executor // out << "\n//\n// home executor\n//\n"; out << "class " << home_class_name << "\n"; out.indent(); out << ": public virtual CORBA::LocalObject\n"; out << ", public virtual " << getLocalName(composition->ccm_home()) << "\n"; out.unindent(); out.unindent(); out << "#ifndef MICO_ORB\n"; out.indent(); out.indent(); out << ", public virtual Qedo::RefCountLocalObject\n"; out.unindent(); out.unindent(); out << "#endif\n"; out.indent(); out.indent(); out.insertUserSection(std::string("INHERITANCE_") + home_name, 0); out.unindent(); out << "{\n\n"; out << "private:\n\n"; out.indent(); out << "Components::HomeContext_var context_;\n\n"; out.unindent(); out << "public:\n"; out.indent(); out << home_class_name << "();\n"; out << "virtual ~" << home_class_name << "();\n\n"; out << "//\n// IDL:Components/HomeExecutorBase/set_context:1.0\n//\n"; out << "virtual void set_context (Components::HomeContext_ptr ctx)\n"; out << " throw (CORBA::SystemException, Components::CCMException);\n\n"; out << "//\n// IDL:Components/HomeExecutorBase/set_storagehome_in_context:1.0\n//\n"; out << "virtual void set_storagehome_in_context (::CosPersistentState::StorageHomeBase_ptr storHomeBase)\n"; out << " throw (CORBA::SystemException, Components::CCMException);\n\n"; out << "//\n// IDL:Components/HomeExecutorBase/get_storagehome_from_context:1.0\n//\n"; out << "virtual ::CosPersistentState::StorageHomeBase_ptr get_storagehome_from_context ()\n"; out << " throw (CORBA::SystemException, Components::CCMException);\n\n"; out << "//\n// IDL:.../create:1.0\n//\n"; switch(composition->lifecycle()) { case CIDL::lc_Session : out << "virtual ::Components::EnterpriseComponent_ptr create()\n"; out << " throw (CORBA::SystemException, Components::CreateFailure);\n"; break; case CIDL::lc_Entity : out << "virtual ::Components::EnterpriseComponent_ptr create(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey)\n"; out << " throw(CORBA::SystemException, Components::CreateFailure, Components::DuplicateKeyValue, Components::InvalidKey);\n\n"; /* out << "virtual ::Components::EnterpriseComponent_ptr find_by_primary_key(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey)\n"; out << " throw(CORBA::SystemException, Components::FinderFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n"; out << "void remove(" << mapFullNamePK(composition->ccm_home()->primary_key()) << "* pkey)\n"; out << " throw(CORBA::SystemException, Components::RemoveFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n"; */ //get_primary_key(...)??? !!! break; default : out << "// not supported lifecycle\n"; } doHome(composition->ccm_home()); out.unindent(); out << "\n"; out.insertUserSection(home_name); out << "};\n\n"; // close namespace if(module_def) { out.unindent(); out << "};\n"; close_module(out, module_def); } // // entry point // out << "\n//\n// entry point\n//\n"; out << "extern \"C\" {\n"; out << "#ifdef _WIN32\n"; out << "__declspec(dllexport)\n"; out << "#else\n"; out << "#endif\n"; out << "::Components::HomeExecutorBase_ptr create_" << composition->ccm_home()->name() << "E(void);\n"; out << "}\n\n"; out << "#endif\n"; out.close(); }
//============================================================================== // QName::::operator<() // // Used for sorting QNames lexicographically. // The XML Canonicalization recommendation suggests that attributes // short be sorted, using the namespace uri as the primary key and the local // name as the secondary key. //============================================================================== bool QName::operator<(const QName& rhs) const { return (m_namespaceURI < rhs.m_namespaceURI || (m_namespaceURI == rhs.m_namespaceURI && getLocalName() < rhs.getLocalName())); }
void GeneratorLIDL::doComponent(IR__::ComponentDef_ptr component) { component_ = IR__::ComponentDef::_duplicate(component); handleSink(component); // // executor // out << "//\n// executor for " << component->id() << "\n//\n"; out << "local interface CCM_" << component->name() << "_Executor : "; // base component IR__::ComponentDef_var base = component->base_component(); if(!CORBA::is_nil(base)) { out << getLocalName(base) << "_Executor"; } else { out << "::Components::EnterpriseComponent"; } // supported interfaces IR__::InterfaceDefSeq_var supported_seq = component->supported_interfaces(); CORBA::ULong len = supported_seq->length(); if(len) { CORBA::ULong i; for( i= 0; i < len; i++) { out << ", " << map_absolute_name((*supported_seq)[i]); } } // sinks IR__::SinkDefSeq_var sink_seq = component->sinks(); len = sink_seq->length(); if(len) { CORBA::ULong i; for( i= 0; i < len; i++) { out << ", CCM_" << component->name() << "_" << (*sink_seq)[i]->name() << "_Sink"; } } out << "\n{\n"; out.indent(); handleAttribute(component); out.unindent(); out << "};\n\n"; // // context // out << "//\n// context for " << component->id() << "\n//\n"; out << "local interface CCM_" << component->name() << "_Context : "; // base component if(!CORBA::is_nil(base)) { out << getLocalName(base) << "_Context"; } else { out << "::Components::CCMContext"; } out << "\n{\n"; out.indent(); handleUses(component); handleEmits(component); handlePublishes(component); handleSource(component); out.unindent(); out << "};\n\n"; }
// // composition // void GeneratorBIDL::doComposition(CIDL::CompositionDef_ptr composition) { // // get the module where the composition is defined in and open it // string id = composition->id(); IR__::Contained_ptr module_def = 0; string::size_type pos = id.find_last_of("/"); if(pos != string::npos) { id.replace(pos, string::npos, ":1.0"); module_def = repository_->lookup_id(id.c_str()); open_module(module_def); out << "\nmodule " << module_def->name() << "\n{\n"; out.indent(); } string facet_type; t_string_map facet_types; t_string_map implemented_facets; CORBA::ULong i; // // local interface for each segment // CIDL::SegmentDefSeq_var segment_seq = composition->executor_def()->segments(); CORBA::ULong len = segment_seq->length(); for (i = 0; i < len; i++) { facet_types.clear(); out << "//\n// " << segment_seq[i]->id() << "\n//\n"; out << "local interface CCM_" << segment_seq[i]->name() << " : ::Components::EnterpriseComponent"; // inherit from each implemented facet type IR__::ProvidesDefSeq_var provided_seq = segment_seq[i]->provided_facets(); for (CORBA::ULong ii = 0; ii < provided_seq->length(); ii++) { implemented_facets[provided_seq[ii]->name()] = true; IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provided_seq[ii]->interface_type()); if( !CORBA::is_nil(intf) ) { facet_type = intf->id(); } else { facet_type = "IDL:omg.org/CORBA/Object:1.0"; } // if type already inherited, skip it if(facet_types.find(facet_type) == facet_types.end()) { out << ", " << getLocalName(provided_seq[ii]->interface_type()); facet_types[facet_type] = true; } } out << "\n{\n};\n\n"; } // // local interface for the executor // facet_types.clear(); out << "//\n// " << composition->executor_def()->id() << "\n//\n"; out << "local interface CCM_" << composition->executor_def()->name() << " : "; out << getLocalName(composition->ccm_component()) << "_Executor"; this -> gen_facet(composition->ccm_component(), implemented_facets, facet_types); /* // // inherit from each implemented facet type // IR__::ProvidesDefSeq_var provides_seq = composition->ccm_component()->provides_interfaces(); len = provides_seq->length(); for (i = 0; i < len; i++) { IR__::InterfaceDef_var intf = IR__::InterfaceDef::_narrow(provides_seq[i]->interface_type()); if( CORBA::is_nil(intf) ) { continue; } // // facet not already implemented by segment // if(implemented_facets.find(provides_seq[i]->name()) == implemented_facets.end()) { // if type already inherited, skip it facet_type = intf->id(); if(facet_types.find(facet_type) == facet_types.end()) { facet_types[facet_type] = true; if(!facet_types.empty()) { out << ", "; } out << getLocalName(intf); } } } */ /* // inherit from consumer for each event facet_types.clear(); IR__::ConsumesDefSeq_var consumes_seq = composition->ccm_component()->consumes_events(); len = consumes_seq->length(); for (i = 0; i < len; i++) { facet_type = consumes_seq[i]->event()->id(); // if type already inherited, skip it if(facet_types.find(facet_type) == facet_types.end()) { facet_types[facet_type] = true; out << ", " << getLocalName(consumes_seq[i]->event()) << "Consumer"; } } */ out << "\n{\n};\n\n"; if(module_def) { out.unindent(); out << "};\n"; close_module(module_def); } }
void GeneratorLIDL::doHome(IR__::HomeDef_ptr home) { // // implicit home // IR__::PrimaryKeyDef_ptr pk = home->primary_key(); if(!CORBA::is_nil(pk)) { out << "//\n// implicit home for " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << "Implicit\n"; out << "{\n"; out.indent(); out << "::Components::EnterpriseComponent create(in " << pk->name() << " key)\n"; out.indent(); out << "raises (Components::CreateFailure, Components::DuplicateKeyValue, Components::InvalidKey);\n\n"; out.unindent(); /* out << "::Components::EnterpriseComponent find_by_primary_key(in " << pk->name() << " key)\n"; out.indent(); out << "raises (Components::FinderFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n"; out.unindent(); out << "void remove(in " << pk->name() << " key)\n"; out.indent(); out << "raises (Components::RemoveFailure, Components::UnknownKeyValue, Components::InvalidKey);\n\n"; out.unindent(); */ out.unindent(); out << "};\n\n"; //get_primary_key(...)??? !!! } else { out << "//\n// implicit home for " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << "Implicit\n"; out << "{\n"; out.indent(); out << "::Components::EnterpriseComponent create() raises (Components::CreateFailure);\n"; out.unindent(); out << "};\n\n"; } // // explicit home // out << "//\n// explicit home for " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << "Explicit : "; IR__::HomeDef_var base = home->base_home(); if(base) { out << getLocalName(base); out << "Explicit"; } else { out << "::Components::HomeExecutorBase"; } // supported interfaces IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces(); for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) { out << ", " << map_absolute_name((*supp_intfs)[i]); }; out << "\n{\n"; out.indent(); managed_component_ = map_absolute_name(home->managed_component()); handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); out.unindent(); out << "};\n\n"; // // home // out << "//\n// " << home->id() << "\n//\n"; out << "local interface CCM_" << home->name() << " : CCM_" << home->name() << "Implicit, CCM_"; out << home->name() << "Explicit\n{\n};\n\n"; }