AnnoyingScalar Class Reference

#include <AnnoyingScalar.h>

Public Member Functions

 AnnoyingScalar ()
 
 AnnoyingScalar (long double _v)
 
 AnnoyingScalar (double _v)
 
 AnnoyingScalar (float _v)
 
 AnnoyingScalar (int _v)
 
 AnnoyingScalar (long _v)
 
 AnnoyingScalar (long long _v)
 
 AnnoyingScalar (const AnnoyingScalar &other)
 
 ~AnnoyingScalar ()
 
void init ()
 
AnnoyingScalar operator+ (const AnnoyingScalar &other) const
 
AnnoyingScalar operator- () const
 
AnnoyingScalar operator- (const AnnoyingScalar &other) const
 
AnnoyingScalar operator* (const AnnoyingScalar &other) const
 
AnnoyingScalar operator/ (const AnnoyingScalar &other) const
 
AnnoyingScalaroperator+= (const AnnoyingScalar &other)
 
AnnoyingScalaroperator-= (const AnnoyingScalar &other)
 
AnnoyingScalaroperator*= (const AnnoyingScalar &other)
 
AnnoyingScalaroperator/= (const AnnoyingScalar &other)
 
AnnoyingScalaroperator= (const AnnoyingScalar &other)
 
bool operator== (const AnnoyingScalar &other) const
 
bool operator!= (const AnnoyingScalar &other) const
 
bool operator<= (const AnnoyingScalar &other) const
 
bool operator< (const AnnoyingScalar &other) const
 
bool operator>= (const AnnoyingScalar &other) const
 
bool operator> (const AnnoyingScalar &other) const
 

Public Attributes

float * v
 
float data
 

Static Public Attributes

static int instances = 0
 
static int countdown = 0
 
static bool dont_throw = false
 

Constructor & Destructor Documentation

◆ AnnoyingScalar() [1/8]

AnnoyingScalar::AnnoyingScalar ( )
inline
33  {
34  init();
35  *v = 0;
36  }
void init()
Definition: AnnoyingScalar.h:70
float * v
Definition: AnnoyingScalar.h:122

References init(), and v.

Referenced by operator*(), operator+(), operator-(), and operator/().

◆ AnnoyingScalar() [2/8]

AnnoyingScalar::AnnoyingScalar ( long double  _v)
inline
37  {
38  init();
39  *v = static_cast<float>(_v);
40  }

References init(), and v.

◆ AnnoyingScalar() [3/8]

AnnoyingScalar::AnnoyingScalar ( double  _v)
inline
41  {
42  init();
43  *v = static_cast<float>(_v);
44  }

References init(), and v.

◆ AnnoyingScalar() [4/8]

AnnoyingScalar::AnnoyingScalar ( float  _v)
inline
45  {
46  init();
47  *v = _v;
48  }

References init(), and v.

◆ AnnoyingScalar() [5/8]

AnnoyingScalar::AnnoyingScalar ( int  _v)
inline
49  {
50  init();
51  *v = static_cast<float>(_v);
52  }

References init(), and v.

◆ AnnoyingScalar() [6/8]

AnnoyingScalar::AnnoyingScalar ( long  _v)
inline
53  {
54  init();
55  *v = static_cast<float>(_v);
56  }

References init(), and v.

◆ AnnoyingScalar() [7/8]

AnnoyingScalar::AnnoyingScalar ( long long  _v)
inline
57  {
58  init();
59  *v = static_cast<float>(_v);
60  }

References init(), and v.

◆ AnnoyingScalar() [8/8]

AnnoyingScalar::AnnoyingScalar ( const AnnoyingScalar other)
inline
61  {
62  init();
63  *v = *(other.v);
64  }

References init(), and v.

◆ ~AnnoyingScalar()

AnnoyingScalar::~AnnoyingScalar ( )
inline
65  {
66  if (v != &data) delete v;
67  instances--;
68  }
float data
Definition: AnnoyingScalar.h:123
static int instances
Definition: AnnoyingScalar.h:124

References data, instances, and v.

Member Function Documentation

◆ init()

void AnnoyingScalar::init ( )
inline
70  {
71  if (internal::random<bool>())
72  v = new float;
73  else
74  v = &data;
75  instances++;
76  }

References data, instances, and v.

Referenced by AnnoyingScalar().

◆ operator!=()

bool AnnoyingScalar::operator!= ( const AnnoyingScalar other) const
inline
116 { return numext::not_equal_strict(*v, *other.v); }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool not_equal_strict(const X &x, const Y &y)
Definition: Meta.h:606

References Eigen::numext::not_equal_strict(), and v.

◆ operator*()

AnnoyingScalar AnnoyingScalar::operator* ( const AnnoyingScalar other) const
inline
90 { return AnnoyingScalar((*v) * (*other.v)); }
AnnoyingScalar()
Definition: AnnoyingScalar.h:33

References AnnoyingScalar(), and v.

◆ operator*=()

AnnoyingScalar& AnnoyingScalar::operator*= ( const AnnoyingScalar other)
inline
102  {
103  *v *= *other.v;
104  return *this;
105  }

References v.

◆ operator+()

AnnoyingScalar AnnoyingScalar::operator+ ( const AnnoyingScalar other) const
inline
78  {
79 #ifndef EIGEN_TEST_ANNOYING_SCALAR_DONT_THROW
80  countdown--;
81  if (countdown <= 0 && !dont_throw) throw my_exception();
82 #endif
83  return AnnoyingScalar(*v + *other.v);
84  }
static int countdown
Definition: AnnoyingScalar.h:126
static bool dont_throw
Definition: AnnoyingScalar.h:127
Definition: AnnoyingScalar.h:20

References AnnoyingScalar(), countdown, dont_throw, and v.

◆ operator+=()

AnnoyingScalar& AnnoyingScalar::operator+= ( const AnnoyingScalar other)
inline
94  {
95  *v += *other.v;
96  return *this;
97  }

References v.

◆ operator-() [1/2]

AnnoyingScalar AnnoyingScalar::operator- ( void  ) const
inline
86 { return AnnoyingScalar(-*v); }

References AnnoyingScalar(), and v.

◆ operator-() [2/2]

AnnoyingScalar AnnoyingScalar::operator- ( const AnnoyingScalar other) const
inline
88 { return AnnoyingScalar(*v - *other.v); }

References AnnoyingScalar(), and v.

◆ operator-=()

AnnoyingScalar& AnnoyingScalar::operator-= ( const AnnoyingScalar other)
inline
98  {
99  *v -= *other.v;
100  return *this;
101  }

References v.

◆ operator/()

AnnoyingScalar AnnoyingScalar::operator/ ( const AnnoyingScalar other) const
inline
92 { return AnnoyingScalar((*v) / (*other.v)); }

References AnnoyingScalar(), and v.

◆ operator/=()

AnnoyingScalar& AnnoyingScalar::operator/= ( const AnnoyingScalar other)
inline
106  {
107  *v /= *other.v;
108  return *this;
109  }

References v.

◆ operator<()

bool AnnoyingScalar::operator< ( const AnnoyingScalar other) const
inline
118 { return *v < *other.v; }

References v.

◆ operator<=()

bool AnnoyingScalar::operator<= ( const AnnoyingScalar other) const
inline
117 { return *v <= *other.v; }

References v.

◆ operator=()

AnnoyingScalar& AnnoyingScalar::operator= ( const AnnoyingScalar other)
inline
110  {
111  *v = *other.v;
112  return *this;
113  }

References v.

◆ operator==()

bool AnnoyingScalar::operator== ( const AnnoyingScalar other) const
inline
115 { return numext::equal_strict(*v, *other.v); }
EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC bool equal_strict(const X &x, const Y &y)
Definition: Meta.h:571

References Eigen::numext::equal_strict(), and v.

◆ operator>()

bool AnnoyingScalar::operator> ( const AnnoyingScalar other) const
inline
120 { return *v > *other.v; }

References v.

◆ operator>=()

bool AnnoyingScalar::operator>= ( const AnnoyingScalar other) const
inline
119 { return *v >= *other.v; }

References v.

Member Data Documentation

◆ countdown

int AnnoyingScalar::countdown = 0
static

Referenced by operator+().

◆ data

◆ dont_throw

bool AnnoyingScalar::dont_throw = false
static

◆ instances

int AnnoyingScalar::instances = 0
static

◆ v


The documentation for this class was generated from the following file: