00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*- 00002 //---------------------------------------------------------------------- 00015 //---------------------------------------------------------------------- 00016 #ifndef ICL_CORE_LOGGING_SCOPED_SEMAPHORE_H_INCLUDED 00017 #define ICL_CORE_LOGGING_SCOPED_SEMAPHORE_H_INCLUDED 00018 00019 #include <icl_core/BaseTypes.h> 00020 #include <icl_core/Noncopyable.h> 00021 #include "icl_core_logging/ImportExport.h" 00022 00023 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00024 # include "icl_core/Deprecate.h" 00025 #endif 00026 00027 namespace icl_core { 00028 namespace logging { 00029 00030 class Semaphore; 00031 00037 class ICL_CORE_LOGGING_IMPORT_EXPORT ScopedSemaphore : protected virtual icl_core::Noncopyable 00038 { 00039 public: 00041 explicit ScopedSemaphore(Semaphore& semaphore); 00042 00044 ~ScopedSemaphore(); 00045 00047 bool isDecremented() const { return m_is_decremented; } 00048 00050 operator bool () const { return isDecremented(); } 00051 00053 #ifdef _IC_BUILDER_DEPRECATED_STYLE_ 00054 00058 ICL_CORE_VC_DEPRECATE_STYLE bool IsDecremented() const ICL_CORE_GCC_DEPRECATE_STYLE; 00059 00060 #endif 00061 00062 00063 private: 00064 Semaphore& m_semaphore; 00065 bool m_is_decremented; 00066 }; 00067 00068 } 00069 } 00070 00071 #endif