UDK 3.2.7 C/C++ API Reference
salhelper/condition.hxx
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /*************************************************************************
00003  *
00004  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
00005  *
00006  * Copyright 2000, 2010 Oracle and/or its affiliates.
00007  *
00008  * OpenOffice.org - a multi-platform office productivity suite
00009  *
00010  * This file is part of OpenOffice.org.
00011  *
00012  * OpenOffice.org is free software: you can redistribute it and/or modify
00013  * it under the terms of the GNU Lesser General Public License version 3
00014  * only, as published by the Free Software Foundation.
00015  *
00016  * OpenOffice.org is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU Lesser General Public License version 3 for more details
00020  * (a copy is included in the LICENSE file that accompanied this code).
00021  *
00022  * You should have received a copy of the GNU Lesser General Public License
00023  * version 3 along with OpenOffice.org.  If not, see
00024  * <http://www.openoffice.org/license.html>
00025  * for a copy of the LGPLv3 License.
00026  *
00027  ************************************************************************/
00028 
00029 
00030 #ifndef _SALHELPER_CONDITION_HXX_
00031 #define _SALHELPER_CONDITION_HXX_
00032 
00033 
00034 #include <osl/conditn.h>
00035 #include <osl/mutex.hxx>
00036 #include "salhelperdllapi.h"
00037 
00038 namespace salhelper
00039 {
00040     class ConditionModifier;
00041     class ConditionWaiter;
00042 
00043 
00044     class SALHELPER_DLLPUBLIC Condition
00045     {
00046         friend class ConditionModifier;
00047         friend class ConditionWaiter;
00048 
00049     public:
00050 
00051         Condition(osl::Mutex& aMutex);
00052 
00053         virtual ~Condition();
00054 
00055 
00056     protected:
00057 
00058         virtual bool applies() const = 0;
00059 
00060 
00061     private:
00062         SALHELPER_DLLPRIVATE Condition(Condition &); // not defined
00063         SALHELPER_DLLPRIVATE void operator =(Condition &); // not defined
00064 
00065         osl::Mutex&  m_aMutex;
00066         oslCondition m_aCondition;
00067     };
00068 
00069 
00070 
00071     class SALHELPER_DLLPUBLIC ConditionModifier
00072     {
00073     public:
00074 
00075         ConditionModifier(Condition& aCond);
00076 
00077         ~ConditionModifier();
00078 
00079 
00080     private:
00081         SALHELPER_DLLPRIVATE ConditionModifier(ConditionModifier &); // not defined
00082         SALHELPER_DLLPRIVATE void operator =(ConditionModifier &); // not defined
00083 
00084         Condition& m_aCond;
00085     };
00086 
00087 
00088 
00089     class SALHELPER_DLLPUBLIC ConditionWaiter
00090     {
00091     public:
00092 
00093         ConditionWaiter(Condition& aCond);
00094 
00095         struct SALHELPER_DLLPUBLIC timedout {
00096             timedout();
00097 
00098             timedout(timedout const &);
00099 
00100             virtual ~timedout();
00101 
00102             timedout & operator =(timedout const &);
00103         };
00104 
00105         ConditionWaiter(Condition& aCond,sal_uInt32 milliSec)
00106             throw(
00107                 timedout
00108             );
00109 
00110 
00111         ~ConditionWaiter();
00112 
00113 
00114     private:
00115         SALHELPER_DLLPRIVATE ConditionWaiter(ConditionWaiter &); // not defined
00116         SALHELPER_DLLPRIVATE void operator =(ConditionWaiter &); // not defined
00117 
00118         Condition& m_aCond;
00119     };
00120 
00121 
00122 }   // namespace salhelper
00123 
00124 
00125 #endif
00126 
00127 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines