#ifndef CosExternalization_IDL #define CosExternalization_IDL // // The Externalization Service // #include #include #include #pragma prefix "omg.org" module CosCompoundExternalization { interface Node; interface Role; interface Relationship; interface PropagationCriteriaFactory; }; 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 starting_node); void write_long_long(in long long val); void write_unsigned_long_long(in unsigned long long val); void write_long_double(in long double val); // void write_wchar(in wchar val); // void write_wstring(in wstring val); void write_fixed(in any val,in short s); 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); long long read_long_long() raises(StreamDataFormatError); unsigned long long read_unsigned_long_long() raises(StreamDataFormatError); long double read_long_double() raises(StreamDataFormatError); // wchar read_wchar() // raises(StreamDataFormatError); // wstring read_wstring() // raises(StreamDataFormatError); any read_fixed() raises(StreamDataFormatError); }; }; module CosExternalization { exception InvalidFileNameError{}; exception ContextAlreadyRegistered{}; interface Stream: CosLifeCycle::LifeCycleObject{ void externalize(in CosStream::Streamable theObject); CosStream::Streamable internalize(in CosLifeCycle::FactoryFinder there) raises( CosLifeCycle::NoFactory, CosStream::StreamDataFormatError ); void begin_context() raises( ContextAlreadyRegistered); void end_context(); void flush(); }; interface StreamFactory { Stream create(); }; interface FileStreamFactory { Stream create(in string theFileName) raises( InvalidFileNameError ); }; }; module CosCompoundExternalization { interface Node; interface Role; interface Relationship; interface PropagationCriteriaFactory; struct RelationshipHandle { Relationship theRelationship; ::CosObjectIdentity::ObjectIdentifier constantRandomId; }; // My add for NodeFactories interface NodeStreamableFactory : ::CosStream::StreamableFactory, ::CosGraphs::NodeFactory {}; interface Node : ::CosGraphs::Node, ::CosStream::Streamable { void externalize_node (in ::CosStream::StreamIO sio); void internalize_node ( in ::CosStream::StreamIO sio, in ::CosLifeCycle::FactoryFinder there, out Roles rolesOfNode) raises (::CosLifeCycle::NoFactory); }; interface Role : ::CosGraphs::Role { void externalize_role (in ::CosStream::StreamIO sio); void internalize_role (in ::CosStream::StreamIO sio); ::CosGraphs::PropagationValue externalize_propagation ( in RelationshipHandle rel, in ::CosRelationships::RoleName toRoleName, out boolean sameForAll); }; interface Relationship : ::CosRelationships::Relationship { void externalize_relationship (in ::CosStream::StreamIO sio); void internalize_relationship( in ::CosStream::StreamIO sio, in ::CosGraphs::NamedRoles newRoles); ::CosGraphs::PropagationValue externalize_propagation ( in ::CosRelationships::RoleName fromRoleName, in ::CosRelationships::RoleName toRoleName, out boolean sameForAll); }; interface PropagationCriteriaFactory { ::CosGraphs::TraversalCriteria create_for_externalize( ); }; }; #endif