// $Id: Cornucopia.idl 95650 2012-03-23 22:02:04Z johnnyw $
/**
 * @file Cornucopia.idl
 * @author Jeff Parsons <j.parsons@vanderbilt.edu>
 *
 * Tests TAO_IDL generation of CIAO servant, executor IDL
 * and executor implementation stencil for a variety of
 * IDL3 constructs.
 */

#include <Components.idl>

module Supported
{
  /// The IfacePawPaw interface
  interface IfacePawPaw
  {
    /// Our paw_paw_op stuff
    long paw_paw_op (out short spew);
    /// A special boolean attribute
    attribute boolean inbred;
  };

  interface IfaceMom : IfacePawPaw
  {
    readonly attribute wchar uni_tag;
    IfacePawPaw get_paw_paw ();
  };

  interface IfaceDad : IfacePawPaw
  {
    /// Our message attribute
    attribute string msg;
    long long get_big_int (in IfacePawPaw genealogy);
  };

  interface Iface : IfaceMom, IfaceDad
  {
    attribute wstring uni_uuid;
    void supported_op (inout unsigned long index);
  };
};

interface pface {};
interface uface {};
interface umface {};

abstract interface IfAb
{
  long op (out long value);
  attribute long attr;
};

interface IfConcr : IfAb
{
  long concr_op (out long value);
  attribute long concr_attr;
};

#if !defined (CCM_LW)
valuetype pkey : Components::PrimaryKeyBase
{
  public string info;
};
#endif

#if !defined (CCM_NOEVENT)
eventtype pubtype {};
eventtype emittype {};
eventtype eattype {};
#endif

exception BadGet {};
exception BadSet {};
exception Whatever {};

module BaseMod
{
component CompBase supports Supported::Iface
  {
    attribute octet the_byte
      getraises (BadGet, Whatever) setraises (BadSet);
  };
};

enum Color
{
  RED,
  WHITE,
  BLUE
};

module T2
{
  interface Write
  {
  };

  porttype MyPort
  {
    uses Write writer;
  };

  component Base
  {
    port MyPort usage;
    /// My topic
    attribute string topic_name;
  };

  component Derived : Base
  {
  };
};

module LocalMod
{
  local interface L1
  {
  };

  local interface L2
  {
    L1 getL1();
    void setL1 (in L1 x);
  };

  component CombLocal
  {
    provides L1 x;
    uses L2 y;
  };

  component CombLocal2
  {
    uses L1 x;
    provides L2 y;
  };

  porttype L3
  {
    provides L1 x;
    uses L2 y;
  };

  component CombLocal4
  {
    port L3 z;
    mirrorport L3 z2;
  };

  component CombLocal3
  {
    mirrorport L3 z;
    port L3 z2;
  };
};

module DerivedMod
{
  porttype CombinedPort
  {
    provides pface pface_provider;
    uses uface uface_user;
    uses multiple umface umface_umuser;
  };

  component CompCombinedPort
  {
    port CombinedPort cc;
  };

  component MirrorCompCombinedPort
  {
    mirrorport CombinedPort cc;
  };

  component CompDerived : BaseMod::CompBase
  {
    attribute Color stripe;
    provides pface pface_provider;
    uses uface uface_user;
    uses multiple umface umface_umuser;
#if !defined (CCM_NOEVENT)
    publishes pubtype pubtype_publisher;
    emits emittype emittype_emitter;
    consumes eattype eattype_consumer;
#endif
    uses IfConcr ccre_user;
  };
};

module HomeMod
{
  home CompBaseHome supports Supported::Iface manages BaseMod::CompBase
  {
    readonly attribute Color shade;
    pface fetch_managed_ports (out uface recep);
    factory base_init (in string id, in unsigned short uni_raw)
      raises (Whatever);
    finder bathroom_sink ();
  };

  home CompDerivedHome : CompBaseHome manages DerivedMod::CompDerived
  {
    exception ch_except {};
    void ch_op () raises (ch_except);
    factory def_init ();
#if !defined (CCM_LW)
    finder kitchen_sink (in string uid, in pkey key, in boolean all)
      raises (ch_except);
#endif
  };
};

module X
{
  module Typed <typename Data, sequence<Data> DataSeq>
  {
    local interface XXXX
    {
      void y (in Data ab);
    };
  };
};

module Y
{
  module Typed <typename T, sequence<T> TSeq>
  {
    alias ::X::Typed<T, TSeq> X_Typed;
  };
};

struct Hello
{
  long a;
};

typedef sequence<Hello> HelloSeq;
module ::Y::Typed < ::Hello, ::HelloSeq> HelloSpace;

module ZZ
{
  module DDSE <typename T, sequence<T> TSeq> {
    local interface Read
    {
      void op ();
    };
  };
  module DDSX <typename T, sequence<T> TSeq> {
    alias DDSE <T, TSeq> EX;
    typedef EX::Read Read;
  };
};

module YY
{
  module DDSY <typename T, sequence<T> TSeq> {
    alias ZZ::DDSX <T, TSeq> EX2;
  };
};

module ZZ::DDSX < ::Hello, ::HelloSeq> ZZDDSX;

module YY::DDSY < ::Hello, ::HelloSeq> ZZDDSY;

module FooConnector_T<interface T, interface AMI4CCM_T>
{
  porttype AMI4CCM_Port_Type
  {
    provides AMI4CCM_T ami4ccm_provides;
    provides T         ami4ccm_sync_provides;
    uses T ami4ccm_uses;
  };
  connector AMI4CCM_Connector
  {
    port AMI4CCM_Port_Type ami4ccm_port;
  };
};

module FooConnector_T<Supported::IfacePawPaw, Supported::IfacePawPaw> FooPawPaw;

module BasicHomes
{
  interface foo_interface {};

  component Foo supports foo_interface {};

  home FooHome manages Foo
    {
    };
};

home SecondFooHome manages BasicHomes::Foo
{
};

module SequenceTest
{
  typedef sequence<long> TestOfLongSeq;

  component SequenceComp
    {
      attribute SequenceTest::TestOfLongSeq myAttribute;
    };
};
