Beispiel #1
0
void DotBuilder::doElement(ASTElement* element)
{
  switch (element->getElementType())
  {
    case MELEMENT_BLOCK:
      doBlock(reinterpret_cast<ASTBlock*>(element));
      break;
    case MELEMENT_CONSTANT:
      doConstant(reinterpret_cast<ASTConstant*>(element));
      break;
    case MELEMENT_VARIABLE:
      doVariable(reinterpret_cast<ASTVariable*>(element));
      break;
    case MELEMENT_OPERATOR:
      doOperator(reinterpret_cast<ASTOperator*>(element));
      break;
    case MELEMENT_CALL:
      doCall(reinterpret_cast<ASTCall*>(element));
      break;
    case MELEMENT_TRANSFORM:
      doTransform(reinterpret_cast<ASTTransform*>(element));
      break;
    default:
      MP_ASSERT_NOT_REACHED();
  }
}
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);
}
//
// home
//
void
GeneratorBase::doHome(IR__::HomeDef_ptr home)
{
	beginHome(home);

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

	// contained constants
	contained_seq = home->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 = home->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 = home->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
	contained_seq = home->contents(CORBA__::dk_Attribute, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::AttributeDef_var act_attribute = IR__::AttributeDef::_narrow(((*contained_seq)[i]));
		doAttribute(act_attribute);
	}

	// contained operations
	contained_seq = home->contents(CORBA__::dk_Operation, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::OperationDef_var act_operation = IR__::OperationDef::_narrow(((*contained_seq)[i]));
		doOperation(act_operation);
	}

	// contained factories
	contained_seq = home->contents(CORBA__::dk_Factory, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::FactoryDef_var act_factory = IR__::FactoryDef::_narrow(((*contained_seq)[i]));
		doFactory(act_factory);
	}

	// contained finders
	contained_seq = home->contents(CORBA__::dk_Finder, false);
	len = contained_seq->length();
	for(i = 0; i < len; i++)
	{
		IR__::FinderDef_var act_finder = IR__::FinderDef::_narrow(((*contained_seq)[i]));
		doFinder(act_finder);
	}

	endHome(home);
}