1//File: CosStream.idl
2//Part of the Externalization Service
3// Modified from version 1.0 to include the previous CosCompoundExternalization module
4
5#ifndef _COS_STREAM_IDL_
6#define _COS_STREAM_IDL_
7
8// omniORB specific pragmas to insert extra includes into the stub header.
9#pragma hh #include "COS_sysdep.h"
10
11#include <CosLifeCycle.idl>
12#include <CosObjectIdentity.idl>
13#include <CosGraphs.idl>
14
15#pragma prefix "omg.org"
16
17module CosStream {
18	exception ObjectCreationError{};
19	exception StreamDataFormatError{};
20
21	interface StreamIO;
22	interface Node;
23	interface Role;
24	interface Relationship;
25
26	interface Streamable:
27	  CosObjectIdentity::IdentifiableObject {
28		readonly attribute CosLifeCycle::Key external_form_id;
29		void externalize_to_stream(
30			in StreamIO		targetStreamIO);
31		void internalize_from_stream(
32			in StreamIO		sourceStreamIO,
33			in CosLifeCycle::FactoryFinder there)
34			raises(	CosLifeCycle::NoFactory,
35					ObjectCreationError,
36					StreamDataFormatError );
37	};
38
39	interface StreamableFactory {
40		Streamable create_uninitialized();
41	};
42
43
44	interface StreamIO {
45 		void write_string(in string aString);
46 		void write_char(in char aChar);
47 		void write_octet(in octet anOctet);
48 		void write_unsigned_long(
49			in unsigned long anUnsignedLong);
50 		void write_unsigned_short(
51			in unsigned short anUnsignedShort);
52 		void write_long(in long aLong);
53 		void write_short(in short aShort);
54 		void write_float(in float aFloat);
55 		void write_double(in double aDouble);
56 		void write_boolean(in boolean aBoolean);
57 		void write_object(in Streamable aStreamable);
58	 	void write_graph(in Node aNode);
59		string read_string()
60			raises(StreamDataFormatError);
61		char read_char()
62			raises(StreamDataFormatError );
63		octet read_octet()
64			raises(StreamDataFormatError );
65		unsigned long read_unsigned_long()
66			raises(StreamDataFormatError );
67		unsigned short read_unsigned_short()
68			raises(		StreamDataFormatError );
69		long read_long()
70			raises(StreamDataFormatError );
71		short read_short()
72			raises(StreamDataFormatError );
73		float read_float()
74			raises(StreamDataFormatError );
75		double read_double()
76			raises(StreamDataFormatError );
77		boolean read_boolean()
78			raises(StreamDataFormatError );
79		Streamable read_object(
80			in CosLifeCycle::FactoryFinder there,
81			in Streamable aStreamable)
82			raises(StreamDataFormatError );
83 		void read_graph(
84	 		in Node starting_node,
85			in CosLifeCycle::FactoryFinder there)
86			raises(StreamDataFormatError );
87	};
88
89    // the following are required for compound externalization
90
91	struct RelationshipHandle {
92		CosRelationships::Relationship theRelationship;
93		CosObjectIdentity::ObjectIdentifier constantRandomId;
94	};
95
96	interface Node : CosGraphs::Node, CosStream::Streamable{
97		void externalize_node (in CosStream::StreamIO sio);
98		void internalize_node (in CosStream::StreamIO sio,
99			in CosLifeCycle::FactoryFinder there,
100			out Roles rolesOfNode)
101				raises ( CosLifeCycle::NoFactory);
102	};
103
104	interface Role : CosGraphs::Role {
105		void externalize_role (in CosStream::StreamIO sio);
106		void internalize_role (in CosStream::StreamIO sio);
107		CosGraphs::PropagationValue externalize_propagation (
108			in RelationshipHandle rel,
109			in CosRelationships::RoleName toRoleName,
110			out boolean sameForAll);
111	};
112
113	interface Relationship : CosRelationships::Relationship {
114		void externalize_relationship (
115			in CosStream::StreamIO sio);
116		void internalize_relationship(
117			in CosStream::StreamIO sio,
118			in CosGraphs::NamedRoles newRoles);
119		CosGraphs::PropagationValue externalize_propagation (
120		in CosRelationships::RoleName fromRoleName,
121		in CosRelationships::RoleName toRoleName,
122		out boolean sameForAll);
123	};
124
125	interface PropagationCriteriaFactory {
126	       CosGraphs::TraversalCriteria create_for_externalize( );
127	};
128
129
130};
131#endif  /* ifndef _COS_STREAM_IDL_  */
132