EventSemaphore.hpp

00001 #if   !defined(__EVENTSEMAPHORE_HPP)
00002 #define  __EVENTSEMAPHORE_HPP
00003 
00004 /*
00005   CoreLinux++ 
00006   Copyright (C) 1999,2000 CoreLinux Consortium
00007   
00008    The CoreLinux++ Library is free software; you can redistribute it and/or
00009    modify it under the terms of the GNU Library General Public License as
00010    published by the Free Software Foundation; either version 2 of the
00011    License, or (at your option) any later version.
00012 
00013    The CoreLinux++ Library Library is distributed in the hope that it will 
00014    be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016    Library General Public License for more details.
00017 
00018    You should have received a copy of the GNU Library General Public
00019    License along with the GNU C Library; see the file COPYING.LIB.  If not,
00020    write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00021    Boston, MA 02111-1307, USA.  
00022 */
00023 
00024 #if   !defined(__COMMON_HPP)
00025 #include <Common.hpp>
00026 #endif
00027 
00028 #if   !defined(__SEMAPHORE_HPP)
00029 #include <Semaphore.hpp>
00030 #endif
00031 
00032 namespace corelinux
00033 {
00034    DECLARE_CLASS( EventSemaphore );
00035 
00041    class EventSemaphore : public Semaphore
00042    {
00043    public:
00044 
00045       //
00046       // Constructors and destructors
00047       //
00048 
00062                EventSemaphore
00063                   ( 
00064                      SemaphoreGroupPtr aGroup,
00065                      SemaphoreIdentifierRef aIdentifier,
00066                      Counter aLimit,
00067                      bool aRecursionFlag = true,
00068                      bool aBalkingFlag = false
00069                   ) throw ( NullPointerException );
00070 
00072      
00073       virtual  ~EventSemaphore( void );
00074 
00075       //
00076       // Accessors
00077       //
00078 
00080       
00081       virtual  bool isLocked( void ) ;
00082 
00083       //
00084       // Mutators
00085       //
00086 
00091                SemaphoreOperationStatus post( void )
00092                   throw( SemaphoreException );
00093 
00099       virtual  SemaphoreOperationStatus lockWithWait( void ) 
00100                   throw( SemaphoreException );
00101 
00106       virtual  SemaphoreOperationStatus lockWithNoWait( void )
00107                   throw( SemaphoreException );
00108 
00110       
00111 //      virtual  SemaphoreOperationStatus   lockWithTimeOut( Timer )
00112 //                   throw(SemaphoreException) = 0;
00113       
00115       
00116       virtual  SemaphoreOperationStatus release( void ) 
00117                   throw( SemaphoreException );
00118       
00127       virtual  void setLimit ( Counter aLimit ) throw ( SemaphoreException );
00128 
00133       virtual  Counter getLimit ( void ) const;
00134 
00135    protected:
00136 
00137       //
00138       // Constructors
00139       //
00141 
00142                EventSemaphore( void ) throw( Assertion );
00143 
00145 
00146                EventSemaphore( EventSemaphoreCref ) throw( Assertion );
00147 
00148       //
00149       // Operator overloads
00150       //
00152 
00153                EventSemaphoreRef operator=( EventSemaphoreCref ) 
00154                   throw( Assertion );
00155 
00156    private:
00157 
00159 
00160       Counter   theNumListeners; 
00161 
00163 
00164       Counter   theMaxListeners;
00165    };
00166 
00167 }
00168 
00169 #endif // if !defined(__EVENTSEMAPHORE_HPP)
00170 
00171 /*
00172    Common rcs information do not modify
00173    $Author: dulimart $
00174    $Revision: 1.7 $
00175    $Date: 2000/11/15 22:32:06 $
00176    $Locker:  $
00177 */
00178 
00179 

This is the CoreLinux++ reference manual
Provided by The CoreLinux Consortium