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  * This file is part of the LibreOffice project.
00004  *
00005  * This Source Code Form is subject to the terms of the Mozilla Public
00006  * License, v. 2.0. If a copy of the MPL was not distributed with this
00007  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
00008  *
00009  * This file incorporates work covered by the following license notice:
00010  *
00011  *   Licensed to the Apache Software Foundation (ASF) under one or more
00012  *   contributor license agreements. See the NOTICE file distributed
00013  *   with this work for additional information regarding copyright
00014  *   ownership. The ASF licenses this file to you under the Apache
00015  *   License, Version 2.0 (the "License"); you may not use this file
00016  *   except in compliance with the License. You may obtain a copy of
00017  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
00018  */
00019 
00020 
00021 #ifndef _SALHELPER_CONDITION_HXX_
00022 #define _SALHELPER_CONDITION_HXX_
00023 
00024 
00025 #include <osl/conditn.h>
00026 #include <osl/mutex.hxx>
00027 #include "salhelperdllapi.h"
00028 
00029 namespace salhelper
00030 {
00031     class ConditionModifier;
00032     class ConditionWaiter;
00033 
00034 
00035     class SALHELPER_DLLPUBLIC Condition
00036     {
00037         friend class ConditionModifier;
00038         friend class ConditionWaiter;
00039 
00040     public:
00041 
00042         Condition(osl::Mutex& aMutex);
00043 
00044         virtual ~Condition();
00045 
00046 
00047     protected:
00048 
00049         virtual bool applies() const = 0;
00050 
00051 
00052     private:
00053         SALHELPER_DLLPRIVATE Condition(Condition &); // not defined
00054         SALHELPER_DLLPRIVATE void operator =(Condition &); // not defined
00055 
00056         osl::Mutex&  m_aMutex;
00057         oslCondition m_aCondition;
00058     };
00059 
00060 
00061 
00062     class SALHELPER_DLLPUBLIC ConditionModifier
00063     {
00064     public:
00065 
00066         ConditionModifier(Condition& aCond);
00067 
00068         ~ConditionModifier();
00069 
00070 
00071     private:
00072         SALHELPER_DLLPRIVATE ConditionModifier(ConditionModifier &); // not defined
00073         SALHELPER_DLLPRIVATE void operator =(ConditionModifier &); // not defined
00074 
00075         Condition& m_aCond;
00076     };
00077 
00078 
00079 
00080     class SALHELPER_DLLPUBLIC ConditionWaiter
00081     {
00082     public:
00083 
00084         ConditionWaiter(Condition& aCond);
00085 
00086         struct SALHELPER_DLLPUBLIC timedout {
00087             timedout();
00088 
00089             timedout(timedout const &);
00090 
00091             virtual ~timedout();
00092 
00093             timedout & operator =(timedout const &);
00094         };
00095 
00096         ConditionWaiter(Condition& aCond,sal_uInt32 milliSec)
00097             throw(
00098                 timedout
00099             );
00100 
00101 
00102         ~ConditionWaiter();
00103 
00104 
00105     private:
00106         SALHELPER_DLLPRIVATE ConditionWaiter(ConditionWaiter &); // not defined
00107         SALHELPER_DLLPRIVATE void operator =(ConditionWaiter &); // not defined
00108 
00109         Condition& m_aCond;
00110     };
00111 
00112 
00113 }   // namespace salhelper
00114 
00115 
00116 #endif
00117 
00118 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines