Main Page   Packages   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Search  

C:/temp/src/j2k/Beta/Math/JCounter.hpp

Go to the documentation of this file.
00001 #ifndef __J2K__Counter_HPP__
00002 #define __J2K__Counter_HPP__
00003 
00004 #include <j2k/Fred/Standard.hpp>
00005 
00006 class JCounter {
00007   inline JCounter( ULONG init = 0 ) : cnt( init ) { } 
00008   inline JCounter( const JCounter& src ) : cnt( src.cnt ) { } 
00009   inline ~JCounter() { }
00010 
00011   inline  const JCounter&  operator=  ( const JCounter& src ) { cnt = src.cnt; }
00012   inline  const JCounter&  operator+= ( const JCounter& src ) { cnt += src.cnt;  return *this; }
00013   inline  const JCounter&  operator-= ( const JCounter& src ) { cnt -= src.cnt;  return *this; }
00014 
00015   inline  const JCounter&  operator+= ( ULONG v ) { cnt += v;  return *this; }
00016   inline  const JCounter&  operator-= ( ULONG v ) { cnt -= v;  return *this; }
00017 
00018   // Pre update
00019   inline  const JCounter&  operator++ ( ) {     ++cnt;  return *this; }
00020   inline  const JCounter&  operator-- ( ) {     --cnt;  return *this; }
00021 
00022   // Post update
00023   inline  const JCounter&  operator++ ( int ) { cnt++;  return *this; }
00024   inline  const JCounter&  operator-- ( int ) { cnt--;  return *this; }
00025 
00026   // Set Maximum
00027   inline  const JCounter&  operator~  ( ) { cnt = (ULONG)(~0); return *this; }
00028  
00029   // Set Minimum
00030   inline  const JCounter&  operator!  ( ) { cnt = 0;  return *this; }
00031 
00032   inline  ULONG            operator() ( ) { return cnt; }
00033 
00034   // Compare operators:
00035   inline  BOOL  operator== ( const JCounter& src ) { return (cnt == src.cnt); }
00036   inline  BOOL  operator!= ( const JCounter& src ) { return (cnt == src.cnt); }
00037   inline  BOOL  operator>  ( const JCounter& src ) { return (cnt >  src.cnt); }
00038   inline  BOOL  operator>= ( const JCounter& src ) { return (cnt >= src.cnt); }
00039   inline  BOOL  operator<  ( const JCounter& src ) { return (cnt <  src.cnt); }
00040   inline  BOOL  operator<= ( const JCounter& src ) { return (cnt <= src.cnt); }
00041 
00042   inline  BOOL  operator== ( ULONG v ) { return (cnt == v); }
00043   inline  BOOL  operator>  ( ULONG v ) { return (cnt >  v); }
00044   inline  BOOL  operator>= ( ULONG v ) { return (cnt >= v); }
00045   inline  BOOL  operator<  ( ULONG v ) { return (cnt <  v); }
00046   inline  BOOL  operator<= ( ULONG v ) { return (cnt <= v); }
00047 
00048 
00049 };
00050 
00051 #endif

Generated on Sun Oct 14 18:46:13 2001 for Standard J2K Library by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001