GiNaC 1.8.7
Public Member Functions | Private Attributes | Static Private Attributes | List of all members
GiNaC::_numeric_digits Class Reference

This class is used to instantiate a global singleton object Digits which behaves just like Maple's Digits. More...

#include <numeric.h>

Public Member Functions

 _numeric_digits ()
 _numeric_digits default ctor, checking for singleton invariance. More...
 
_numeric_digitsoperator= (long prec)
 Assign a native long to global Digits object. More...
 
 operator long ()
 Convert global Digits object to native type long. More...
 
void print (std::ostream &os) const
 Append global Digits object to ostream. More...
 
void add_callback (digits_changed_callback callback)
 Add a new callback function. More...
 

Private Attributes

long digits
 Number of decimal digits. More...
 
std::vector< digits_changed_callbackcallbacklist
 

Static Private Attributes

static bool too_late = false
 Already one object present. More...
 

Detailed Description

This class is used to instantiate a global singleton object Digits which behaves just like Maple's Digits.

We need an object rather than a dumber basic type since as a side-effect we let it change cl_default_float_format when it gets changed. The only other meaningful thing to do with it is converting it to an unsigned, for temporarily storing its value e.g. The user must not create an own working object of this class! Since C++ forces us to make the class definition visible in order to use an object we put in a flag which prevents other objects of that class to be created.

Definition at line 51 of file numeric.h.

Constructor & Destructor Documentation

◆ _numeric_digits()

GiNaC::_numeric_digits::_numeric_digits ( )

_numeric_digits default ctor, checking for singleton invariance.

Definition at line 2520 of file numeric.cpp.

References too_late.

Member Function Documentation

◆ operator=()

_numeric_digits & GiNaC::_numeric_digits::operator= ( long  prec)

Assign a native long to global Digits object.

Definition at line 2537 of file numeric.cpp.

References callbacklist, and digits.

◆ operator long()

GiNaC::_numeric_digits::operator long ( )

Convert global Digits object to native type long.

Definition at line 2553 of file numeric.cpp.

◆ print()

void GiNaC::_numeric_digits::print ( std::ostream &  os) const

Append global Digits object to ostream.

Definition at line 2561 of file numeric.cpp.

References digits.

Referenced by GiNaC::operator<<().

◆ add_callback()

void GiNaC::_numeric_digits::add_callback ( digits_changed_callback  callback)

Add a new callback function.

Definition at line 2568 of file numeric.cpp.

References callbacklist.

Member Data Documentation

◆ digits

long GiNaC::_numeric_digits::digits
private

Number of decimal digits.

Definition at line 62 of file numeric.h.

Referenced by operator=(), and print().

◆ too_late

bool GiNaC::_numeric_digits::too_late = false
staticprivate

Already one object present.

Definition at line 63 of file numeric.h.

Referenced by _numeric_digits().

◆ callbacklist

std::vector<digits_changed_callback> GiNaC::_numeric_digits::callbacklist
private

Definition at line 65 of file numeric.h.

Referenced by add_callback(), and operator=().


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

This page is part of the GiNaC developer's reference. It was generated automatically by doxygen. For an introduction, see the tutorial.