00001 #ifndef SAFE_ROLLER_CLASS 00002 #define SAFE_ROLLER_CLASS 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : safe_roller * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1998-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "mechanisms_dll.h" 00019 00020 // forward. 00021 class int_roller; 00022 00024 00029 class MECHANISMS_CLASS_STYLE safe_roller 00030 { 00031 public: 00032 safe_roller(int start_of_range = 0, int end_of_range = MAXINT); 00034 00040 ~safe_roller(); 00041 00042 int next_id(); 00044 00045 int current() const; 00047 00052 void set_current(int new_current); 00054 00056 private: 00057 int_roller *_rolling; 00058 mutex *_lock; 00059 00060 // forbidden... 00061 safe_roller(const safe_roller &); 00062 safe_roller &operator =(const safe_roller &); 00063 }; 00064 00066 00067 void MECHANISMS_FUNCTION_STYLE safe_add(int &to_change, int addition); 00069 00073 #endif 00074
1.5.1