BALL  1.5.0
colorUnit.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_VIEW_DATATYPE_COLORUNIT_H
6 #define BALL_VIEW_DATATYPE_COLORUNIT_H
7 
8 #include <BALL/common.h>
9 #include <BALL/DATATYPE/string.h>
10 #include <BALL/MATHS/common.h>
11 
12 #include <iostream>
13 #include <cstdio>
14 
15 namespace BALL
16 {
17  namespace VIEW
18  {
33  {
34  public:
35 
36  //BALL_CREATE(ColorUnit)
37 
41 
49  {
50  public:
51 
52  NotInHexFormat(const char* file, int line, const string& data);
53  };
54 
56 
59 
64 
67  ColorUnit(const ColorUnit& color_unit);
68 
75  ColorUnit(const char* value);
76 
82  ColorUnit(const String& value);
83 
87  ColorUnit(const unsigned char value);
88 
93  ColorUnit(const short value);
94 
99  ColorUnit(const unsigned short value);
100 
105  ColorUnit(const int value);
106 
111  ColorUnit(const unsigned int value);
112 
117  ColorUnit(const long value);
118 
123  ColorUnit(const unsigned long value);
124 
129  ColorUnit(const float value);
130 
135  ColorUnit(const double value);
136 
138 
140 
144 
151  void clear();
152 
154 
157 
161  operator String () const;
162 
166  operator char () const;
167 
171  operator unsigned char () const;
172 
176  operator short () const;
177 
181  operator unsigned short () const;
182 
186  operator int () const;
187 
191  operator unsigned int () const;
192 
196  operator long () const;
197 
201  operator unsigned long () const;
202 
206  operator float () const;
207 
211  operator double () const;
212 
214 
217 
220  void set(const ColorUnit& color_unit);
221 
225  const ColorUnit& operator = (const ColorUnit& color_unit);
226 
229  void swap(ColorUnit& color_unit);
230 
232 
235 
241  void set(const char* value);
242 
249  const ColorUnit& operator = (const char* value);
250 
256  void get(char* value) const;
257 
265  void set(const String& value);
266 
273  const ColorUnit& operator = (const String& value);
274 
278  void get(String& value) const;
279 
283  void set(const unsigned char value);
284 
289  const ColorUnit& operator = (const unsigned char value);
290 
294  void get(unsigned char& value) const;
295 
300  void set(const short value);
301 
307  const ColorUnit& operator = (const short value);
308 
312  void get(short& value) const;
313 
318  void set(const unsigned short value);
319 
325  const ColorUnit& operator = (const unsigned short value);
326 
330  void get(unsigned short& value) const;
331 
336  void set(const int value);
337 
343  const ColorUnit& operator = (const int value);
344 
348  void get(int& value) const;
349 
354  void set(const unsigned int value);
355 
361  const ColorUnit& operator = (const unsigned int value);
362 
366  void get(unsigned int& value) const;
367 
372  void set(const long value);
373 
379  const ColorUnit& operator = (const long value);
380 
384  void get(long& value) const;
385 
390  void set(const unsigned long value);
391 
397  const ColorUnit& operator = (const unsigned long value);
398 
402  void get(unsigned long& value) const;
403 
408  void set(const float value);
409 
415  const ColorUnit& operator = (const float value);
416 
420  void get(float& value) const;
421 
426  void set(const double value);
427 
433  const ColorUnit& operator = (const double value);
434 
438  void get(double& value) const;
439 
441 
444 
449  bool operator == (const ColorUnit& color_unit) const;
450 
455  bool operator != (const ColorUnit& color_unit) const;
456 
461  bool operator < (const ColorUnit& color_unit) const;
462 
467  bool operator <= (const ColorUnit& color_unit) const;
468 
473  bool operator > (const ColorUnit& color_unit) const;
474 
479  bool operator >= (const ColorUnit& color_unit) const;
480 
482 
485 
493  void dump(std::ostream& s = std::cout, Size depth = 0) const;
494 
496 
499 
507  friend std::istream& operator >> (std::istream& s, ColorUnit& color_unit);
508 
515  friend std::ostream& operator << (std::ostream& s, const ColorUnit& color_unit);
517 
518  private:
519 
520  // @throws Exception::InvalidRange
521  // @throws Exception::NotInHexFormat
522  float hexToFloat_(const char* value);
523 
524  float value_;
525 
526  };
527 
528 # ifndef BALL_NO_INLINE_FUNCTIONS
529 # include <BALL/VIEW/DATATYPE/colorUnit.iC>
530 # endif
531 
532  } // namespace VIEW
533 } // namespace BALL
534 
535 #endif // BALL_VIEW_DATATYPE_COLORUNIT_H
Definition: constants.h:13
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
BALL_EXPORT bool operator<(const String &s1, const String &s2)
BALL_EXPORT bool operator>(const String &s1, const String &s2)
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL_EXPORT bool operator>=(const String &s1, const String &s2)
BALL_EXPORT bool operator<=(const String &s1, const String &s2)
std::ostream & operator<<(std::ostream &o, const PixelFormat &f)
Definition: pixelFormat.h:209
void get(unsigned int &value) const
void get(long &value) const
void set(const int value)
ColorUnit(const float value)
ColorUnit(const char *value)
void swap(ColorUnit &color_unit)
void set(const char *value)
void get(unsigned char &value) const
ColorUnit(const short value)
ColorUnit(const unsigned char value)
void get(unsigned long &value) const
ColorUnit(const unsigned long value)
void set(const double value)
ColorUnit(const unsigned short value)
ColorUnit(const unsigned int value)
void set(const unsigned long value)
void set(const unsigned char value)
void set(const long value)
void set(const unsigned short value)
ColorUnit(const long value)
void get(double &value) const
void get(unsigned short &value) const
void dump(std::ostream &s=std::cout, Size depth=0) const
void set(const String &value)
ColorUnit(const double value)
void get(int &value) const
void set(const float value)
ColorUnit(const ColorUnit &color_unit)
ColorUnit(const String &value)
void get(String &value) const
void set(const ColorUnit &color_unit)
void get(char *value) const
ColorUnit(const int value)
void get(float &value) const
void set(const short value)
void set(const unsigned int value)
void get(short &value) const
NotInHexFormat(const char *file, int line, const string &data)
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52