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
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++) {
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};

	handleAttribute(home);
	handleOperation(home);
	handleFactory(home);
	handleFinder(home);
}
void
GeneratorPersistenceH::genAbstractObjsForConcreteType(IR__::AbstractStorageTypeDef_ptr abs_storagetype)
{
	IR__::InterfaceDefSeq_var abs_storagetype_seq = abs_storagetype->base_abstract_storagetypes();
	for(CORBA::ULong i=0; i<abs_storagetype_seq->length(); i++) 
	{
		bAbstract_ = false;
		handleAttribute((*abs_storagetype_seq)[i]);
		handleOperation((*abs_storagetype_seq)[i]);
	}

	bAbstract_ = false;
	handleAttribute(abs_storagetype);
	handleOperation(abs_storagetype);
}
void
GeneratorValuetypesC::doInterface(IR__::InterfaceDef_ptr intf)
{
	//
	// check whether this interface was already handled
	//
	if (handled_interfaces_.find(intf->id()) != handled_interfaces_.end())
	{
		return;
	} 
	handled_interfaces_.insert(intf->id());

	//
	// base interfaces
	//
	IR__::InterfaceDefSeq_var base_seq = intf->base_interfaces();
	CORBA::ULong len = base_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		doInterface((*base_seq)[i]);
	}

	handleAttribute(intf);
	handleOperation(intf);
}
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";
}
//
// 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 
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);
}
Esempio n. 8
0
Router::RouterResult Router::handleObject(const Root& obj)
{
    if (obj->instanceOf(Atlas::Objects::Operation::ROOT_OPERATION_NO))
        return handleOperation(smart_dynamic_cast<RootOperation>(obj));

    if (obj->instanceOf(Atlas::Objects::Entity::ROOT_ENTITY_NO))
        return handleEntity(smart_dynamic_cast<RootEntity>(obj));

    throw InvalidOperation("router got an object that is not an op or entity");
}
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);
}
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
GeneratorServantH::doInterface(IR__::InterfaceDef_ptr intf)
{
	// base interfaces
	IR__::InterfaceDefSeq_var base_seq = intf->base_interfaces();
	CORBA::ULong i;
	for( i= 0; i < base_seq->length(); i++)
	{
		doInterface((*base_seq)[i]);
	}

	handleAttribute(intf);
	handleOperation(intf);
}
Esempio n. 12
0
void
GeneratorBase::doInterface(IR__::InterfaceDef_ptr intface)
{
	beginInterface(intface);

	IR__::ContainedSeq_var contained_seq;
	CORBA::ULong len;
	CORBA::ULong i;

	// contained constants
	contained_seq = intface->contents(CORBA__::dk_Constant, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::ConstantDef_var act_constant = IR__::ConstantDef::_narrow(((*contained_seq)[i]));
		doConstant(act_constant);
	}

	// contained typedefs
	contained_seq = intface->contents(CORBA__::dk_Typedef, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::TypedefDef_var act_typedef = IR__::TypedefDef::_narrow(((*contained_seq)[i]));
		doTypedef(act_typedef);
	}

	// contained exceptions
	contained_seq = intface->contents(CORBA__::dk_Exception, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::ExceptionDef_var act_exception = IR__::ExceptionDef::_narrow(((*contained_seq)[i]));
		doException(act_exception);
	}

	// contained attributes
	handleAttribute(intface);

	// contained operations
	handleOperation(intface);

	endInterface(intface);
}
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";
	}
}
Esempio n. 15
0
//
// interface
//
void
GeneratorEIDL::doInterface(IR__::InterfaceDef_ptr intface)
{
	out << "//\n// " << intface->id() << "\n//\n";
	out << "interface " << intface->name();
	
	//
	// base interfaces
	//
	IR__::InterfaceDefSeq_var base_seq = intface->base_interfaces();
	CORBA::ULong len = base_seq->length();
	for(CORBA::ULong i = 0; i < len; i++)
	{
		if(i)
		{
			out << ", ";
		}
		else
		{
			out << " : ";
		}
		out << map_absolute_name((*base_seq)[i]);
	}
	out << "\n{\n";
	out.indent();

	// content with potential order problems
	doInterfaceContent(intface);

	// content without order problems
	handleException(intface);
	handleAttribute(intface);
	handleOperation(intface);

	out.unindent();
	out << "};\n\n";
}
void
GeneratorPersistenceH::genStorageTypeBody(IR__::StorageTypeDef_ptr storagetype/*, bool bRef*/)
{
	std::string strClassName = std::string(storagetype->name());

	out << "class " << strClassName << "\n";
	//bRef ? out << "Ref\n" : out << "\n";
	out.indent();
	
	IR__::StorageTypeDef_var base_storagetype = storagetype->base_storagetype();
	if(base_storagetype)
	{
		out << ": public virtual " << base_storagetype->name() << "\n";
		//bRef ? out << "Ref\n" : out << "\n";
	}
	else
	{
		out << ": public virtual StorageObjectImpl\n";
		//if(bRef) out << "Ref";
		//out << "Impl\n";
	}

	IR__::InterfaceDefSeq_var supported_infs = storagetype->supported_interfaces();
	for(CORBA::ULong i=0; i<supported_infs->length(); i++)
	{
		out << ", public virtual " << ((*supported_infs)[i])->name() << "\n";
		//bRef ? out << "Ref\n" : out << "\n";
	};

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    out << strClassName << "();\n";
	//bRef ? out << "Ref();\n" : out << "();\n";
	out << "~" << strClassName << "();\n";
	//bRef ? out << "Ref();\n" : out << "();\n";

	for(CORBA::ULong i=0; i<supported_infs->length(); i++) 
	{
		IR__::AbstractStorageTypeDef_var abs_storagetype_inh;
		abs_storagetype_inh = IR__::AbstractStorageTypeDef::_narrow((*supported_infs)[i]);
		genAbstractObjsForConcreteType(abs_storagetype_inh);
	};

	bAbstract_ = false;
	handleAttribute(storagetype);
	handleOperation(storagetype);

	out << "\nvoid write_state();\n";
	out << "void read_state();\n";
	out << "void setValue(std::map<std::string, CORBA::Any>& valueMap);\n\n";
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);
	out.unindent();

	genMemberVariable(storagetype);
	
	out << "};\n\n";

	out << "\ntypedef ObjectFactoryTemplate<" << storagetype->name() << "> " << storagetype->name() << "Factory;\n\n\n";
}
Esempio n. 17
0
//
// 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";
};
Esempio n. 18
0
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";
}
void
GeneratorValuetypesH::doValue(IR__::ValueDef_ptr value)
{	
	std::string value_name = value->name();
	std::string class_name = mapName(value_name) + "Impl";

	//
	// value type
	//
	open_module(out, value);
	out << "\n\n//\n// " << value->id() << "\n//\n";
	out << "class " << class_name << "\n";
	out << ": virtual public " << mapFullNameWithPrefix(value, "OBV_") << "\n";
	out << ", virtual public CORBA::DefaultValueRefCountBase\n";
	out.insertUserSection(string("INHERITANCE_") + value_name, 0);
	out << "{\nprivate:\n\n";
	out.indent();
	out << "void operator= (const " << class_name << "& v);\n";
	out << class_name << " (const " << class_name << "& v);\n\n";
	out.unindent();
	out << "public:\n\n";
	out.indent();
	out << class_name << "(";
	generateMemberParam( value, false );
	out << ");\n";
	out << class_name << "();\n";
	out << "~" << class_name << "();\n\n";
	out << "CORBA::ValueBase* _copy_value();\n\n";
	// supported interfaces
	CORBA::ULong i;
	handled_interfaces_.clear();
	IR__::InterfaceDefSeq_var supp_intfs = value->supported_interfaces();
	for(i = 0; i < supp_intfs->length(); i++)
	{
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};
	// base value
	IR__::ValueDef_var base = value->base_value();
	if(! CORBA::is_nil(base))
	{
		// todo
	}
	// abstract base values
	IR__::ValueDefSeq_var abstr = value->abstract_base_values();
	for(i = 0; i < abstr->length(); i++)
	{
		// todo
	};
	out.unindent();
	out.insertUserSection(value_name, 0);
	out << "};\n\n\n";

	//
	// value type factory
	//
	out << "class " << value_name << "FactoryImpl\n";
	out << ": virtual public CORBA::ValueFactoryBase\n{\n";
	out << "private:\n\n";
	out.indent();
	out << "virtual CORBA::ValueBase * create_for_unmarshal();\n\n";
	out.unindent();
	out << "public:\n\n";
	out.indent();
	// initializers
	IR__::InitializerSeq_var ini = value->initializers();
	for(i = 0; i < ini->length(); i++)
	{
		// todo
	};
	out.unindent();
	out.insertUserSection(value_name + "_factory", 0);
	out << "};\n\n\n";

	close_module(out, value);
}
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
GeneratorValuetypesC::doValue(IR__::ValueDef_ptr value)
{
	open_module(out, value);
	class_name_ = mapName(value) + "Impl";
	
	out << "void\n";
	out << class_name_ << "::operator= (const " << class_name_ << "& v)\n{\n";
	out.indent();
	handleValueMember(value);
	out.insertUserSection(class_name_ + "::operator=", 0);
	out.unindent();
	out << "}\n\n\n";

	out << class_name_ << "::" << class_name_ << "(const " << class_name_ << "& v)\n{\n";
	out.indent();
	handleValueMember(value);
	out.insertUserSection(class_name_ + "::" + class_name_ + "1", 0);
	out.unindent();
	out << "}\n\n\n";

	// check whether this value(eventtype) has members.
	IR__::ContainedSeq_var contained_seq = value->contents(CORBA__::dk_ValueMember, false);
	if( contained_seq->length() > 0 ) // if has some, generate the constructor with parameters
	{
		out << class_name_ << "::" << class_name_ << "(";
		generateMemberParam( value, false );
		out << ")\n: " << mapFullNameWithPrefix(value, "OBV_") << "(";
		generateMemberInit( value, false );
		out << ")\n{\n";
		out.indent();
		out.insertUserSection(class_name_ + "::" + class_name_ + "2", 0);
		out.unindent();
		out << "}\n\n\n";
	}

	out << class_name_ << "::" << class_name_ << "()\n{\n";
	out.indent();
	out.insertUserSection(class_name_ + "::" + class_name_ + "3", 0);
	out.unindent();
	out << "}\n\n\n";

	out << class_name_ << "::~" << class_name_ << "()\n{\n";
	out.indent();
	out.insertUserSection(class_name_ + "::~" + class_name_, 0);
	out.unindent();
	out << "}\n\n\n";

	out << "CORBA::ValueBase*\n";
	out << class_name_ << "::_copy_value()\n{\n";
	out.indent();
	out << class_name_ << " *val = new " << class_name_ << "(* this);\n";
	out.insertUserSection(class_name_ + "::_copy_value", 0);
	out << "return val;\n";
	out.unindent();
	out << "}\n\n\n";

	//
	// supported interfaces
	//
	CORBA::ULong i;
	handled_interfaces_.clear();
	IR__::InterfaceDefSeq_var supp_intfs = value->supported_interfaces();
	for(i = 0; i < supp_intfs->length(); i++)
	{
		handleAttribute((*supp_intfs)[i]);
		handleOperation((*supp_intfs)[i]);
	};
	//
	// base value
	//
	IR__::ValueDef_var base = value->base_value();
	if(! CORBA::is_nil(base))
	{
		// todo
	}
	//
	// abstract base values
	//
	IR__::ValueDefSeq_var abstr = value->abstract_base_values();
	for(i = 0; i < abstr->length(); i++)
	{
		// todo
	};

	//
	// value type factory
	//
	out << "CORBA::ValueBase *\n";
	out << value->name() << "FactoryImpl::create_for_unmarshal ()\n{\n";
	out.indent();
	out << "return new " << mapFullName( value ) << "Impl();\n";
	out.unindent();
	out << "}\n\n\n";

	//
	// initializers
	//
	IR__::InitializerSeq_var ini = value->initializers();
	for(i = 0; i < ini->length(); i++)
	{
		// todo
	};

	//
	// static factory cleaner
	//
	out << "static Qedo::ValueFactoryCleaner " << value->name() << "Factory_cleaner( new ";
	out << value->name() << "FactoryImpl(), \"" << value->id() << "\" );\n";

	close_module(out, value);
}
void 
GeneratorPersistenceH::genAbstractStorageTypeBody(IR__::AbstractStorageTypeDef_ptr abs_storagetype/*, bool bRef*/)
{
	std::string strClassName = std::string(abs_storagetype->name());

	out << "class " << strClassName << "\n";
	//bRef ? out << "Ref\n" : out << "\n";
	out.indent();
	
	IR__::InterfaceDefSeq_var abs_storagetype_seq = abs_storagetype->base_abstract_storagetypes();
	if(abs_storagetype_seq->length()==0)
	{
		out << ": public virtual CosPersistentState::StorageObject\n";
		//bRef ? out << "Ref\n" : out << "\n";
	}
	else
	{
		for(CORBA::ULong i=0; i<abs_storagetype_seq->length(); i++) 
		{
			i==0 ? out << ": " : out << ", ";
			out << "public virtual " << ((*abs_storagetype_seq)[i])->name() << "\n";
			//bRef ? out << "Ref\n" : out << "\n";
		}
	}

	out.unindent();
	out << "{\n\npublic:\n\n";
	out.indent();
    //out << strClassName;
	//bRef ? out << "Ref();\n" : out << "();\n";
	//out << "~" << strClassName;
	//bRef ? out << "Ref();\n" : out << "();\n";

	bAbstract_ = true;
	handleAttribute(abs_storagetype);
	handleOperation(abs_storagetype);
	
	//generate _duplicate and _downcast operation
	//genDuplAndDown(strClassName);

	out.unindent();
	out << "};\n\n";

	out << "#ifdef ORBACUS_ORB\n";
	out << "typedef OB::ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out	<< " > " << strClassName;
	//if(bRef) out << "Ref"; 
	out << "_var;\n";
	out << "typedef OB::ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out << " > " << strClassName;
	//if(bRef) out << "Ref";
	out << "_out;\n";
	out << "#endif\n";
	out << "#ifdef MICO_ORB\n";
	out << "typedef ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out	<< " > " << strClassName;
	//if(bRef) out << "Ref"; 
	out << "_var;\n";
	out << "typedef ObjVar< " << strClassName;
	//if(bRef) out << "Ref";
	out << " > " << strClassName;
	//if(bRef) out << "Ref";
	out << "_out;\n";
	out << "#endif\n\n\n";
}