1//File: CosGraphs.idl
2//Part of the Relationship Service
3
4#ifndef _COS_GRAPHS_IDL_
5#define _COS_GRAPHS_IDL_
6
7// omniORB specific pragmas to insert extra includes into the stub header.
8#pragma hh #include "COS_sysdep.h"
9
10#include <orb.idl>
11
12#include <CosRelationships.idl>
13#include <CosObjectIdentity.idl>
14
15#pragma prefix "omg.org"
16
17module CosGraphs {
18
19		interface TraversalFactory;
20		interface Traversal;
21		interface TraversalCriteria;
22		interface Node;
23		interface NodeFactory;
24		interface Role;
25		interface EdgeIterator;
26
27		struct NodeHandle {
28			Node the_node;
29			CosObjectIdentity::ObjectIdentifier constant_random_id;
30		};
31		typedef sequence<NodeHandle> NodeHandles;
32
33		struct NamedRole {
34			Role the_role;
35			CosRelationships::RoleName the_name;
36		};
37		typedef sequence<NamedRole> NamedRoles;
38
39		struct EndPoint {
40			NodeHandle the_node;
41			NamedRole the_role;
42		};
43		typedef sequence<EndPoint> EndPoints;
44
45		struct Edge {
46			EndPoint from;
47			CosRelationships::RelationshipHandle the_relationship;
48			EndPoints relatives;
49		};
50		typedef sequence<Edge> Edges;
51
52		enum PropagationValue {deep, shallow, none, inhibit};
53		enum Mode {depthFirst, breadthFirst, bestFirst};
54
55		interface TraversalFactory {
56			Traversal create_traversal_on (
57					in NodeHandle root_node,
58					in TraversalCriteria the_criteria,
59					in Mode how);
60		};
61
62		interface Traversal {
63			typedef unsigned long TraversalScopedId;
64			struct ScopedEndPoint {
65				EndPoint point;
66				TraversalScopedId id;
67			};
68			typedef sequence<ScopedEndPoint> ScopedEndPoints;
69			struct ScopedRelationship {
70				CosRelationships::RelationshipHandle
71					scoped_relationship;
72				TraversalScopedId id;
73			};
74			struct ScopedEdge {
75				ScopedEndPoint from;
76				ScopedRelationship the_relationship;
77				ScopedEndPoints relatives;
78			};
79			typedef sequence<ScopedEdge> ScopedEdges;
80			boolean next_one (out ScopedEdge the_edge);
81			boolean next_n (in short how_many,
82							out ScopedEdges the_edges);
83			void destroy ();
84		};
85
86		interface TraversalCriteria {
87			struct WeightedEdge {
88				Edge the_edge;
89				unsigned long weight;
90				sequence<NodeHandle> next_nodes;
91			};
92			typedef sequence<WeightedEdge> WeightedEdges;
93			void visit_node(in NodeHandle a_node,
94							in Mode search_mode);
95			boolean next_one (out WeightedEdge the_edge);
96			boolean next_n (in short how_many,
97							out WeightedEdges the_edges);
98			void destroy();
99		};
100
101		interface Node: CosObjectIdentity::IdentifiableObject {
102			typedef sequence<Role> Roles;
103			exception NoSuchRole {};
104			exception DuplicateRoleType {};
105
106			readonly attribute CosRelationships::RelatedObject
107				 related_object;
108			readonly attribute Roles roles_of_node;
109			Roles roles_of_type (
110					in CORBA::InterfaceDef role_type);
111			void add_role (in Role a_role)
112					raises (DuplicateRoleType);
113			void remove_role (in CORBA::InterfaceDef of_type)
114				raises (NoSuchRole);
115		};
116
117		interface NodeFactory {
118			Node create_node (in Object related_object);
119		};
120
121		interface Role : CosRelationships::Role {
122			void get_edges ( in long how_many,
123					out Edges the_edges,
124					out EdgeIterator the_rest);
125		};
126
127		interface EdgeIterator {
128			boolean next_one (out Edge the_edge);
129			boolean next_n ( in unsigned long how_many,
130					out Edges the_edges);
131			void destroy ();
132		};
133
134};
135
136#endif /* ifndef _COS_GRAPHS_IDL_ */
137