// ********************************************************************** // // Copyright (c) 2003-2007 ZeroC, Inc. All rights reserved. // // This copy of Ice is licensed to you under the terms described in the // ICE_LICENSE file included in this distribution. // // ********************************************************************** #ifndef ICE_OUTGOING_ASYNC_H #define ICE_OUTGOING_ASYNC_H #include #include #include #include #include #include #include #include namespace IceInternal { class BasicStream; class LocalExceptionWrapper; class Outgoing; class ICE_API OutgoingAsyncMessageCallback : virtual public IceUtil::Shared { public: OutgoingAsyncMessageCallback(); virtual ~OutgoingAsyncMessageCallback(); virtual void __sent(Ice::ConnectionI*) = 0; virtual void __finished(const Ice::LocalException&) = 0; virtual void ice_exception(const Ice::Exception&) = 0; BasicStream* __getOs() { return __os; } void __exception(const Ice::Exception&); protected: void __acquire(const Ice::ObjectPrx&); void __release(const Ice::LocalException&); void __release() { IceUtil::Monitor::Lock sync(__monitor); __releaseNoSync(); } void __releaseNoSync(); void __warning(const std::exception&) const; void __warning() const; IceUtil::Monitor __monitor; BasicStream* __is; BasicStream* __os; }; // // We need virtual inheritance from shared, because the user might use // multiple inheritance from IceUtil::Shared. // class ICE_API OutgoingAsync : public OutgoingAsyncMessageCallback, private IceUtil::TimerTask { public: void __sent(Ice::ConnectionI*); void __finished(BasicStream&); void __finished(const Ice::LocalException&); void __finished(const LocalExceptionWrapper&); protected: void __prepare(const Ice::ObjectPrx&, const std::string&, Ice::OperationMode, const Ice::Context*); void __send(); virtual void __response(bool) = 0; void __throwUserException(); private: void handleException(const Ice::LocalException&); void handleException(const LocalExceptionWrapper&); void runTimerTask(); // Implementation of TimerTask::runTimerTask() Ice::ConnectionIPtr _timerTaskConnection; bool _sent; bool _response; ::Ice::ObjectPrx _proxy; Handle< ::IceDelegate::Ice::Object> _delegate; int _cnt; Ice::OperationMode _mode; }; class ICE_API BatchOutgoingAsync : public OutgoingAsyncMessageCallback { public: virtual void __sent(Ice::ConnectionI*); virtual void __finished(const Ice::LocalException&); protected: void __prepare(const InstancePtr&); }; } namespace Ice { class ICE_API AMI_Object_ice_invoke : public IceInternal::OutgoingAsync { public: virtual void ice_response(bool, const std::vector&) = 0; virtual void ice_exception(const Ice::Exception&) = 0; void __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode, const std::vector&, const Context*); protected: virtual void __response(bool); }; class ICE_API AMI_Array_Object_ice_invoke : public IceInternal::OutgoingAsync { public: virtual void ice_response(bool, const std::pair&) = 0; virtual void ice_exception(const Ice::Exception&) = 0; void __invoke(const Ice::ObjectPrx&, const std::string& operation, OperationMode, const std::pair&, const Context*); protected: virtual void __response(bool); }; class ICE_API AMI_Object_ice_flushBatchRequests : public IceInternal::BatchOutgoingAsync { public: void __invoke(const Ice::ObjectPrx&); virtual void ice_exception(const Ice::Exception&) = 0; }; } #endif