scifir-units 2.0.0
scifir-units is a library of units of measurement, angles, coordinates, fields, and related data, all lightweight, that help in the development of scientific software and scientific machines
Loading...
Searching...
No Matches
Classes | Namespaces | Functions
pixel.hpp File Reference
#include "../units/constants.hpp"
#include "../util/is_number.hpp"
#include "../units/scalar_unit.hpp"
#include "boost/math/constants/constants.hpp"
#include <cmath>
#include <string>
Include dependency graph for pixel.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  scifir::pixel
 

Namespaces

namespace  scifir
 The namespace scifir contains all scifir-units, excepting the string literals, which are outside.
 

Functions

string scifir::to_string (const pixel &x)
 
bool scifir::is_pixel (const string &init_pixel)
 
pixel scifir::sqrt (const pixel &x)
 
pixel scifir::sqrt_nth (const pixel &x, int index)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator+ (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator- (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator* (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator/ (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator^ (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator== (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator!= (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator< (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator> (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator<= (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator>= (T x, const scifir::pixel &y)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator== (const scifir::pixel &y, T x)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator!= (const scifir::pixel &y, T x)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator< (const scifir::pixel &y, T x)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator> (const scifir::pixel &y, T x)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator<= (const scifir::pixel &y, T x)
 
template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator>= (const scifir::pixel &y, T x)
 
bool operator== (const scifir::pixel &x, const scifir::pixel &y)
 
bool operator!= (const scifir::pixel &x, const scifir::pixel &y)
 
bool operator< (const scifir::pixel &x, const scifir::pixel &y)
 
bool operator> (const scifir::pixel &x, const scifir::pixel &y)
 
bool operator<= (const scifir::pixel &x, const scifir::pixel &y)
 
bool operator>= (const scifir::pixel &x, const scifir::pixel &y)
 
bool operator== (const scifir::pixel &x, const string &init_pixel)
 
bool operator!= (const scifir::pixel &x, const string &init_pixel)
 
bool operator== (const string &init_pixel, const scifir::pixel &x)
 
bool operator!= (const string &init_pixel, const scifir::pixel &x)
 
void operator+= (string &x, const scifir::pixel &y)
 
string operator+ (const string &x, const scifir::pixel &y)
 
string operator+ (const scifir::pixel &y, const string &x)
 
ostream & operator<< (ostream &os, const scifir::pixel &x)
 
istream & operator>> (istream &is, scifir::pixel &x)
 

Function Documentation

◆ operator!=() [1/5]

bool operator!= ( const scifir::pixel x,
const scifir::pixel y 
)

Definition at line 261 of file pixel.cpp.

262{
263 return !(x == y);
264}

◆ operator!=() [2/5]

bool operator!= ( const scifir::pixel x,
const string &  init_pixel 
)

Definition at line 306 of file pixel.cpp.

307{
308 return !(x == init_pixel);
309}

◆ operator!=() [3/5]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator!= ( const scifir::pixel y,
x 
)

Definition at line 219 of file pixel.hpp.

220{
221 return (x != y.get_value());
222}
const float & get_value() const
Definition pixel.hpp:41

◆ operator!=() [4/5]

bool operator!= ( const string &  init_pixel,
const scifir::pixel x 
)

Definition at line 317 of file pixel.cpp.

318{
319 return !(init_pixel == x);
320}

◆ operator!=() [5/5]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator!= ( x,
const scifir::pixel y 
)

Definition at line 183 of file pixel.hpp.

184{
185 return (x != y.get_value());
186}

◆ operator*()

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator* ( x,
const scifir::pixel y 
)

Definition at line 159 of file pixel.hpp.

160{
161 return scifir::pixel(x * y.get_value());
162}

◆ operator+() [1/3]

string operator+ ( const scifir::pixel y,
const string &  x 
)

Definition at line 337 of file pixel.cpp.

338{
339 ostringstream output;
340 output << y;
341 output << x;
342 return output.str();
343}

◆ operator+() [2/3]

string operator+ ( const string &  x,
const scifir::pixel y 
)

Definition at line 329 of file pixel.cpp.

330{
331 ostringstream output;
332 output << x;
333 output << y;
334 return output.str();
335}

◆ operator+() [3/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator+ ( x,
const scifir::pixel y 
)

Definition at line 147 of file pixel.hpp.

148{
149 return scifir::pixel(x + y.get_value());
150}

◆ operator+=()

void operator+= ( string &  x,
const scifir::pixel y 
)

Definition at line 322 of file pixel.cpp.

323{
324 ostringstream output;
325 output << y;
326 x += output.str();
327}

◆ operator-()

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator- ( x,
const scifir::pixel y 
)

Definition at line 153 of file pixel.hpp.

154{
155 return scifir::pixel(x - y.get_value());
156}

◆ operator/()

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator/ ( x,
const scifir::pixel y 
)

Definition at line 165 of file pixel.hpp.

166{
167 return scifir::pixel(x / y.get_value());
168}

◆ operator<() [1/3]

bool operator< ( const scifir::pixel x,
const scifir::pixel y 
)

Definition at line 266 of file pixel.cpp.

267{
268 if(x.get_value() < y.get_value())
269 {
270 return true;
271 }
272 else
273 {
274 return false;
275 }
276}

◆ operator<() [2/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator< ( const scifir::pixel y,
x 
)

Definition at line 225 of file pixel.hpp.

226{
227 return (y.get_value() < x);
228}

◆ operator<() [3/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator< ( x,
const scifir::pixel y 
)

Definition at line 189 of file pixel.hpp.

190{
191 return (x < y.get_value());
192}

◆ operator<<()

ostream & operator<< ( ostream &  os,
const scifir::pixel x 
)

Definition at line 345 of file pixel.cpp.

346{
347 return os << to_string(x);
348}
string to_string(const aid &x)
Creates a string representation of aid, it's for aid equivalent to the display() function of aid.
Definition aid.cpp:582

◆ operator<=() [1/3]

bool operator<= ( const scifir::pixel x,
const scifir::pixel y 
)

Definition at line 290 of file pixel.cpp.

291{
292 return !(x > y);
293}

◆ operator<=() [2/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator<= ( const scifir::pixel y,
x 
)

Definition at line 237 of file pixel.hpp.

238{
239 return (y.get_value() <= x);
240}

◆ operator<=() [3/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator<= ( x,
const scifir::pixel y 
)

Definition at line 201 of file pixel.hpp.

202{
203 return (x <= y.get_value());
204}

◆ operator==() [1/5]

bool operator== ( const scifir::pixel x,
const scifir::pixel y 
)

Definition at line 249 of file pixel.cpp.

250{
251 if(x.get_value() == y.get_value())
252 {
253 return true;
254 }
255 else
256 {
257 return false;
258 }
259}

◆ operator==() [2/5]

bool operator== ( const scifir::pixel x,
const string &  init_pixel 
)

Definition at line 300 of file pixel.cpp.

301{
302 scifir::pixel y = scifir::pixel(init_pixel);
303 return (x == y);
304}

◆ operator==() [3/5]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator== ( const scifir::pixel y,
x 
)

Definition at line 213 of file pixel.hpp.

214{
215 return (x == y.get_value());
216}

◆ operator==() [4/5]

bool operator== ( const string &  init_pixel,
const scifir::pixel x 
)

Definition at line 311 of file pixel.cpp.

312{
313 scifir::pixel y = scifir::pixel(init_pixel);
314 return (y == x);
315}

◆ operator==() [5/5]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator== ( x,
const scifir::pixel y 
)

Definition at line 177 of file pixel.hpp.

178{
179 return (x == y.get_value());
180}

◆ operator>() [1/3]

bool operator> ( const scifir::pixel x,
const scifir::pixel y 
)

Definition at line 278 of file pixel.cpp.

279{
280 if(x.get_value() > y.get_value())
281 {
282 return true;
283 }
284 else
285 {
286 return false;
287 }
288}

◆ operator>() [2/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator> ( const scifir::pixel y,
x 
)

Definition at line 231 of file pixel.hpp.

232{
233 return (y.get_value() > x);
234}

◆ operator>() [3/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator> ( x,
const scifir::pixel y 
)

Definition at line 195 of file pixel.hpp.

196{
197 return (x > y.get_value());
198}

◆ operator>=() [1/3]

bool operator>= ( const scifir::pixel x,
const scifir::pixel y 
)

Definition at line 295 of file pixel.cpp.

296{
297 return !(x < y);
298}

◆ operator>=() [2/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator>= ( const scifir::pixel y,
x 
)

Definition at line 243 of file pixel.hpp.

244{
245 return (y.get_value() >= x);
246}

◆ operator>=() [3/3]

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
bool operator>= ( x,
const scifir::pixel y 
)

Definition at line 207 of file pixel.hpp.

208{
209 return (x >= y.get_value());
210}

◆ operator>>()

istream & operator>> ( istream &  is,
scifir::pixel x 
)

Definition at line 350 of file pixel.cpp.

351{
352 char a[256];
353 is.getline(a, 256);
354 string b(a);
355 boost::trim(b);
356 x = scifir::pixel(b);
357 return is;
358}

◆ operator^()

template<typename T , typename = typename enable_if<scifir::is_number<T>::value>::type>
scifir::pixel operator^ ( x,
const scifir::pixel y 
)

Definition at line 171 of file pixel.hpp.

172{
173 return scifir::pixel(std::pow(x, y.get_value()));
174}