![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /****************************************************************************** 00002 ** Copyright (c) 1999 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 ******************************************************************************/ 00005 /****************************************************************************** 00006 ** $RCSfile: colorCount.h,v $ $Revision: 1.4 $ $State: Exp $ 00007 ******************************************************************************/ 00008 #ifndef colorCount_H_ 00009 #define colorCount_H_ 00010 00011 #include "gdb/gdbDefines.h" 00012 #include "geometry/gdbColor.h" 00013 00014 // class DtColorCountRecord: 00015 // 00016 // Record for counting colors. Maintains a count for each new color 00017 // encountered. Maximum number of colors the structure can handle is 00018 // defined as a constant. 00019 00020 00021 class DT_DLL_gdb DtColorCountRecord 00022 { 00023 public: 00024 00025 // constructor 00026 DtColorCountRecord(); 00027 00028 // destructor 00029 virtual ~DtColorCountRecord(); 00030 00031 private: 00032 // Copy constructor and Assignment operator not implemented 00033 DtColorCountRecord(const DtColorCountRecord& original); 00034 DtColorCountRecord& operator=(const DtColorCountRecord& original); 00035 00036 00037 public: 00038 00039 virtual void addColor(const DtColor &c); 00040 virtual DtColor mostCommon(); 00041 00042 protected: 00043 // returns index of c if already exists in the table. returns -1 00044 // otherwise. 00045 virtual int lookupColor(const DtColor &c); 00046 00047 // return i-th color stored in the array 00048 virtual DtColor color(int i) const; 00049 00050 // returns the index of the first free cell available 00051 virtual int firstFreeCell() const; 00052 00053 protected: 00054 00055 static const unsigned int theMaxColors; 00056 00057 protected: 00058 00059 int myFirstFreeCell; 00060 DtColor* myColor; 00061 int* myCount; 00062 }; 00063 00064 inline DtColor DtColorCountRecord::color(int i) const 00065 { 00066 return myColor[i]; 00067 } 00068 00069 inline int DtColorCountRecord::firstFreeCell() const 00070 { 00071 return myFirstFreeCell; 00072 } 00073 00074 #endif