// CosStream Module, 8-15 CORBAservices, 
// Externalization Service V1.0, 3/94

#ifndef __CosStream_IDL
#define __CosStream_IDL

#include <CosLifeCycle.idl>
#include <CosObjectIdentity.idl>

// #include <CosCompoundExternalization.idl>

#pragma prefix "omg.org"

module CosCompoundExternalization
{
  interface Node{};
};


module CosStream 
{
    exception ObjectCreationError{};
    exception StreamDataFormatError{};
    interface StreamIO;

    interface Streamable: CosObjectIdentity::IdentifiableObject
	{
	    readonly attribute CosLifeCycle::Key external_form_id;
	    void externalize_to_stream(
				       in StreamIO targetStreamIO);
	    void internalize_from_stream(
					 in StreamIO sourceStreamIO,
					 in CosLifeCycle::FactoryFinder there)
		raises( CosLifeCycle::NoFactory,
			ObjectCreationError,
			StreamDataFormatError );
	};

    interface StreamableFactory {
	Streamable create_uninitialized();
    };


    interface StreamIO {
	void write_string(in string aString);
	void write_char(in char aChar);
	void write_octet(in octet anOctet);
	void write_unsigned_long(
				 in unsigned long anUnsignedLong);
	void write_unsigned_short(
				  in unsigned short anUnsignedShort);
	void write_long(in long aLong);
	void write_short(in short aShort);
	void write_float(in float aFloat);
	void write_double(in double aDouble);
	void write_boolean(in boolean aBoolean);
	void write_object(in Streamable aStreamable);
	void write_graph(in CosCompoundExternalization::Node aNode);
	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 );
	Streamable read_object(
			       in CosLifeCycle::FactoryFinder there,
			       in Streamable aStreamable)
	    raises(StreamDataFormatError );
	void read_graph(
			in CosCompoundExternalization::Node starting_node,
			in CosLifeCycle::FactoryFinder there)
	    raises(StreamDataFormatError );
    };
};

#endif
