00001 #ifndef ROLLER_IMPLEMENTATION_FILE
00002 #define ROLLER_IMPLEMENTATION_FILE
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include "roller.h"
00019
00020 #ifndef ROLLER_CLASS_IMPLEMENTATION
00021 #define ROLLER_CLASS_IMPLEMENTATION
00022
00023 template <class contents>
00024 roller<contents>::roller(contents start, contents end)
00025 : _current_id(start), _start_of_range(start), _end_of_range(end) {}
00026
00027 template <class contents>
00028 void roller<contents>::set_current(contents new_current)
00029 {
00030 _current_id = new_current;
00031 if (_current_id >= _end_of_range) _current_id = _start_of_range;
00032 }
00033
00034 template <class contents> roller<contents>::~roller() {}
00035
00036 template <class contents> contents roller<contents>::current() const
00037 { return _current_id; }
00038
00039 template <class contents> contents roller<contents>::next_id()
00040 {
00041 contents to_return = _current_id;
00042 if (to_return == _end_of_range) {
00043
00044
00045
00046
00047 _current_id = _start_of_range;
00048 to_return = _current_id;
00049 }
00050 _current_id++;
00051 if (_current_id == _end_of_range) _current_id = _start_of_range;
00052
00053 return to_return;
00054 }
00055
00056 #endif
00057
00058
00059 #endif //ROLLER_IMPLEMENTATION_FILE
00060