// File: DynamicAny.idl
// CORBA 3.0, Chapter 9

#ifndef _DYNAMIC_ANY_IDL_
#define _DYNAMIC_ANY_IDL_

#ifdef _PRE_3_0_COMPILER_ 
#pragma prefix "omg.org"
#include <orb.idl>
#else
import ::CORBA;
#endif // _PRE_3_0_COMPILER_

module DynamicAny {

#ifndef _PRE_3_0_COMPILER_ 
    typeprefix DynamicAny "omg.org";
#endif // _PRE_3_0_COMPILER_

    local interface DynAny {
        exception InvalidValue {};
        exception TypeMismatch {};
                
        CORBA::TypeCode type();

        void assign(        in DynAny   dyn_any)   
	  raises(TypeMismatch);
        void from_any(      in any      value)      
	  raises(TypeMismatch, InvalidValue);
        any to_any();

        boolean equal(      in DynAny   dyn_any);

        void destroy();
        DynAny copy();

        void insert_boolean(in boolean  value)      
	  raises(TypeMismatch, InvalidValue);
        void insert_octet(  in octet    value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_char(   in char     value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_short(  in short    value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_ushort( in unsigned short 
                                        value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_long(   in long     value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_ulong(  in unsigned long 
                                        value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_float(  in float    value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_double( in double   value)      
	  raises(TypeMismatch, InvalidValue);
        void insert_string( in string   value)     
	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_reference(in Object value)     
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
        void insert_typecode(in CORBA::TypeCode 
                                        value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_longlong(in long long value)   
	  raises(TypeMismatch, InvalidValue);
        void insert_ulonglong(in unsigned long long 
                                        value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_longdouble(in long double 
                                        value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_wchar(  in wchar    value)      
	  raises(TypeMismatch, InvalidValue);
        void insert_wstring(in wstring  value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_any(    in any      value)     
	  raises(TypeMismatch, InvalidValue);
        void insert_dyn_any(in DynAny   value)     
	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_val(    in ValueBase value)     
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);

        boolean         get_boolean()               
	  raises(TypeMismatch, InvalidValue);
        octet           get_octet()                 
	  raises(TypeMismatch, InvalidValue);
        char            get_char()                 
	  raises(TypeMismatch, InvalidValue);
        short           get_short()                 
	  raises(TypeMismatch, InvalidValue);
        unsigned short  get_ushort()                
	  raises(TypeMismatch, InvalidValue);
        long            get_long()                  
	  raises(TypeMismatch, InvalidValue);
        unsigned long   get_ulong()                
	  raises(TypeMismatch, InvalidValue);
        float           get_float()                 
	  raises(TypeMismatch, InvalidValue);
        double          get_double()                
	  raises(TypeMismatch, InvalidValue);
        string          get_string()               
	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        Object          get_reference()            
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
        CORBA::TypeCode get_typecode()             
	  raises(TypeMismatch, InvalidValue);
        long long       get_longlong()             
	  raises(TypeMismatch, InvalidValue);
        unsigned long long get_ulonglong()          
	  raises(TypeMismatch, InvalidValue);
        long double     get_longdouble()            
	  raises(TypeMismatch, InvalidValue);
        wchar           get_wchar()                
	  raises(TypeMismatch, InvalidValue);
        wstring         get_wstring()              
	  raises(TypeMismatch, InvalidValue);
        any             get_any()                   
	  raises(TypeMismatch, InvalidValue);
        DynAny          get_dyn_any()               
	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        ValueBase       get_val()                   
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);

        boolean         seek(in long index);
        void            rewind();
        boolean         next();
        unsigned long   component_count();
        DynAny          current_component()        
	  raises(TypeMismatch);

//PolyORB:NI:        void insert_abstract(in CORBA::AbstractBase value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::AbstractBase get_abstract()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:
//PolyORB:NI:        void insert_boolean_seq(in CORBA::BooleanSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_octet_seq(in CORBA::OctetSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_char_seq(in CORBA::CharSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_short_seq(in CORBA::ShortSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_ushort_seq(in CORBA::UShortSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_long_seq(in CORBA::LongSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_ulong_seq(in CORBA::ULongSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_float_seq(in CORBA::FloatSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_double_seq(in CORBA::DoubleSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_longlong_seq(in CORBA::LongLongSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_ulonglong_seq(in CORBA::ULongLongSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_longdouble_seq(in CORBA::LongDoubleSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        void insert_wchar_seq(in CORBA::WCharSeq value)
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::BooleanSeq get_boolean_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::OctetSeq get_octet_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::CharSeq get_char_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::ShortSeq get_short_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::UShortSeq get_ushort_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::LongSeq get_long_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::ULongSeq get_ulong_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::FloatSeq get_float_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::DoubleSeq get_double_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::LongLongSeq get_longlong_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::ULongLongSeq get_ulonglong_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::LongDoubleSeq get_longdouble_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
//PolyORB:NI:        CORBA::WCharSeq get_wchar_seq()
//PolyORB:NI:	  raises(TypeMismatch, InvalidValue);
    };
    
    local interface DynFixed : DynAny {
        string          get_value();
        boolean         set_value(in string val)    
	  raises(TypeMismatch, InvalidValue);
    };
    
    local interface DynEnum : DynAny {
        string          get_as_string();
        void            set_as_string(in string value) 
	  raises(InvalidValue);
        unsigned long   get_as_ulong();
        void            set_as_ulong( in unsigned long value) 
	  raises(InvalidValue);
    };
    typedef string FieldName;
    struct NameValuePair {
        FieldName   id;
        any         value;
    };
    
    typedef sequence<NameValuePair> NameValuePairSeq;
    struct NameDynAnyPair {
        FieldName   id;
        DynAny      value;
    };

    typedef sequence<NameDynAnyPair> NameDynAnyPairSeq;
    local interface DynStruct : DynAny {
        FieldName           current_member_name()  
	  raises(TypeMismatch, InvalidValue);
        CORBA::TCKind       current_member_kind()   
	  raises(TypeMismatch, InvalidValue);
        NameValuePairSeq    get_members();
        void                set_members(in NameValuePairSeq value)    
	  raises(TypeMismatch, InvalidValue);
        NameDynAnyPairSeq   get_members_as_dyn_any();
        void  set_members_as_dyn_any(in NameDynAnyPairSeq value)
	  raises(TypeMismatch, InvalidValue);
    };

    local interface DynUnion : DynAny {
        DynAny              get_discriminator();
        void                set_discriminator(in DynAny d) 
	  raises(TypeMismatch);
        void                set_to_default_member() 
	  raises(TypeMismatch);
        void                set_to_no_active_member() 
	  raises(TypeMismatch);
        boolean             has_no_active_member();
        CORBA::TCKind       discriminator_kind();
        DynAny              member()               
	  raises(InvalidValue);
        FieldName           member_name()          
	  raises(InvalidValue);
        CORBA::TCKind       member_kind()           
	  raises(InvalidValue);
    };
    
    typedef sequence<any>    AnySeq;
    typedef sequence<DynAny> DynAnySeq;
    local interface DynSequence : DynAny {
        unsigned long       get_length();
        void                set_length(in unsigned long len) 
	  raises(InvalidValue);
        AnySeq              get_elements();
        void                set_elements(in AnySeq value)
	  raises(TypeMismatch, InvalidValue);
        DynAnySeq           get_elements_as_dyn_any();
        void                set_elements_as_dyn_any(in DynAnySeq value)
	  raises(TypeMismatch, InvalidValue);
    };

    local interface DynArray : DynAny {
        AnySeq              get_elements();
        void                set_elements(in AnySeq value)
	  raises(TypeMismatch, InvalidValue);
        DynAnySeq           get_elements_as_dyn_any();
        void                set_elements_as_dyn_any(in DynAnySeq value)
	  raises(TypeMismatch, InvalidValue);
    };
    
    local interface DynValueCommon : DynAny {
        boolean             is_null();
        void                set_to_null();
        void                set_to_value();
    };

    local interface DynValue : DynValueCommon {
        FieldName           current_member_name()
	  raises(TypeMismatch, InvalidValue);
        CORBA::TCKind       current_member_kind()
	  raises(TypeMismatch, InvalidValue);
        NameValuePairSeq    get_members()
	  raises(InvalidValue);
        void                set_members(in NameValuePairSeq value)
	  raises(TypeMismatch, InvalidValue);
        NameDynAnyPairSeq   get_members_as_dyn_any()
	  raises(InvalidValue);
        void                set_members_as_dyn_any(in NameDynAnyPairSeq value)
	  raises(TypeMismatch, InvalidValue);
    };

    local interface DynValueBox : DynValueCommon {
        any                 get_boxed_value()
	  raises(InvalidValue);
        void                set_boxed_value(in any boxed) 
	  raises(TypeMismatch, InvalidValue);
        DynAny              get_boxed_value_as_dyn_any()
	  raises(InvalidValue);
        void                set_boxed_value_as_dyn_any(in DynAny boxed)
	  raises(TypeMismatch);
    };

    exception MustTruncate { };

    local interface DynAnyFactory {
        exception InconsistentTypeCode {};
        DynAny create_dyn_any(in any value)
	  raises(InconsistentTypeCode);
//PolyORB:NI:        DynAny create_dyn_any_from_type_code(in CORBA::TypeCode type)
//PolyORB:NI:	  raises(InconsistentTypeCode);
        DynAny create_dyn_any_without_truncation(in any value)
	  raises(InconsistentTypeCode, MustTruncate);
//PolyORB:NI:        DynAnySeq create_multiple_dyn_anys(
//PolyORB:NI:	  in AnySeq values,
//PolyORB:NI:	  in boolean allow_truncate)
//PolyORB:NI:	raises(InconsistentTypeCode, MustTruncate);
//PolyORB:NI:        AnySeq create_multiple_anys(in DynAnySeq values);
    };



}; // module DynamicAny
#endif // _DYNAMIC_ANY_IDL_
