
#include <mico/ir.idl>

#pragma prefix "omg.org"

module CORBA {
  module ComponentIR {

    interface ComponentDef;
    interface HomeDef;
    interface EventDef;

    interface Container : CORBA::Container {
      ComponentDef
	create_component (in RepositoryId id,
			  in Identifier name,
			  in VersionSpec version,
			  in ComponentDef base_component,
			  in InterfaceDefSeq supports_interfaces);

      HomeDef
	create_home (in RepositoryId id,
		     in Identifier name,
		     in VersionSpec version,
		     in HomeDef base_home,
		     in ComponentDef managed_component,
		     in InterfaceDefSeq supports_interfaces,
		     in ValueDef primary_key);

      EventDef
	create_event (in RepositoryId id,
		      in Identifier name,
		      in VersionSpec version,
		      in boolean is_custom,
		      in boolean is_abstract,
		      in ValueDef base_value,
		      in boolean is_truncatable,
		      in ValueDefSeq abstract_base_values,
		      in InterfaceDefSeq supported_interfaces,
		      in ExtInitializerSeq initializers);
    };

    interface ModuleDef : Container, CORBA::ModuleDef {
    };

    interface Repository : Container, CORBA::Repository {
    };

    /*
     * ProvidesDef
     */

    interface ProvidesDef : Contained {
      attribute InterfaceDef interface_type;
    };

    struct ProvidesDescription {
      Identifier name;
      RepositoryId id;
      RepositoryId defined_in;
      VersionSpec version;
      RepositoryId interface_type;
    };

    /*
     * UsesDef
     */

    interface UsesDef : Contained {
      attribute InterfaceDef interface_type;
      attribute boolean is_multiple;
    };

    struct UsesDescription {
      Identifier name;
      RepositoryId id;
      RepositoryId defined_in;
      VersionSpec version;
      RepositoryId interface_type;
      boolean is_multiple;
    };

    /*
     * EventDef
     */

    interface EventDef : ExtValueDef {};

    /*
     * EventPortDef
     */

    interface EventPortDef : Contained {
      boolean is_a (in RepositoryId event_id);
      attribute EventDef event;
    };

    struct EventPortDescription {
      Identifier name;
      RepositoryId id;
      RepositoryId defined_in;
      VersionSpec version;
      RepositoryId event;
    };

    /*
     * EmitsDef
     */

    interface EmitsDef : EventPortDef {
    };

    /*
     * PublishesDef
     */

    interface PublishesDef : EventPortDef {
    };

    /*
     * ConsumesDef
     */

    interface ConsumesDef : EventPortDef {
    };

    /*
     * ComponentDef
     */

    interface ComponentDef : ExtInterfaceDef {

      attribute ComponentDef base_component;
      attribute InterfaceDefSeq supported_interfaces;

      /*
       * provides_interfaces, uses_interfaces, emits_events,
       * publishes_events and consumes_events are not necessary,
       * information about them can be obtained with
       * CORBA::Container::describe_contents()
       */

      ProvidesDef
	create_provides (in RepositoryId id,
			 in Identifier name,
			 in VersionSpec version,
			 in InterfaceDef interface_type);

      UsesDef
	create_uses (in RepositoryId id,
		     in Identifier name,
		     in VersionSpec version,
		     in InterfaceDef interface_type,
		     in boolean is_multiple);

      EmitsDef
	create_emits (in RepositoryId id,
		      in Identifier name,
		      in VersionSpec version,
		      in EventDef event);

      PublishesDef
	create_publishes (in RepositoryId id,
			  in Identifier name,
			  in VersionSpec version,
			  in EventDef event);

      ConsumesDef
	create_consumes (in RepositoryId id,
			 in Identifier name,
			 in VersionSpec version,
			 in EventDef event);
    };

    typedef sequence<ProvidesDescription> ProvidesDescriptionSeq;
    typedef sequence<UsesDescription> UsesDescriptionSeq;
    typedef sequence<EventPortDescription> EventPortDescriptionSeq;

    struct ComponentDescription {
      Identifier name;
      RepositoryId id;
      RepositoryId defined_in;
      VersionSpec version;
      RepositoryId base_component;
      RepositoryIdSeq supported_interfaces;
      ProvidesDescriptionSeq provided_interfaces;
      UsesDescriptionSeq used_interfaces;
      EventPortDescriptionSeq emits_events;
      EventPortDescriptionSeq publishes_events;
      EventPortDescriptionSeq consumes_events;
      ExtAttrDescriptionSeq attributes;
      TypeCode type;
    };

    /*
     * FactoryDef
     */

    interface FactoryDef : OperationDef {
    };

    /*
     * FinderDef
     */

    interface FinderDef : OperationDef {
    };

    /*
     * HomeDef
     */

    interface HomeDef : ExtInterfaceDef {

      attribute HomeDef base_home;
      attribute InterfaceDefSeq supported_interfaces;
      attribute ComponentDef managed_component;
      attribute ValueDef primary_key;

      FactoryDef
	create_factory (in RepositoryId id,
			in Identifier name,
			in VersionSpec version,
			in ParDescriptionSeq params,
			in ExceptionDefSeq exceptions);

      FinderDef
	create_finder (in RepositoryId id,
		       in Identifier name,
		       in VersionSpec version,
		       in ParDescriptionSeq params,
		       in ExceptionDefSeq exceptions);

    };

    struct HomeDescription {
      Identifier name;
      RepositoryId id;
      RepositoryId defined_in;
      VersionSpec version;
      RepositoryId base_home;
      RepositoryId managed_component;
      ValueDescription primary_key;
      OpDescriptionSeq factories;
      OpDescriptionSeq finders;
      OpDescriptionSeq operations;
      ExtAttrDescriptionSeq attributes;
      TypeCode type;
    };
  };
};

