void GeneratorBusinessH::doHome(IR__::HomeDef_ptr home) { // // base home // IR__::HomeDef_var base = home->base_home(); if(! CORBA::is_nil(base)) { doHome(base); } // // supported interfaces // IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces(); for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) { doInterface((*supp_intfs)[i]); // handleAttribute((*supp_intfs)[i]); // handleOperation((*supp_intfs)[i]); }; handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); }
void GeneratorServantH::genHomeServant(IR__::HomeDef_ptr home, CIDL::LifecycleCategory lc) { // handle base home IR__::HomeDef_var base = home->base_home(); if(base) { genHomeServant(base, lc); } handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); // // supported interfaces // IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces(); for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) { handleAttribute((*supp_intfs)[i]); handleOperation((*supp_intfs)[i]); }; }
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 GeneratorPersistenceH::doAbstractStorageHome(IR__::AbstractStorageHomeDef_ptr abs_storagehome) { IR__::AbstractStorageTypeDef_var abs_storagetype = abs_storagehome->managed_abstract_storagetype(); // achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein? out << "\n\n"; open_module(out, abs_storagetype, ""); out << "\n\n"; out << "class " << std::string(abs_storagetype->name()) << ";\n"; out << "class " << std::string(abs_storagetype->name()) << "Ref;\n\n"; std::string strClassName = std::string(abs_storagehome->name()); strActBasename_ = strClassName; out << "class " << strClassName << "\n"; out.indent(); IR__::InterfaceDefSeq_var abs_storagehome_seq = abs_storagehome->base_abstract_storagehomes(); if(abs_storagehome_seq->length()==0) out << ": public virtual CosPersistentState::StorageHomeBase\n"; else for(CORBA::ULong i=0; i<abs_storagehome_seq->length(); i++) { i==0 ? out << ": " : out << ", "; out << "public virtual " << ((*abs_storagehome_seq)[i])->name() << "\n"; }; out.unindent(); out << "{\n\npublic:\n\n"; out.indent(); //out << strClassName << "();\n"; //out << "~" << strClassName << "();\n"; bAbstract_ = true; handleAttribute(abs_storagehome); handleOperation(abs_storagehome); handleFactory(abs_storagehome); handleKey(abs_storagehome); //generate _duplicate and _downcast operation //genDuplAndDown(strClassName); out.unindent(); out << "};\n\n"; out << "#ifdef ORBACUS_ORB\n"; out << "typedef OB::ObjVar< " << strClassName << " > " << strClassName << "_var;\n"; out << "typedef OB::ObjVar< " << strClassName << " > " << strClassName << "_out;\n"; out << "#endif\n"; out << "#ifdef MICO_ORB\n"; out << "typedef ObjVar< " << strClassName << " > " << strClassName << "_var;\n"; out << "typedef ObjVar< " << strClassName << " > " << strClassName << "_out;\n"; out << "#endif\n"; out << "\n\n"; close_module(out, abs_storagetype); }
// // home // void GeneratorEIDL::doHome(IR__::HomeDef_ptr home) { // // implicit home // out << "//\n// implicit home for " << home->id() << "\n//\n"; out << "interface " << home->name() << "Implicit : ::Components::KeylessCCMHome\n"; out << "{\n"; out.indent(); out << map_absolute_name(home->managed_component()) << " create() raises (Components::CreateFailure);\n"; out.unindent(); out << "};\n\n"; // // explicit home // out << "//\n// explicit home for " << home->id() << "\n//\n"; out << "interface " << home->name() << "Explicit : "; IR__::HomeDef_var base = home->base_home(); if(base) { out << map_absolute_name(base); out << "Explicit"; } else { out << "::Components::CCMHome"; } // 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()); // content with potential order problems doInterfaceContent(home); // content without order problems handleException(home); handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); out.unindent(); out << "};\n\n"; // // home // out << "//\n// " << home->id() << "\n//\n"; out << "interface " << home->name() << " : " << home->name() << "Implicit, "; out << home->name() << "Explicit\n{\n};\n\n"; };
void Writer::open(const std::string &filename) { MLSGPU_ASSERT(!isOpen(), state_error); handle = handleFactory(); handle->open(filename); std::string header = makeHeader(); handle->resize(header.size() + getNumVertices() * vertexSize + getNumTriangles() * triangleSize); handle->write(header.data(), header.size(), 0); vertexStart = header.size(); triangleStart = vertexStart + getNumVertices() * vertexSize; }
void GeneratorPersistenceH::genAbstractObjsForConcreteHome(IR__::AbstractStorageHomeDef_ptr abs_storagehome) { IR__::InterfaceDefSeq_var abs_storagehome_seq = abs_storagehome->base_abstract_storagehomes(); for(CORBA::ULong i=0; i<abs_storagehome_seq->length(); i++) { IR__::AbstractStorageHomeDef_var abs_storagehome_inh; abs_storagehome_inh = IR__::AbstractStorageHomeDef::_narrow((*abs_storagehome_seq)[i]); bAbstract_ = false; bASHKey_ = true; handleAttribute(abs_storagehome_inh); handleOperation(abs_storagehome_inh); handleFactory(abs_storagehome_inh); handleKey(abs_storagehome_inh); } bAbstract_ = false; bASHKey_ = true; handleAttribute(abs_storagehome); handleOperation(abs_storagehome); handleFactory(abs_storagehome); handleKey(abs_storagehome); }
void GeneratorPersistenceC::doAbstractStorageHome(IR__::AbstractStorageHomeDef_ptr abs_storage_home) { // // base storage homes // IR__::InterfaceDefSeq_var inh_intfs = abs_storage_home -> base_abstract_storage_homes(); for(CORBA::ULong i = 0; i < inh_intfs->length(); i++) { if(! CORBA::is_nil((*inh_intfs)[i])) { IR__::InterfaceDef_ptr temp_if = (*inh_intfs)[i]; IR__::AbstractStorageHomeDef_ptr abs_temp_if = dynamic_cast <IR__::AbstractStorageHomeDef_ptr> (temp_if); doAbstractStorageHome(abs_temp_if); } }; handleAttribute(abs_storage_home); handleOperation(abs_storage_home); handleFactory(abs_storage_home); handlePSSKey(abs_storage_home); }
void GeneratorServantH::genHomeServant(IR__::HomeDef_ptr home, CIDL::LifecycleCategory lc) { // handle base home IR__::HomeDef_var base = home->base_home(); if(base) { genHomeServant(base, lc); } handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); // // supported interfaces // IR__::InterfaceDefSeq_var supp_intfs = home -> supported_interfaces(); for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) { doInterface((*supp_intfs)[i]); //handleAttribute((*supp_intfs)[i]); //handleOperation((*supp_intfs)[i]); }; if(lc==CIDL::lc_Entity || lc==CIDL::lc_Process) { out << "\nvoid get_table_info(std::map<std::string, std::string>& mTables);\n\n"; out << "void init_datastore(const Connector_ptr pConn, const Sessio_ptr pSession);\n"; out.unindent(); out << "\nprivate:\n\n"; out.indent(); out << "bool compare_primarykey(" << mapFullNamePK(home->primary_key()) << "* pk_a, " << mapFullNamePK(home->primary_key()) << "* pk_b);\n\n"; out << strNamespace_ << "::" << home->name() << "Persistence* pCcmStorageHome_;\n"; if( !CORBA::is_nil(storagehome_) ) // there is binds_to out << strNamespace_ << "::" << storagehome_->name() << "* pPssStorageHome_;\n"; out << "\n"; } }
void GeneratorPersistenceC::doStorageHome(IR__::StorageHomeDef_ptr storage_home) { // base storage home IR__::StorageHomeDef_var base = storage_home->base_storage_home(); if(! CORBA::is_nil(base)) { doStorageHome(base); } // supported interfaces IR__::InterfaceDefSeq_var supp_intfs = storage_home -> supported_interfaces(); for(CORBA::ULong i = 0; i < supp_intfs->length(); i++) { handleAttribute((*supp_intfs)[i]); handleOperation((*supp_intfs)[i]); }; handleAttribute(storage_home); handleOperation(storage_home); handleFactory(storage_home); handlePSSKey(storage_home); }
// // home // void GeneratorEIDL::doHome(IR__::HomeDef_ptr home) { // // implicit home // IR__::PrimaryKeyDef_ptr pk = home->primary_key(); if(!CORBA::is_nil(pk)) { //"copying" declaration of valuetype defined for primary key into EIDL. //At the moment this is the better way to handle with it, however, //it should be improved, for it is possible, that one primary key is //used by several different homes. /* out << "//\n// valuetype for primary key\n//\n"; IR__::ValueDef_var act_value = pk->primary_key(); out << "valuetype " << act_value->name() << "\n"; out.indent(); out << ": Components::PrimaryKeyBase\n"; IR__::ValueDefSeq_var support_seq = act_value->abstract_base_values(); CORBA::ULong len = support_seq->length(); for(CORBA::ULong i = 0; i < len; i++) { char* szTemp = ((*support_seq)[i])->name(); if(strcmp(szTemp, "PrimaryKeyBase")==0) continue; if(i==0) out << ": " << szTemp << "\n"; else out << ", " << szTemp << "\n"; } out.unindent(); out << "{\n"; //only attributes can be defined in a valuetype which is specially for a primary key IR__::ContainedSeq_var contained_seq = act_value->contents(CORBA__::dk_ValueMember, true); len = contained_seq->length(); out.indent(); for(i = 0; i < len; i++) { IR__::ValueMemberDef_var vMember = IR__::ValueMemberDef::_narrow((*contained_seq)[i]); (vMember->access()==CORBA__::PUBLIC_MEMBER) ? out << "public " : out << "private "; out << map_idl_type(vMember->type_def()) << " " << vMember->name() << ";\n"; } out.unindent(); out << "};\n\n"; */ out << "//\n// implicit home for " << home->id() << "\n//\n"; out << "interface " << home->name() << "Implicit\n"; out << "{\n"; out.indent(); char* szt = pk->name(); out << map_absolute_name(home->managed_component()) << " create(in " << pk->name() << " key)\n"; out.indent(); out << "raises (Components::CreateFailure, Components::DuplicateKeyValue, Components::InvalidKey);\n\n"; out.unindent(); out << map_absolute_name(home->managed_component()) << " 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 << pk->name() << " get_primary_key(in " << map_absolute_name(home->managed_component()) << " comp);\n"; out.unindent(); out << "};\n\n"; } else { out << "//\n// implicit home for " << home->id() << "\n//\n"; out << "interface " << home->name() << "Implicit : ::Components::KeylessCCMHome\n"; out << "{\n"; out.indent(); out << map_absolute_name(home->managed_component()) << " create() raises (Components::CreateFailure);\n"; out.unindent(); out << "};\n\n"; } // // explicit home // out << "//\n// explicit home for " << home->id() << "\n//\n"; out << "interface " << home->name() << "Explicit : "; IR__::HomeDef_var base = home->base_home(); if(base) { out << map_absolute_name(base); out << "Explicit"; } else { out << "::Components::CCMHome"; } // 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()); // content with potential order problems doInterfaceContent(home); // content without order problems handleException(home); handleAttribute(home); handleOperation(home); handleFactory(home); handleFinder(home); out.unindent(); out << "};\n\n"; // // home // out << "//\n// " << home->id() << "\n//\n"; out << "interface " << home->name() << " : " << home->name() << "Implicit, "; out << home->name() << "Explicit\n{\n};\n\n"; };
void GeneratorServantC::genHomeServant(IR__::HomeDef_ptr home) { CORBA::ULong i; CORBA::ULong ii; // handle base home IR__::HomeDef_var base = home->base_home(); if(base) { genHomeServant(base); } home_ = IR__::HomeDef::_duplicate(home); std::string home_name = mapFullNameLocal(home); // attributes IR__::ContainedSeq_var contained_seq = home->contents(CORBA__::dk_Attribute, false); CORBA::ULong len = contained_seq->length(); for(i = 0; i < len; i++) { IR__::AttributeDef_var attribute = IR__::AttributeDef::_narrow(((*contained_seq)[i])); std::string attribute_name = mapName(attribute); // not read only if(attribute->mode() == IR__::ATTR_NORMAL) { out << "void" << "\n"; out << class_name_ << "::" << attribute_name << "("; out << map_in_parameter_type(attribute->type_def()) << " param)\n"; out << "throw(CORBA::SystemException"; handleException(attribute); out << ")\n{\n"; out.indent(); out << home_name << "_ptr home_executor = dynamic_cast <"; out << home_name << "_ptr> (home_executor_.in());\n"; out << "if (! home_executor)\n{\n"; out.indent(); out << "NORMAL_ERR (\"Home_servant: Cannot cast my executor\");\n"; out << "throw Components::CreateFailure();\n"; out.unindent(); out << "}\n\n"; out << "home_executor->" << attribute_name << "(param);\n"; out.unindent(); out << "}\n\n\n"; } out << map_return_type(attribute->type_def()) << "\n"; out << class_name_ << "::" << attribute_name << "()\n"; out << "throw(CORBA::SystemException"; handleException(attribute); out << ")\n{\n"; out.indent(); out << home_name << "_ptr home_executor = dynamic_cast <"; out << home_name << "_ptr> (home_executor_.in());\n"; out << "if (! home_executor)\n{\n"; out.indent(); out << "NORMAL_ERR (\"Home_servant: Cannot cast my executor\");\n"; out << "throw Components::CreateFailure();\n"; out.unindent(); out << "}\n\n"; out << "return home_executor->" << attribute_name << "();\n"; out.unindent(); out << "}\n\n\n"; } // operations contained_seq = home->contents(CORBA__::dk_Operation, false); len = contained_seq->length(); for(i = 0; i < len; i++) { IR__::OperationDef_var operation = IR__::OperationDef::_narrow(((*contained_seq)[i])); std::string operation_name = mapName(operation); bool is_void = false; if(operation->result_def()->type()->kind() == CORBA::tk_void) { is_void = true; } out << map_return_type(operation->result_def()) << "\n"; out << class_name_ << "::" << operation_name << "("; IR__::ParDescriptionSeq* pards = operation->params(); CORBA::ULong len = pards->length(); for(ii = len; ii > 0; ii--) { if(ii < len) { out << ", "; } IR__::ParameterDescription pardescr = (*pards)[ii - 1]; out << map_in_parameter_type (pardescr.type_def) << " " << mapName(string(pardescr.name)); } out << ")\n"; out << "throw(CORBA::SystemException"; handleException(operation); out << ")\n{\n"; out.indent(); out << home_name << "_ptr home_executor = dynamic_cast <"; out << home_name << "_ptr> (home_executor_.in());\n"; out << "if (! home_executor)\n{\n"; out.indent(); out << "NORMAL_ERR (\"Home_servant: Cannot cast my executor\");\n"; out << "throw Components::CreateFailure();\n"; out.unindent(); out << "}\n\n"; if(!is_void) { out << "return "; } out << "home_executor->" << operation_name << "("; for(ii = len; ii > 0; ii--) { if(ii < len) { out << ", "; } IR__::ParameterDescription pardescr = (*pards)[ii - 1]; out << mapName(string(pardescr.name)); } out << ");\n"; out.unindent(); out << "}\n\n\n"; } handleFactory(home); handleFinder(home); }
void GeneratorPersistenceH::doStorageHome(IR__::StorageHomeDef_ptr storagehome) { IR__::StorageTypeDef_var storagetype = storagehome->managed_storagetype(); // achtung: wenn kein modul, sollte vielleicht PSS_ der prefix für alle pss sein? out << "\n\n"; open_module(out, storagetype, ""); out << "\n\n"; out << "class " << std::string(storagetype->name()) << ";\n"; out << "class " << std::string(storagetype->name()) << "Ref;\n\n"; std::string strClassName = std::string(storagehome->name()); strActBasename_ = strClassName; out << "class " << strClassName << "\n"; out.indent(); IR__::StorageHomeDef_var base_storagehome = storagehome->base_storagehome(); if(base_storagehome) out << ": public virtual " << base_storagehome->name() << "\n"; else out << ": public virtual StorageHomeBaseImpl\n"; IR__::InterfaceDefSeq_var supported_infs = storagehome->supported_interfaces(); for(CORBA::ULong i=0; i<supported_infs->length(); i++) out << ", public virtual " << ((*supported_infs)[i])->name() << "\n"; out.unindent(); out << "{\n\npublic:\n\n"; out.indent(); out << strClassName << "();\n"; out << "~" << strClassName << "();\n\n"; genCreateOperation(storagehome, false); genCreateOperation(storagehome, true); // //generate find_(ref)_by_primary_key, which is appropriate to find_by_primary_key from home // if( composition_->lifecycle()==CIDL::lc_Entity ) { IR__::HomeDef_var home = composition_->ccm_home(); IR__::PrimaryKeyDef_var pkey = IR__::PrimaryKeyDef::_duplicate(home->primary_key()); if( !CORBA::is_nil(pkey) ) { out << map_psdl_return_type(storagetype, false) << " find_by_primary_key(" << mapFullNamePK(pkey) << "* pkey)\n"; out.indent(); out << "throw(CosPersistentState::NotFound);\n"; out.unindent(); } } for(CORBA::ULong i=0; i<supported_infs->length(); i++) { IR__::AbstractStorageHomeDef_var abs_storagehome_inh; abs_storagehome_inh = IR__::AbstractStorageHomeDef::_narrow((*supported_infs)[i]); genAbstractObjsForConcreteHome(abs_storagehome_inh); }; bAbstract_ = false; bASHKey_ = false; handleAttribute(storagehome); handleOperation(storagehome); handleFactory(storagehome); handleKey(storagehome); //generate _duplicate and _downcast operation //genDuplAndDown(strClassName); out.unindent(); out << "};\n\n\n"; out << "typedef HomeFactoryTemplate<" << storagehome->name() << "> " << storagehome->name() << "Factory;\n\n"; close_module(out, storagetype); }
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"; }