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
Namespaces | Functions
pixel.cpp File Reference
#include "./pixel.hpp"
#include "../util/types.hpp"
#include "boost/algorithm/string.hpp"
#include <cmath>
#include <iostream>
#include <sstream>
#include <string>
Include dependency graph for pixel.cpp:

Go to the source code of this file.

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)
 
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/3]

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/3]

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/3]

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+() [1/2]

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/2]

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+=()

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<()

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}
const float & get_value() const
Definition pixel.hpp:41

◆ 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<=()

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==() [1/3]

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/3]

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/3]

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>()

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>=()

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>>()

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}