#ifndef __X10_LANG_RUNTIME__REMOTE_H
#define __X10_LANG_RUNTIME__REMOTE_H

#include <x10rt.h>


#define X10_LANG_RUNTIME__REMOTECONTROL_H_NODEPS
#include <x10/lang/Runtime__RemoteControl.h>
#undef X10_LANG_RUNTIME__REMOTECONTROL_H_NODEPS
namespace x10 { namespace io { 
class SerialData;
} } 
namespace x10 { namespace lang { 
class UnsupportedOperationException;
} } 
namespace x10 { namespace lang { 
class String;
} } 
namespace x10 { namespace lang { 
class Object;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class Box;
} } 
namespace x10 { namespace lang { 

template<class TPMGL(T)> class Runtime__Remote;
template <> class Runtime__Remote<void>;
template<class TPMGL(T)> class Runtime__Remote : public x10::lang::Runtime__RemoteControl
  {
    public:
    RTT_H_DECLS_CLASS
    
    static x10aux::itable_entry _itables[4];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    static x10::io::CustomSerialization::itable<x10::lang::Runtime__Remote<TPMGL(T)> > _itable_0;
    
    static x10::lang::Any::itable<x10::lang::Runtime__Remote<TPMGL(T)> > _itable_1;
    
    static x10::lang::Runtime__Mortal::itable<x10::lang::Runtime__Remote<TPMGL(T)> > _itable_2;
    
    virtual x10_boolean _isMortal() { return true; }
    
    void _constructor();
    
    static x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > _make(
             );
    
    void _constructor(x10aux::ref<x10::io::SerialData> id__49);
    
    static x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > _make(
             x10aux::ref<x10::io::SerialData> id__49);
    
    x10aux::ref<x10::util::Box<TPMGL(T)> > FMGL(t);
    
    virtual x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > x10__lang__Runtime__Remote____x10__lang__Runtime__Remote__this(
      );
    void __fieldInitializers44659();
    
    // Serialization
    public: static const x10aux::serialization_id_t _serialization_id;
    
    public: virtual x10aux::serialization_id_t _get_serialization_id() {
         return _serialization_id;
    }
    
    public: virtual void _serialize_body(x10aux::serialization_buffer& buf);
    
    public: static x10aux::ref<x10::lang::Reference> _deserializer(x10aux::deserialization_buffer& buf);
    
    public: void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};
template <> class Runtime__Remote<void> : public x10::lang::Runtime__RemoteControl
{
    public:
    static x10aux::RuntimeType rtt;
    static const x10aux::RuntimeType* getRTT() { return & rtt; }
    
};

} } 
#endif // X10_LANG_RUNTIME__REMOTE_H

namespace x10 { namespace lang { 
template<class TPMGL(T)> class Runtime__Remote;
} } 

#ifndef X10_LANG_RUNTIME__REMOTE_H_NODEPS
#define X10_LANG_RUNTIME__REMOTE_H_NODEPS
#include <x10/lang/Runtime__RemoteControl.h>
#include <x10/io/SerialData.h>
#include <x10/lang/UnsupportedOperationException.h>
#include <x10/lang/String.h>
#include <x10/lang/Object.h>
#include <x10/util/Box.h>
#ifndef X10_LANG_RUNTIME__REMOTE_H_GENERICS
#define X10_LANG_RUNTIME__REMOTE_H_GENERICS
#endif // X10_LANG_RUNTIME__REMOTE_H_GENERICS
#ifndef X10_LANG_RUNTIME__REMOTE_H_IMPLEMENTATION
#define X10_LANG_RUNTIME__REMOTE_H_IMPLEMENTATION
#include <x10/lang/Runtime__Remote.h>

template<class TPMGL(T)> x10::io::CustomSerialization::itable<x10::lang::Runtime__Remote<TPMGL(T)> >  x10::lang::Runtime__Remote<TPMGL(T)>::_itable_0(&x10::lang::Runtime__Remote<TPMGL(T)>::equals, &x10::lang::Runtime__Remote<TPMGL(T)>::hashCode, &x10::lang::Runtime__Remote<TPMGL(T)>::serialize, &x10::lang::Runtime__Remote<TPMGL(T)>::toString, &x10::lang::Runtime__Remote<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10::lang::Any::itable<x10::lang::Runtime__Remote<TPMGL(T)> >  x10::lang::Runtime__Remote<TPMGL(T)>::_itable_1(&x10::lang::Runtime__Remote<TPMGL(T)>::equals, &x10::lang::Runtime__Remote<TPMGL(T)>::hashCode, &x10::lang::Runtime__Remote<TPMGL(T)>::toString, &x10::lang::Runtime__Remote<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10::lang::Runtime__Mortal::itable<x10::lang::Runtime__Remote<TPMGL(T)> >  x10::lang::Runtime__Remote<TPMGL(T)>::_itable_2(&x10::lang::Runtime__Remote<TPMGL(T)>::equals, &x10::lang::Runtime__Remote<TPMGL(T)>::hashCode, &x10::lang::Runtime__Remote<TPMGL(T)>::toString, &x10::lang::Runtime__Remote<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10::lang::Runtime__Remote<TPMGL(T)>::_itables[4] = {x10aux::itable_entry(&x10aux::getRTT<x10::io::CustomSerialization>, &_itable_0), x10aux::itable_entry(&x10aux::getRTT<x10::lang::Any>, &_itable_1), x10aux::itable_entry(&x10aux::getRTT<x10::lang::Runtime__Mortal>, &_itable_2), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<x10::lang::Runtime__Remote<TPMGL(T)> >())};

//#line 958 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::lang::Runtime__Remote<TPMGL(T)>::_constructor(
                           ) {
    
    //#line 958 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::lang::Runtime__RemoteControl::_constructor();
    
    //#line 958 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.AssignPropertyCall_c
    
    //#line 957 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> >)this)->x10::lang::Runtime__Remote<TPMGL(T)>::__fieldInitializers44659();
}
template<class TPMGL(T)> x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > x10::lang::Runtime__Remote<TPMGL(T)>::_make(
                           ) {
    x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::lang::Runtime__Remote<TPMGL(T)> >(), 0, sizeof(x10::lang::Runtime__Remote<TPMGL(T)>))) x10::lang::Runtime__Remote<TPMGL(T)>();
    this_->_constructor();
    return this_;
}



//#line 959 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::lang::Runtime__Remote<TPMGL(T)>::_constructor(
                           x10aux::ref<x10::io::SerialData> id__49) {
    
    //#line 959 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::lang::Runtime__RemoteControl::_constructor();
    
    //#line 959 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.AssignPropertyCall_c
    
    //#line 957 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": Eval of x10.ast.X10Call_c
    ((x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> >)this)->x10::lang::Runtime__Remote<TPMGL(T)>::__fieldInitializers44659();
    
    //#line 960 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": polyglot.ast.Throw_c
    x10aux::throwException(x10aux::nullCheck(x10::lang::UnsupportedOperationException::_make(((x10aux::string_utils::lit("Cannot deserialize ")) + (x10aux::type_name(((x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> >)this)))))));
}
template<class TPMGL(T)> x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > x10::lang::Runtime__Remote<TPMGL(T)>::_make(
                           x10aux::ref<x10::io::SerialData> id__49)
{
    x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::lang::Runtime__Remote<TPMGL(T)> >(), 0, sizeof(x10::lang::Runtime__Remote<TPMGL(T)>))) x10::lang::Runtime__Remote<TPMGL(T)>();
    this_->_constructor(id__49);
    return this_;
}



//#line 962 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10FieldDecl_c

//#line 957 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> >
  x10::lang::Runtime__Remote<TPMGL(T)>::x10__lang__Runtime__Remote____x10__lang__Runtime__Remote__this(
  ) {
    
    //#line 957 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> >)this);
    
}

//#line 957 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::lang::Runtime__Remote<TPMGL(T)>::__fieldInitializers44659(
  ) {
    
    //#line 957 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/Runtime.x10": Eval of x10.ast.X10FieldAssign_c
    ((x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> >)this)->
      FMGL(t) = X10_NULL;
}
template<class TPMGL(T)> const x10aux::serialization_id_t x10::lang::Runtime__Remote<TPMGL(T)>::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10::lang::Runtime__Remote<TPMGL(T)>::_deserializer, x10aux::CLOSURE_KIND_NOT_ASYNC);

template<class TPMGL(T)> void x10::lang::Runtime__Remote<TPMGL(T)>::_serialize_body(x10aux::serialization_buffer& buf) {
    /* NOTE: Implements x10.io.CustomSerialization */
    buf.write(this->serialize());
    
}

template<class TPMGL(T)> x10aux::ref<x10::lang::Reference> x10::lang::Runtime__Remote<TPMGL(T)>::_deserializer(x10aux::deserialization_buffer& buf) {
    x10aux::ref<x10::lang::Runtime__Remote<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::lang::Runtime__Remote<TPMGL(T)> >(), 0, sizeof(x10::lang::Runtime__Remote<TPMGL(T)>))) x10::lang::Runtime__Remote<TPMGL(T)>();
    buf.record_reference(this_);
    this_->_deserialize_body(buf);
    return this_;
}

template<class TPMGL(T)> void x10::lang::Runtime__Remote<TPMGL(T)>::_deserialize_body(x10aux::deserialization_buffer& buf) {
    /* NOTE: Implements x10.io.CustomSerialization */
    x10aux::ref<x10::io::SerialData>val_ = buf.read<x10aux::ref<x10::io::SerialData> >();
    _constructor(val_);
    
}

template<class TPMGL(T)> x10aux::RuntimeType x10::lang::Runtime__Remote<TPMGL(T)>::rtt;
template<class TPMGL(T)> void x10::lang::Runtime__Remote<TPMGL(T)>::_initRTT() {
    const x10aux::RuntimeType *canonical = x10aux::getRTT<x10::lang::Runtime__Remote<void> >();
    if (rtt.initStageOne(canonical)) return;
    const x10aux::RuntimeType* parents[1] = { x10aux::getRTT<x10::lang::Runtime__RemoteControl>()};
    const x10aux::RuntimeType* params[1] = { x10aux::getRTT<TPMGL(T)>()};
    x10aux::RuntimeType::Variance variances[1] = { x10aux::RuntimeType::invariant};
    const char *baseName = "x10.lang.Runtime.Remote";
    rtt.initStageTwo(baseName, x10aux::RuntimeType::class_kind, 1, parents, 1, params, variances);
}
#endif // X10_LANG_RUNTIME__REMOTE_H_IMPLEMENTATION
#endif // __X10_LANG_RUNTIME__REMOTE_H_NODEPS
