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
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const float value)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const double value)
BALL::VIEW::ColorUnit::get
void get(String &value) const
BALL::VIEW::ColorUnit::get
void get(unsigned long &value) const
BALL::VIEW::ColorUnit::get
void get(unsigned char &value) const
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const unsigned long value)
BALL::VIEW::ColorUnit::set
void set(const ColorUnit &color_unit)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const ColorUnit &color_unit)
BALL::operator!=
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
BALL::VIEW::ColorUnit::get
void get(double &value) const
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const char *value)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const long value)
BALL::VIEW::ColorUnit::set
void set(const unsigned int value)
BALL::VIEW::ColorUnit::set
void set(const float value)
BALL::VIEW::ColorUnit::get
void get(int &value) const
BALL::operator<
BALL_EXPORT bool operator<(const String &s1, const String &s2)
BALL::VIEW::ColorUnit::set
void set(const short value)
BALL::VIEW::ColorUnit::set
void set(const long value)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const unsigned int value)
double
BALL::String
Definition: string.h:57
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const int value)
BALL::operator>
BALL_EXPORT bool operator>(const String &s1, const String &s2)
BALL::VIEW::ColorUnit::set
void set(const char *value)
BALL::operator>=
BALL_EXPORT bool operator>=(const String &s1, const String &s2)
BALL
Definition: constants.h:13
BALL::VIEW::ColorUnit::swap
void swap(ColorUnit &color_unit)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const unsigned char value)
BALL::VIEW::ColorUnit::NotInHexFormat
Definition: colorUnit.h:49
BALL::VIEW::ColorUnit::~ColorUnit
~ColorUnit()
BALL::VIEW::ColorUnit::get
void get(long &value) const
BALL::VIEW::ColorUnit::get
void get(char *value) const
BALL::VIEW::ColorUnit::set
void set(const String &value)
BALL_SIZE_TYPE
BALL::VIEW::ColorUnit::dump
void dump(std::ostream &s=std::cout, Size depth=0) const
BALL::VIEW::ColorUnit::get
void get(unsigned short &value) const
BALL::VIEW::ColorUnit::get
void get(unsigned int &value) const
BALL_VIEW_EXPORT
#define BALL_VIEW_EXPORT
Definition: COMMON/global.h:52
BALL::VIEW::ColorUnit::set
void set(const int value)
BALL::VIEW::ColorUnit::set
void set(const unsigned char value)
string.h
BALL::VIEW::ColorUnit::NotInHexFormat::NotInHexFormat
NotInHexFormat(const char *file, int line, const string &data)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const short value)
BALL::operator==
BALL_EXPORT bool operator==(const String &s1, const String &s2)
BALL::VIEW::ColorUnit::get
void get(short &value) const
common.h
BALL::VIEW::ColorUnit::clear
void clear()
BALL::operator>>
std::istream & operator>>(std::istream &is, TRegularData1D< ValueType > &grid)
Input operator.
Definition: regularData1D.h:802
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit()
common.h
BALL::VIEW::ColorUnit::set
void set(const unsigned short value)
BALL::Exception::GeneralException
Definition: COMMON/exception.h:61
BALL::VIEW::ColorUnit::get
void get(float &value) const
BALL::VIEW::ColorUnit::set
void set(const unsigned long value)
BALL::VIEW::ColorUnit::set
void set(const double value)
BALL::operator<=
BALL_EXPORT bool operator<=(const String &s1, const String &s2)
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const unsigned short value)
BALL::VIEW::ColorUnit
Definition: colorUnit.h:33
BALL::VIEW::operator<<
std::ostream & operator<<(std::ostream &o, const PixelFormat &f)
Definition: pixelFormat.h:209
BALL::VIEW::ColorUnit::ColorUnit
ColorUnit(const String &value)
float