00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 #ifndef COLOR_TABLE_ATT_H
00036 #define COLOR_TABLE_ATT_H
00037
00038 #include "color-table.hh"
00039 #include "attribute.hh"
00040
00041
00042
00043
00044
00045
00046
00047 class Color_Table_Att : public CAttribute {
00048
00049 public:
00050
00051
00052 Color_Table_Att();
00053 Color_Table_Att(Color const & c1, Color const & c2,
00054 Color const & c3, Color const & c4);
00055 Color_Table_Att(Color_Table *t);
00056
00057
00058 virtual ~Color_Table_Att();
00059
00060
00061 TAttributeId getType() const;
00062 Color_Table * Get_Data();
00063 CAttribute * copy() const;
00064 void destroy();
00065 void save(std::ostream &fd) const;
00066 void load(std::istream &fd);
00067
00068 private:
00069
00070
00071 Color_Table * tab;
00072 };
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084 #include "user.hh"
00085
00086
00087 inline
00088 Color_Table_Att::Color_Table_Att()
00089 {
00090 tab = new Color_Table();
00091 }
00092
00093
00094 inline
00095 Color_Table_Att::Color_Table_Att(Color const & c1, Color const & c2,
00096 Color const & c3, Color const & c4)
00097 {
00098 tab = new Color_Table(c1, c2, c3, c4);
00099 }
00100
00101
00102 inline
00103 Color_Table_Att::Color_Table_Att(Color_Table * t)
00104 {
00105 tab = t;
00106 }
00107
00108
00109
00110 inline
00111 Color_Table_Att::~Color_Table_Att()
00112 {
00113 delete tab;
00114 }
00115
00116
00117
00118 inline
00119 TAttributeId Color_Table_Att::getType() const
00120 {
00121 return COLOR_TABLE_ATTRIBUTE_ID;
00122 }
00123
00124
00125 inline
00126 Color_Table * Color_Table_Att::Get_Data()
00127 {
00128 return tab;
00129 }
00130
00131
00132 inline
00133 CAttribute * Color_Table_Att::copy() const
00134 {
00135 Color_Table * t = new Color_Table(*(this->tab));
00136
00137 return new Color_Table_Att(t);
00138 }
00139
00140
00141 inline
00142 void Color_Table_Att::destroy()
00143 {
00144 delete this;
00145 }
00146
00147
00148 inline
00149 void Color_Table_Att::save(std::ostream &fd) const
00150 {
00151 for (int i=0 ; i<4 ; i++)
00152 fd << *tab->Get_Color(i);
00153 }
00154
00155
00156 inline
00157 void Color_Table_Att::load(std::istream &fd)
00158 {
00159 Color col;
00160
00161 for (int i=0; i<4; i++)
00162 {
00163 fd >> col;
00164 tab->Set_Color(i, col);
00165 }
00166 }
00167
00168 #endif