#ifndef __X10_LANG_FINISHSTATE__ROOTFINISH_H
#define __X10_LANG_FINISHSTATE__ROOTFINISH_H

#include <x10rt.h>


#define X10_LANG_FINISHSTATE__ROOTFINISHSKELETON_H_NODEPS
#include <x10/lang/FinishState__RootFinishSkeleton.h>
#undef X10_LANG_FINISHSTATE__ROOTFINISHSKELETON_H_NODEPS
#define X10_UTIL_CONCURRENT_SIMPLELATCH_H_NODEPS
#include <x10/util/concurrent/SimpleLatch.h>
#undef X10_UTIL_CONCURRENT_SIMPLELATCH_H_NODEPS
#define X10_LANG_INT_H_NODEPS
#include <x10/lang/Int.h>
#undef X10_LANG_INT_H_NODEPS
#define X10_UTIL_INDEXEDMEMORYCHUNK_H_NODEPS
#include <x10/util/IndexedMemoryChunk.h>
#undef X10_UTIL_INDEXEDMEMORYCHUNK_H_NODEPS
#define X10_UTIL_INDEXEDMEMORYCHUNK_H_NODEPS
#include <x10/util/IndexedMemoryChunk.h>
#undef X10_UTIL_INDEXEDMEMORYCHUNK_H_NODEPS
namespace x10 { namespace compiler { 
class Embed;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class Stack;
} } 
namespace x10 { namespace lang { 
class Throwable;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T)> class IndexedMemoryChunk;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace lang { 
class Place;
} } 
namespace x10 { namespace util { namespace concurrent { 
class Lock;
} } } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class GlobalRef;
} } 
namespace x10 { namespace lang { 
class FinishState;
} } 
namespace x10 { namespace lang { 
class Runtime;
} } 
namespace x10 { namespace lang { 
class Runtime__Worker;
} } 
namespace x10 { namespace lang { 
class VoidFun_0_0;
} } 
namespace x10 { namespace lang { 
class FinishState__FinishStates;
} } 
namespace x10 { namespace compiler { 
class RemoteInvocation;
} } 
namespace x10 { namespace lang { 
class MultipleExceptions;
} } 
namespace x10 { namespace util { 
template<class TPMGL(T), class TPMGL(U)> class Pair;
} } 
namespace x10 { namespace lang { 
class Zero;
} } 
namespace x10 { namespace lang { 

class FinishState__RootFinish : public x10::lang::FinishState__RootFinishSkeleton
  {
    public:
    RTT_H_DECLS_CLASS
    
    static x10aux::itable_entry _itables[3];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    static x10::lang::Runtime__Mortal::itable<x10::lang::FinishState__RootFinish > _itable_0;
    
    static x10::lang::Any::itable<x10::lang::FinishState__RootFinish > _itable_1;
    
    virtual x10_boolean _isMortal() { return true; }
    
    x10::util::concurrent::SimpleLatch _Embed_latch;
    x10aux::ref<x10::util::concurrent::SimpleLatch> FMGL(latch);
    
    x10_int FMGL(count);
    
    x10aux::ref<x10::util::Stack<x10aux::ref<x10::lang::Throwable> > >
      FMGL(exceptions);
    
    x10::util::IndexedMemoryChunk<x10_int > FMGL(counts);
    
    x10::util::IndexedMemoryChunk<x10_boolean > FMGL(seen);
    
    void _constructor();
    
    static x10aux::ref<x10::lang::FinishState__RootFinish> _make(
             );
    
    void _constructor(x10aux::ref<x10::util::concurrent::SimpleLatch> latch);
    
    static x10aux::ref<x10::lang::FinishState__RootFinish> _make(
             x10aux::ref<x10::util::concurrent::SimpleLatch> latch);
    
    virtual void notifySubActivitySpawn(x10::lang::Place place);
    virtual void notifyActivityTermination();
    virtual void process(x10aux::ref<x10::lang::Throwable> t);
    virtual void pushException(x10aux::ref<x10::lang::Throwable> t);
    virtual void waitForFinish();
    virtual void process(x10::util::IndexedMemoryChunk<x10_int > rail);
    virtual void notify(x10::util::IndexedMemoryChunk<x10_int > rail);
    virtual void process(x10::util::IndexedMemoryChunk<x10::util::Pair<x10_int, x10_int> > rail);
    virtual void notify(x10::util::IndexedMemoryChunk<x10::util::Pair<x10_int, x10_int> > rail);
    virtual void notify(x10::util::IndexedMemoryChunk<x10_int > rail,
                        x10aux::ref<x10::lang::Throwable> t);
    virtual void notify(x10::util::IndexedMemoryChunk<x10::util::Pair<x10_int, x10_int> > rail,
                        x10aux::ref<x10::lang::Throwable> t);
    virtual x10aux::ref<x10::util::concurrent::SimpleLatch>
      simpleLatch();
    virtual x10aux::ref<x10::lang::FinishState__RootFinish>
      x10__lang__FinishState__RootFinish____x10__lang__FinishState__RootFinish__this(
      );
    void __fieldInitializers43522();
    
    // 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);
    
};

} } 
#endif // X10_LANG_FINISHSTATE__ROOTFINISH_H

namespace x10 { namespace lang { 
class FinishState__RootFinish;
} } 

#ifndef X10_LANG_FINISHSTATE__ROOTFINISH_H_NODEPS
#define X10_LANG_FINISHSTATE__ROOTFINISH_H_NODEPS
#ifndef X10_LANG_FINISHSTATE__ROOTFINISH_H_GENERICS
#define X10_LANG_FINISHSTATE__ROOTFINISH_H_GENERICS
#endif // X10_LANG_FINISHSTATE__ROOTFINISH_H_GENERICS
#endif // __X10_LANG_FINISHSTATE__ROOTFINISH_H_NODEPS
