GiNaC  1.6.2
Public Member Functions | Private Attributes | Static Private Attributes
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>

List of all members.

Public Member Functions

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

Private Attributes

long digits
 Number of decimal digits.
std::vector
< digits_changed_callback
callbacklist

Static Private Attributes

static bool too_late = false
 Already one object present.

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 temprary 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 57 of file numeric.h.


Constructor & Destructor Documentation

GiNaC::_numeric_digits::_numeric_digits ( )

_numeric_digits default ctor, checking for singleton invariance.

Definition at line 2516 of file numeric.cpp.

References too_late.


Member Function Documentation

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

Assign a native long to global Digits object.

Definition at line 2533 of file numeric.cpp.

References callbacklist, and digits.

GiNaC::_numeric_digits::operator long ( )

Convert global Digits object to native type long.

Definition at line 2550 of file numeric.cpp.

References digits.

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

Append global Digits object to ostream.

Definition at line 2558 of file numeric.cpp.

References digits.

Referenced by GiNaC::operator<<().

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

Add a new callback function.

Definition at line 2565 of file numeric.cpp.

References callbacklist.


Member Data Documentation

Number of decimal digits.

Definition at line 68 of file numeric.h.

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

bool GiNaC::_numeric_digits::too_late = false [static, private]

Already one object present.

Definition at line 69 of file numeric.h.

Referenced by _numeric_digits().

Definition at line 71 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.