// File: pseudo_orb.idl
// From CORBA 3.0
#ifndef _PSEUDO_ORB_IDL_
#define _PSEUDO_ORB_IDL_

#include <orb.idl>

// This module brings together all the pseudo IDL in the definition
//    of the CORBA module. (May heaven have mercy on us.)

// Why? Just to see if it can be done. Well, maybe a little more.
//   The PIDL interfaces are included in this file for the purpose 
//   of testing the syntax (for all the good that does) and for 
//   completeness. Including them serves as documentation of 
//   the intent of the CORBA specification. 

// This file should never be copied (or #included) into a real IDL 
//    file for a couple reasons. First, the only reason this compiles
//    is a couple tricks played, as you will see below. The tricks 
//    are necessary because there are PIDL definition of entities 
//    whose names conflict with IDL keywords (Object, ValueBase, and
//    Context); the tricks essentially negate any pseudo-benefit that 
//    might accrue from pseudo-compiling the PIDL. Finally, PIDL does
//    not define a full CORBA object. These pseudo-objects are 
//    implemented as purely local entities; the ORB provides the 
//    implementation. An invocation on a pseudo-object goes directly 
//    to a language entity; specifically, it doesn't go through the 
//    full remote invocation process (avoiding infinite regress). As 
//    a result, the generated stubs wouldn't get to the right code
//    even if used by a client program and the skeletons aren't of 
//    use to anybody.

// For the definitions that an application needs corresponding to,
//    the PIDL in this file, an ORB provides a special stub (header
//    file, whatever) corresponding to the custom mapping of the 
//    PIDL for that language. It's as if the ORB vendor compiled 
//    this PIDL using a PIDL compiler.

// Most IDL compilers don't accept the "native" keyword in application IDL 
//    files. In order to compile an IDL (really PIDL) file that has it, the 
//    following trick can be used: change what the compiler sees. Instead
//    of letting the compiler see the keyword "native", use a preprocessor
//    definition that results in valid IDL, even if it doesn't yield
//    useful stubs and skeletons. Of course, PIDL never results in
//    the standard stubs so that's not a problem.
//
// Set the variable _MASK_NATIVE_ in the IDL compiler to enable it to
// parse this file.

#ifdef _MASK_NATIVE_
#define native typedef long
#endif // _MASK_NATIVE_

module CORBA {

// The following forward references list *all* the PIDL interfaces and 
//   valuetypes in the CORBA module. This serves two purposes: documentation
//   and compilability. Documentation is nice: since some of the interfaces
//   must be declared as forward references, it is more consistent to
//   declare them all.
//
//   As far as compilability, it might be possible to avoid having to declare
//   many of the forward reference by rearranging the order of the interface 
//   declarations, but there's no reason to do bother doing that since 
//   that's the reason forward references were invented. Doing a forward
//   reference allows the definition order to be relatively logical.In 
//   particular, it allows the "include"s to be done in chapter order 
//   (almost), the only exception being the InterfaceRepository (Chapter 10). 
//   It contains some data definitions needed by Chapter 4 interfaces.
//   The other reason not to try to rearrange the order is that it's hard.

// The "define" fakes out the compiler to let it compile the "Context" 
//    interface and references to it even though "context" is a keyword
#define Context CContext

// The "define" fakes out the compiler to let it compile the "Object" 
//    interface and references to it even though "Object" is a keyword
#define Object OObject

// The "define" fakes out the compiler to let it compile the "ValueBase" 
//    valuetype and references to it even though "ValueBase" is a keyword
#define ValueBase VValueBase

// Forward references, alphabetically 
    interface Context;                   // Chapter  7, CORBA_Context.idl
    interface NVList;                    // Chapter  7, CORBA_NVList.idl
    interface Object;                    // Chapter  4, CORBA_Object.idl
    interface ORB;                       // Chapter  4, CORBA_ORB.idl
    interface Request;                   // Chapter  7, CORBA_Request.idl
    interface ServerRequest;             // Chapter  8, CORBA_ServerRequest.idl
    valuetype ValueBase;                 // Chapter  4, CORBA_ValueBase.idl

    typedef unsigned long Flags;

// Chapter 4: ORB Interface
#include <CORBA_Object.idl>
#include <CORBA_ORB.idl>

// Chapter 5: Value Type Semantics
#include <CORBA_ValueBase.idl>

// Chapter 7: Dynamic Invocation Interface
#include <CORBA_Request.idl>
#include <CORBA_Context.idl>
#include <CORBA_NVList.idl>

// Chapter 8: Dynamic Skeleton Interface
#include <CORBA_ServerRequest.idl>

};

#endif // _PSEUDO_ORB_IDL_
