vtf-logo

CyclicIndex.h

00001 // -*- C++ -*-
00002 
00003 #if !defined(__geom_CyclicIndex_h__)
00004 #define __geom_CyclicIndex_h__
00005 
00006 // If we are debugging the whole geom namespace.
00007 #if defined(DEBUG_geom) && !defined(DEBUG_CyclicIndex)
00008 #define DEBUG_CyclicIndex
00009 #endif
00010 
00011 #include "../defs.h"
00012 
00013 #include <cassert>
00014 
00015 BEGIN_NAMESPACE_GEOM
00016 
00018 class CyclicIndex {
00019   //
00020   // Data
00021   //
00022 
00023 private:
00024 
00025   int _index, _n;
00026 
00027   //
00028   // Friends
00029   //
00030 
00031   friend CyclicIndex& operator++(CyclicIndex& ci);
00032   friend CyclicIndex& operator--(CyclicIndex& ci);
00033 
00035   CyclicIndex();
00036 
00037 public:
00038 
00039   //--------------------------------------------------------------------------
00041   // @{
00042 
00044   CyclicIndex(const int n) : 
00045     _index(0), 
00046     _n(n) { 
00047 #ifdef DEBUG_CyclicIndex
00048     assert(_n > 0); 
00049 #endif
00050   }
00051 
00053   CyclicIndex(const CyclicIndex& other) : 
00054     _index(other._index), 
00055     _n(other._n) { 
00056 #ifdef DEBUG_CyclicIndex
00057     assert(_n > 0); 
00058 #endif
00059   }
00060 
00062   CyclicIndex& 
00063   operator=(const CyclicIndex& other);
00064   
00066   ~CyclicIndex()
00067   {}
00068 
00069   // @}
00070   //--------------------------------------------------------------------------
00072   // @{
00073 
00075   int 
00076   operator()() const { 
00077     return _index; 
00078   }
00079 
00080   // @}
00081   //--------------------------------------------------------------------------
00083   // @{
00084 
00086   void set(int i);
00087 };
00088 
00089 //
00090 // Increment and Decrement Operators.
00091 //
00092   
00094 
00095 CyclicIndex& 
00096 operator++(CyclicIndex& ci);
00097 
00099 
00100 CyclicIndex& 
00101 operator--(CyclicIndex& ci);
00102 
00103 END_NAMESPACE_GEOM
00104 
00105 #define __geom_CyclicIndex_ipp__
00106 #include "CyclicIndex.ipp"
00107 #undef __geom_CyclicIndex_ipp__
00108 
00109 #endif

Generated on Fri Aug 24 12:55:52 2007 for Computational Geometry Package by  doxygen 1.4.7