ACE  6.5.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
ACE_CDR::Fixed Class Reference

#include <CDR_Base.h>

Classes

class  ConstIterator
class  Iterator
class  IteratorBase
class  Proxy

Public Types

enum  { MAX_DIGITS = 31, MAX_STRING_SIZE = 4 + MAX_DIGITS, POSITIVE = 0xc, NEGATIVE = 0xd }

Public Member Functions

 operator LongLong () const
 operator LongDouble () const
Fixed round (UShort scale) const
Fixed truncate (UShort scale) const
bool to_string (char *buffer, size_t buffer_size) const
const Octetto_octets (int &n) const
Fixedoperator+= (const Fixed &rhs)
Fixedoperator-= (const Fixed &rhs)
Fixedoperator*= (const Fixed &rhs)
Fixedoperator/= (const Fixed &rhs)
Fixedoperator++ ()
Fixed operator++ (int)
Fixedoperator-- ()
Fixed operator-- (int)
Fixed operator+ () const
Fixed operator- () const
bool operator! () const
UShort fixed_digits () const
UShort fixed_scale () const
bool sign () const
Octet digit (int n) const
void digit (int n, int value)
bool less (const Fixed &rhs) const
bool equal (const Fixed &rhs) const
Iterator begin ()
ConstIterator begin () const
ConstIterator cbegin () const
Iterator end ()
ConstIterator end () const
ConstIterator cend () const

Static Public Member Functions

static Fixed from_integer (LongLong val=0)
static Fixed from_integer (ULongLong val)
static Fixed from_floating (LongDouble val)
static Fixed from_string (const char *str)
static Fixed from_octets (const Octet *array, int len, unsigned int scale=0)

Private Member Functions

void normalize (UShort min_scale=0)
 remove trailing zeros, shift down and reduce digits and scale
int lshift (int digits)
ConstIterator pre_add (const Fixed &f)
Fixed div_helper2 (const Fixed &rhs, Fixed &r) const
Fixed div_helper1 (const Fixed &rhs, Fixed &r) const
Fixed join (int digits, const Fixed &bottom) const
void ltrim ()

Private Attributes

Octet value_ [16]
Octet digits_
Octet scale_

Detailed Description

Fixed-point data type: up to 31 decimal digits and a sign bit

See OMG 2011-11-01 CORBA Interfaces v3.2 sections 7.10, 7.11.3.4 See OMG 2011-11-02 CORBA Interoperability v3.2 section 9.3.2.8 See OMG 2012-07-02 IDL-to-C++ Mapping v1.3 section 5.13 This class doesn't exactly match the IDL-to-C++ mapping because it is meant for use inside a union in the IDL compiler and therefore has no constructors. Standards-based middlware libraries such as ORBs and DDSs can wrap this class in a class of their own to provide the exact interface described by the mapping specification.

Member Enumeration Documentation

anonymous enum
Enumerator:
MAX_DIGITS 
MAX_STRING_SIZE 
POSITIVE 
NEGATIVE 

Member Function Documentation

ACE_CDR::Fixed::Iterator ACE_CDR::Fixed::begin ( )
inline
ACE_CDR::Fixed::ConstIterator ACE_CDR::Fixed::begin ( ) const
inline
ACE_CDR::Fixed::ConstIterator ACE_CDR::Fixed::cbegin ( ) const
inline
ACE_CDR::Fixed::ConstIterator ACE_CDR::Fixed::cend ( ) const
inline
ACE_CDR::Octet ACE_CDR::Fixed::digit ( int  n) const
inline
void ACE_CDR::Fixed::digit ( int  n,
int  value 
)
inline
ACE_CDR::Fixed ACE_CDR::Fixed::div_helper1 ( const Fixed rhs,
Fixed r 
) const
private
ACE_CDR::Fixed ACE_CDR::Fixed::div_helper2 ( const Fixed rhs,
Fixed r 
) const
private
ACE_CDR::Fixed::Iterator ACE_CDR::Fixed::end ( void  )
inline
ACE_CDR::Fixed::ConstIterator ACE_CDR::Fixed::end ( void  ) const
inline
bool ACE_CDR::Fixed::equal ( const Fixed rhs) const
ACE_CDR::UShort ACE_CDR::Fixed::fixed_digits ( ) const
inline
ACE_CDR::UShort ACE_CDR::Fixed::fixed_scale ( ) const
inline
ACE_CDR::Fixed ACE_CDR::Fixed::from_floating ( LongDouble  val)
static
ACE_CDR::Fixed ACE_CDR::Fixed::from_integer ( ACE_CDR::LongLong  val = 0)
static
ACE_CDR::Fixed ACE_CDR::Fixed::from_integer ( ACE_CDR::ULongLong  val)
static
ACE_CDR::Fixed ACE_CDR::Fixed::from_octets ( const Octet array,
int  len,
unsigned int  scale = 0 
)
static
ACE_CDR::Fixed ACE_CDR::Fixed::from_string ( const char *  str)
static
ACE_CDR::Fixed ACE_CDR::Fixed::join ( int  digits,
const Fixed bottom 
) const
private
bool ACE_CDR::Fixed::less ( const Fixed rhs) const
int ACE_CDR::Fixed::lshift ( int  digits)
private

Add up to 'digits' of additional scale by shifting left without removing significant digits. Returns number of digits shifted.

void ACE_CDR::Fixed::ltrim ( )
inlineprivate
void ACE_CDR::Fixed::normalize ( UShort  min_scale = 0)
private

remove trailing zeros, shift down and reduce digits and scale

ACE_CDR::Fixed::operator LongDouble ( ) const
ACE_CDR::Fixed::operator LongLong ( ) const
bool ACE_CDR::Fixed::operator! ( ) const
ACE_CDR::Fixed & ACE_CDR::Fixed::operator*= ( const Fixed rhs)
ACE_CDR::Fixed ACE_CDR::Fixed::operator+ ( ) const
inline
ACE_CDR::Fixed & ACE_CDR::Fixed::operator++ ( )
ACE_CDR::Fixed ACE_CDR::Fixed::operator++ ( int  )
inline
ACE_CDR::Fixed & ACE_CDR::Fixed::operator+= ( const Fixed rhs)
ACE_CDR::Fixed ACE_CDR::Fixed::operator- ( ) const
inline
ACE_CDR::Fixed & ACE_CDR::Fixed::operator-- ( )
ACE_CDR::Fixed ACE_CDR::Fixed::operator-- ( int  )
inline
ACE_CDR::Fixed & ACE_CDR::Fixed::operator-= ( const Fixed rhs)
ACE_CDR::Fixed & ACE_CDR::Fixed::operator/= ( const Fixed rhs)
ACE_CDR::Fixed::ConstIterator ACE_CDR::Fixed::pre_add ( const Fixed f)
private

Prepare to add (or subtract) f by changing the digits and scale of *this, returnins an iterator to the least significant digit of f that will influence the sum (or difference).

ACE_CDR::Fixed ACE_CDR::Fixed::round ( UShort  scale) const
bool ACE_CDR::Fixed::sign ( ) const
inline
const ACE_CDR::Octet * ACE_CDR::Fixed::to_octets ( int &  n) const
bool ACE_CDR::Fixed::to_string ( char *  buffer,
size_t  buffer_size 
) const
ACE_CDR::Fixed ACE_CDR::Fixed::truncate ( UShort  scale) const

Member Data Documentation

Octet ACE_CDR::Fixed::digits_
private

digits_ is not marshaled, the receiver needs to know it from the type information (for example, IDL). The value of digits_ determines how many octets of value_ are masharled.

Octet ACE_CDR::Fixed::scale_
private

scale_ is not marshaled, the receiver needs to know it from the type information (for example, IDL).

Octet ACE_CDR::Fixed::value_[16]
private

CDR wire format for Fixed: marshaled as an octet array with index 0 as the most significant octet and index n the least significant. Each octet contains two decimal digits except for the last octet (least sig) which has one decimal digit in the high nibble and the sign indicator in the low nibble.


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