Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Examples

SemaphoreGroup.hpp

00001 #if !defined(__SEMAPHOREGROUP_HPP) 00002 #define __SEMAPHOREGROUP_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(__SEMAPHORECOMMON_HPP) 00029 #include <SemaphoreCommon.hpp> 00030 #endif 00031 00032 #if !defined(__ABSTRACTSEMAPHORE_HPP) 00033 #include <AbstractSemaphore.hpp> 00034 #endif 00035 00036 #if !defined(__MAP_HPP) 00037 #include <Map.hpp> 00038 #endif 00039 00040 00041 namespace corelinux 00042 { 00043 const Dword NAMEBUFFERSIZE(254); 00044 00045 struct SemaphoreReference 00046 { 00047 Int theCount; 00048 AbstractSemaphorePtr theSem; 00049 }; 00050 00051 CORELINUX_MAP( Index, SemaphoreReference, std::less<Index> , SemaphoreShares ); 00052 00053 DECLARE_CLASS( SemaphoreGroup ); 00054 00062 class SemaphoreGroup : public Synchronized 00063 { 00064 public: 00065 00078 SemaphoreGroup( Short , Int Rights = OWNER_ALL ) 00079 throw(Assertion,SemaphoreException); 00080 00103 SemaphoreGroup 00104 ( 00105 Short, 00106 SemaphoreGroupIdentifierCref, 00107 Int , 00108 CreateDisposition disp=FAIL_IF_EXISTS 00109 ) throw(Assertion,SemaphoreException); 00110 00132 SemaphoreGroup 00133 ( 00134 Short, 00135 CharCptr, 00136 Int , 00137 CreateDisposition disp=FAIL_IF_EXISTS 00138 ) throw(Assertion,SemaphoreException); 00139 00140 00142 00143 virtual ~SemaphoreGroup( void ); 00144 00145 // 00146 // Operator overloads 00147 // 00148 00155 bool operator==( SemaphoreGroupCref ) const; 00156 // 00157 // Accessors 00158 // 00164 Short getSemaphoreCount( void ) const; 00165 00171 inline SemaphoreGroupIdentifierCref getIdentifier( void ) const 00172 { 00173 return theIdentifier; 00174 } 00175 00176 // 00177 // Factory methods 00178 // 00179 00186 virtual AbstractSemaphorePtr createSemaphore( void ) 00187 throw( SemaphoreException ) = 0; 00188 00206 virtual AbstractSemaphorePtr createSemaphore 00207 ( 00208 SemaphoreIdentifierRef aIdentifier, 00209 CreateDisposition disp = CREATE_OR_REUSE, 00210 bool Recursive=false, 00211 bool Balking = false 00212 ) throw( SemaphoreException ) = 0; 00213 00232 virtual AbstractSemaphorePtr createSemaphore 00233 ( 00234 std::string aName, 00235 CreateDisposition disp = CREATE_OR_REUSE, 00236 bool Recursive=false, 00237 bool Balking = false 00238 ) throw( SemaphoreException ) = 0; 00239 00247 virtual void destroySemaphore( AbstractSemaphorePtr ) 00248 throw( SemaphoreException ) = 0; 00249 protected: 00250 00251 // 00252 // Constructors 00253 // 00255 00256 SemaphoreGroup( void ) throw( Assertion ); 00257 00259 00260 SemaphoreGroup( SemaphoreGroupCref ) 00261 throw( Assertion ); 00262 00263 // 00264 // Operator overloads 00265 // 00266 00268 00269 SemaphoreGroupRef operator=( SemaphoreGroupCref ) 00270 throw( Assertion ); 00271 00272 // 00273 // Methods for shared control 00274 // 00275 00284 void setGroupType( IntCref ) const; 00285 00293 // 00294 // Methods for SemaphoreGroup base 00295 // 00296 00298 00299 inline bool isPrivate( void ) const 00300 { 00301 return (theGroupCSA == NULLPTR); 00302 } 00303 00304 protected: 00305 00306 private: 00307 00308 friend class SemaphoreCommon; 00309 00311 00312 SemaphoreGroupIdentifier theIdentifier; 00313 00315 00316 Short theNumberOfSemaphores; 00317 00319 00320 CSAGrpHeaderPtr theGroupCSA; 00321 00323 00324 Char theName[NAMEBUFFERSIZE]; 00325 00326 }; 00327 } 00328 00329 #endif // if !defined(__SEMAPHOREGROUP_HPP) 00330 00331 /* 00332 Common rcs information do not modify 00333 $Author: prudhomm $ 00334 $Revision: 1.9 $ 00335 $Date: 2000/08/31 22:52:20 $ 00336 $Locker: $ 00337 */ 00338

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