Class: TFPEnvironmentSaveAndUpdate

Declaration: FPEnvironment.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

TFPEnvironmentModifier

Inherited By:

None.

Purpose:

Objects serve as surrogates for the real floating-point environment (typically hardware control and status registers). Modifying one can affect subsequent floating-point operations. The constructors of this class save the current active environment. The destructor temporarily saves the (now) current exceptions and installs the saved environment. After the destructor has reinstalled the old environment, it sets the temporarily-saved exceptions. That is, it restores and updates the saved environment to record exceptions that occurred while its own environment was in scope.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Do not derive from this class.

Concurrency:

Multithread safe.

Resource Use:

Objects are used as a surrogate for FPU status and control registers. They normally have FPU registers as their state.

Member Function: TFPEnvironmentSaveAndUpdate::TFPEnvironmentSaveAndUpdate

  1. TFPEnvironmentSaveAndUpdate ()
  2. TFPEnvironmentSaveAndUpdate (const TFPInactiveEnvironment &)
  3. TFPEnvironmentSaveAndUpdate (EFPRoundingDirection direction)

Interface Category:

API.

Purpose:

  1. Default constructor. The empty constructor initializes the environment to the existing current environment (that is, it changes nothing). The current environment is saved for later restoration by the destructor.
  2. The copy constructor allows for activating (installing) an inactive environment. The current environment is saved for later restoration by the destructor.
  3. This constructor facilitates changes only to rounding. The current environment is saved for later restoration by the destructor.

Calling Context:

  1. Called by the stream-in operators.
  2. Called for local installation of an inactive environment.
  3. Called when only rounding needs to be changed locally.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

All constructors save the current active environment. The destructor temporarily saves the (now) current exceptions and installs the saved environment. After the destructor has reinstalled the old environment, it sets the temporarily-saved exceptions. That is, it restores and updates the saved environment to record exceptions that occurred while its own environment was in scope.

Member Function: TFPEnvironmentSaveAndUpdate::~TFPEnvironmentSaveAndUpdate

virtual ~ TFPEnvironmentSaveAndUpdate ()

Interface Category:

API.

Purpose:

Destructor. The destructor temporarily saves the (now) current exceptions and installs the saved environment. After the destructor has reinstalled the old environment, it sets the temporarily-saved exceptions. That is, it restores and updates the saved environment to record exceptions that occurred while its own environment was in scope.

Calling Context:

Called to destroy an object and restore and update a floating-point environment.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.

Member Function: TFPEnvironmentSaveAndUpdate::GetSavedEnvironment

TFPInactiveEnvironment GetSavedEnvironment () const

Interface Category:

API.

Purpose:

Examines the floating-point environment saved by the constructor.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns the floating-point environment saved by the constructor.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Multithread safe.

Other Considerations:

None.
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.