/*
 *  @(#) 1.10 src/somext/oes/omgestio.idl, somext, som3.0 6/27/96 16:36:05 [12/22/96 21:45:01]
 *
 *  COMPONENT_NAME: somext
 *
 *  ORIGINS: 27
 *
 *   25H7912  (C)  COPYRIGHT International Business Machines Corp. 1995,1996
 *  All Rights Reserved
 *  Licensed Materials - Property of IBM
 *  US Government Users Restricted Rights - Use, duplication or
 *  disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
 *
 *  DESCRIPTION:
 *
 *  This file introduces the OMG StreamIO Service Interfaces.
 */

#ifndef CosStream_module
#define CosStream_module

#include <omgidobj.idl>

//

module CosLifeCycle {
   interface  FactoryFinder : SOMObject {
    };
}; // End CosLifeCycle


module CosStream
{
  exception ObjectCreationError{};
  exception StreamDataFormatError{};
  interface Streamable;
  interface StreamableFactory;

//----------------------------------------------------------------------------
  interface StreamIO : SOMObject  {
    // The StreamIO interface defines an abstract class without any
    // implementation.  It defines only the interfaces in the OMG
    // Externalization Service for the StreamIO class.

    // Public methods used by client objects to internalize and
    // externalize their internal state.

    void write_string(in string item);
    void write_char(in char item);
    void write_octet(in octet item);
    void write_unsigned_long(in unsigned long item);
    void write_unsigned_short(in unsigned short item);
    void write_long(in long item);
    void write_short(in short item);
    void write_float(in float item);
    void write_double(in double item);
    void write_boolean(in boolean item);
    void write_object(in Streamable item);

    string read_string()                raises(StreamDataFormatError);
    char read_char()                    raises(StreamDataFormatError);
    octet read_octet()                  raises(StreamDataFormatError);
    unsigned long read_unsigned_long()  raises(StreamDataFormatError);
    unsigned short read_unsigned_short() raises(StreamDataFormatError);
    long read_long()                    raises(StreamDataFormatError);
    short read_short()                  raises(StreamDataFormatError);
    float read_float()                  raises(StreamDataFormatError);
    double read_double()                raises(StreamDataFormatError);
    boolean read_boolean()              raises(StreamDataFormatError);
/* D23362
    Streamable read_object(in CosLifeCycle::FactoryFinder ff,
                           in Streamable obj) raises(StreamDataFormatError);
*/
    //
    //  The OMG spec also has write_graph() and read_graph() but we omitted
    //  them because compound externalization is not implemented.
    //
    implementation {
      abstract;
      majorversion      = 3;
      minorversion      = 0;
      memory_management = corba;

      somDefaultInit:   override, init;
      somDestruct:      override;
      releaseorder: read_short, write_short,
      read_long, write_long,
      read_unsigned_short, write_unsigned_short,
      read_unsigned_long, write_unsigned_long,
      read_float, write_float,
      read_double, write_double,
      read_boolean, write_boolean,
      read_char, write_char,
      read_octet, write_octet,
      read_string, write_string,
      read_object, write_object;
      dllname = "somestrm.dll";
      //
      //  These passthru's are needed to get the CosLifeCycle::Key declarations.
      //
    };
  };

//----------------------------------------------------------------------------
  interface Streamable : CosObjectIdentity::IdentifiableObject {
    void externalize_to_stream(in StreamIO stream);
    // This method must be overridden.

    void internalize_from_stream(in StreamIO stream,
                                 in CosLifeCycle::FactoryFinder ff);
    // This method must be overridden.
/* D23362
    readonly attribute CosLifeCycle::Key external_form_id;
*/
    // The write_object method puts this attribute into the stream so that
    // read_object can create a new object.

    implementation {
      abstract;
      majorversion      = 3;
      minorversion      = 0;
      memory_management = corba;


      somDefaultInit:   override, init;
      somDestruct:      override;
      external_form_id: noget, nodata;
      releaseorder: externalize_to_stream, internalize_from_stream,
                    _get_external_form_id;
      override: is_identical, _get_constant_random_id;
      dllname = "somestrm.dll";
    };
  };

//----------------------------------------------------------------------------
  interface StreamableFactory : SOMObject {

    Streamable create_uninitialized();
    //
    //  The OMG spec has method name "create_unitialized", which we assume
    //  is a typographical error.
    //
    implementation {
      abstract;
      majorversion      = 3;
      minorversion      = 0;
      memory_management = corba;

      somDefaultInit:   override, init;
      somDestruct:      override;
      releaseorder: create_uninitialized;
      dllname = "somestrm.dll";
    };
  };

};

#endif    // CosStream_module
