00001 // -*- C++ -*- 00002 //$Id: Configurable_Refcount.inl 73581 2006-07-17 14:42:07Z elliott_c $ 00003 00004 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00005 00006 ACE_INLINE 00007 TAO_Configurable_Refcount::TAO_Configurable_Refcount ( 00008 TAO_Configurable_Refcount::Lock_Type type, 00009 unsigned long value) 00010 : type_ (type), 00011 null_refcount_ (value), 00012 mutex_refcount_ (value) 00013 { 00014 } 00015 00016 ACE_INLINE unsigned long 00017 TAO_Configurable_Refcount::increment (void) 00018 { 00019 switch(this->type_) 00020 { 00021 case TAO_NULL_LOCK: 00022 return this->null_refcount_++; 00023 case TAO_THREAD_LOCK: 00024 default: 00025 return this->mutex_refcount_++; 00026 } 00027 } 00028 00029 ACE_INLINE unsigned long 00030 TAO_Configurable_Refcount::decrement (void) 00031 { 00032 switch(this->type_) 00033 { 00034 case TAO_NULL_LOCK: 00035 return --this->null_refcount_; 00036 case TAO_THREAD_LOCK: 00037 default: 00038 return --this->mutex_refcount_; 00039 } 00040 } 00041 00042 ACE_INLINE unsigned long 00043 TAO_Configurable_Refcount::value (void) const 00044 { 00045 switch(this->type_) 00046 { 00047 case TAO_NULL_LOCK: 00048 return this->null_refcount_.value (); 00049 case TAO_THREAD_LOCK: 00050 default: 00051 return this->mutex_refcount_.value (); 00052 } 00053 } 00054 00055 TAO_END_VERSIONED_NAMESPACE_DECL