// $Id$ template ACE_INLINE TAO_EC_Auto_Command::TAO_EC_Auto_Command (void) : command_ () , allow_command_ (0) { } template ACE_INLINE TAO_EC_Auto_Command::TAO_EC_Auto_Command (const T & command) : command_ (command) , allow_command_ (1) { } template ACE_INLINE TAO_EC_Auto_Command::~TAO_EC_Auto_Command (void) { this->execute (); } template ACE_INLINE void TAO_EC_Auto_Command::set_command (const T & command) { this->command_ = command; this->allow_command_ = 1; } template ACE_INLINE void TAO_EC_Auto_Command::set_command (TAO_EC_Auto_Command & auto_command) { if (this == &auto_command) return; this->command_ = auto_command.command_; this->allow_command_ = auto_command.allow_command_; auto_command.allow_command_ = 0; } template ACE_INLINE void TAO_EC_Auto_Command::execute (void) { if (this->allow_command_) { this->allow_command_ = 0; ACE_TRY_NEW_ENV { this->command_.execute (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHANY { // ignore. } ACE_ENDTRY; } } template ACE_INLINE void TAO_EC_Auto_Command::allow_command (void) { this->allow_command_ = 1; } template ACE_INLINE void TAO_EC_Auto_Command::disallow_command (void) { this->allow_command_ = 0; } //*************************************************************************** template ACE_INLINE TAO_EC_Shutdown_Command::TAO_EC_Shutdown_Command (void) : target_ () { } template ACE_INLINE TAO_EC_Shutdown_Command::TAO_EC_Shutdown_Command (T target) : target_ (target) { } template ACE_INLINE void TAO_EC_Shutdown_Command::execute (ACE_ENV_SINGLE_ARG_DECL) { if (this->target_.in ()) { this->target_->shutdown (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_CHECK; } } //*************************************************************************** // Life would be much easier if _add_ref() and _remove_ref() // had throw specs of "throw ()" #include template ACE_INLINE TAO_EC_Servant_Var:: TAO_EC_Servant_Var(T * p) : ptr_(p) { } // If _add_ref throws, this object will not be completely constructed // so the destructor will not be called. template ACE_INLINE TAO_EC_Servant_Var:: TAO_EC_Servant_Var(TAO_EC_Servant_Var const & rhs) : ptr_(rhs.ptr_) { if (ptr_) { ACE_TRY_NEW_ENV { ptr_->_add_ref (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHALL { ACE_RE_THROW; } ACE_ENDTRY; } } template ACE_INLINE TAO_EC_Servant_Var & TAO_EC_Servant_Var:: operator=(TAO_EC_Servant_Var const & rhs) { TAO_EC_Servant_Var tmp(rhs); // std::swap(tmp.ptr_, ptr_); T * swap_temp = tmp.ptr_; tmp.ptr_ = ptr_; ptr_ = swap_temp; return *this; } template ACE_INLINE TAO_EC_Servant_Var & TAO_EC_Servant_Var:: operator=(T * p) { TAO_EC_Servant_Var tmp(p); // std::swap(tmp.ptr_, ptr_); T * swap_temp = tmp.ptr_; tmp.ptr_ = ptr_; ptr_ = swap_temp; return *this; } template ACE_INLINE TAO_EC_Servant_Var:: ~TAO_EC_Servant_Var() { // Unfortunately, there is no throw spec on _remove_ref, so we // can't assume that it will not throw. If it does, then we are in // trouble. In any event, we can't let the exception escape our // destructor. if (ptr_ != 0) { ACE_TRY_NEW_ENV { ptr_->_remove_ref (ACE_ENV_SINGLE_ARG_PARAMETER); ACE_TRY_CHECK; } ACE_CATCHALL { } ACE_ENDTRY; } } #if !defined(ACE_LACKS_MEMBER_TEMPLATES) template template ACE_INLINE TAO_EC_Servant_Var:: TAO_EC_Servant_Var(Y * p) : ptr_(p) { } template template ACE_INLINE TAO_EC_Servant_Var:: TAO_EC_Servant_Var(TAO_EC_Servant_Var const & rhs) : ptr_(rhs.in()) { if (ptr_) { ptr_->_add_ref(); } } template template ACE_INLINE TAO_EC_Servant_Var & TAO_EC_Servant_Var:: operator=(TAO_EC_Servant_Var const & rhs) { TAO_EC_Servant_Var tmp(rhs); // std::swap(tmp.ptr_, ptr_); T * swap_temp = tmp.ptr_; tmp.ptr_ = ptr_; ptr_ = swap_temp; return *this; } template template ACE_INLINE TAO_EC_Servant_Var & TAO_EC_Servant_Var:: operator=(Y * p) { TAO_EC_Servant_Var tmp(p); // std::swap(tmp.ptr_, ptr_); T * swap_temp = tmp.ptr_; tmp.ptr_ = ptr_; ptr_ = swap_temp; return *this; } #endif /* ACE_LACKS_MEMBER_TEMPLATES */ template ACE_INLINE T const * TAO_EC_Servant_Var:: operator->() const { return ptr_; } template ACE_INLINE T * TAO_EC_Servant_Var:: operator->() { return ptr_; } template ACE_INLINE T const & TAO_EC_Servant_Var:: operator*() const { return *ptr_; } template ACE_INLINE T & TAO_EC_Servant_Var:: operator*() { return *ptr_; } template ACE_INLINE TAO_EC_Servant_Var:: operator void const * () const { return ptr_; } template ACE_INLINE T * TAO_EC_Servant_Var:: in() const { return ptr_; } template ACE_INLINE T *& TAO_EC_Servant_Var:: inout() { return ptr_; } template ACE_INLINE T *& TAO_EC_Servant_Var:: out() { TAO_EC_Servant_Var tmp; // std::swap(tmp.ptr_, ptr_); T * swap_temp = tmp.ptr_; tmp.ptr_ = ptr_; ptr_ = swap_temp; return ptr_; } template ACE_INLINE T * TAO_EC_Servant_Var:: _retn() { T * rval = ptr_; ptr_ = 0; return rval; } template ACE_INLINE bool operator==(TAO_EC_Servant_Var const & x, TAO_EC_Servant_Var const & y) { return x.in() == y.in(); } template ACE_INLINE bool operator!=(TAO_EC_Servant_Var const & x, TAO_EC_Servant_Var const & y) { return x.in() != y.in(); }