Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

phConditionCounter.h

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission : 
00003         Realtime Vision Processing System
00004     
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008     
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission 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 for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifndef _PHCONDITIONCOUNTER_H
00027 #define _PHCONDITIONCOUNTER_H
00028 
00029 #include <phStandard.h>
00030 #include <phCondition.h>
00031 
00038 /* ------------------------------------------------------------------------- */
00040 #define phCHECK_NOT_EQUAL           (1<<0)
00041 
00042 #define phCHECK_EQUAL               (1<<1)
00043 
00044 #define phCHECK_GREATER_THAN        (1<<2)
00045 
00046 #define phCHECK_LESS_THAN           (1<<3)
00047 
00049 #define phCHECK_NE                  phCHECK_NOT_EQUAL
00050 
00051 #define phCHECK_E                   phCHECK_EQUAL
00052 
00053 #define phCHECK_GT                  phCHECK_GREATER_THAN
00054 
00055 #define phCHECK_LT                  phCHECK_LESS_THAN
00056 
00058 #define phCHECK_GREATER_THAN_EQUAL  (phCHECK_EQUAL | phCHECK_GT)
00059 
00060 #define phCHECK_LESS_THAN_EQUAL     (phCHECK_EQUAL | phCHECK_LT)
00061 
00063 #define phCHECK_GTE                 phCHECK_GREATER_THAN_EQUAL
00064 
00065 #define phCHECK_LTE                 phCHECK_LESS_THAN_EQUAL
00066 
00072 #define phConditionCounter_WAKEUP   (-2)
00073 
00074 /* ------------------------------------------------------------------------- */
00099 PHAPI(class) phConditionCounter : public phCondition
00100 {
00101 private:
00103     intmax_t m_value;
00109     int      m_wake;
00111     intmax_t m_waiting;
00112 
00113 public:
00120     phConditionCounter( intmax_t value = 0 );
00121     ~phConditionCounter();
00122 
00136     int increment( intmax_t inc_value = 1 );
00151     int decrement( intmax_t dec_value = 1 );
00152 
00164     int         setValue( intmax_t value );
00173     intmax_t    getValue( );
00174 
00175     /* Wakes up anyone waiting on the condition */
00205     int         wakeup      ();
00206 
00266     int waitForValue( intmax_t  value, 
00267                       int       check_op,
00268                       intmax_t  *return_value = NULL);
00269 };    
00270  /* end \addtogroup ThreadSync */
00272 
00273 #endif /* _PHCONDITIONCOUNTER_H */




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:01 2007 for phission by  doxygen 1.4.4