Class: TULongPair

Declaration: PrintPrimitives.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

None.

Inherited By:

None.

Purpose:

This is a point class represented by unsigned long primitives. It has many of the same characteristics of TGPoint except that its fields are unsigned longs. It is mainly used for representing cardinals or physical entities, such as pages or grid locations, and where negative numbers do not have any meaning. TULongPairs have simple math operators to combine, mix, or otherwise manipulate their value. They can be mixed with TGPoints or scalars. TULongPairs can be converted readily to and from TGPoints. When converting from TGPoints to TULongPairs, only the integer part of TGPoint fields is significant.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

Clients should not derive from this class.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements.

Member Function: TULongPair::TULongPair

  1. TULongPair ()
  2. TULongPair (unsigned long x, unsigned long y)
  3. TULongPair (const TULongPair &)
  4. TULongPair (const TGPoint &)

Interface Category:

API.

Purpose:

  1. Default constructor. Constructs a TULongPair whose fields are valid but unknown.
  2. Construct point from individual components, x first, y second.
  3. Copy constructor.
  4. Takes the integer part of a TGPoint to form a TULongPair. It ignores any fractional part.

Calling Context:

  1. Called by the stream-in operators and clients who want defaulted values.
  2. Set point.
  3. Called to copy an object.
  4. Called to convert a TGPoint to a TULongPair.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::~TULongPair

~ TULongPair ()

Interface Category:

API.

Purpose:

Destructor.

Calling Context:

Called to destroy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::Area

unsigned long Area () const

Interface Category:

API.

Purpose:

Calculates the total area encompassed by the point and the origin.

Calling Context:

Call this function directly.

Parameters:

Return Value:

Returns a count of the area enclosed by the point and the origin.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

If the x y field components of TULongPair are large, the resultant area can overflow, being too large to fit in an unsigned long. Clients should be aware that this can happen.

Member Function: TULongPair::operator-

  1. TULongPair operator -() const
  2. TULongPair operator -(const TULongPair & Src) const

Interface Category:

API.

Purpose:

  1. Subtracts two times the field value from each field. Causes numerical underflow.
  2. Performs a component-wise subtraction of the TULongPair point from this point.

Calling Context:

  1. Called in unary minus expressions.
  2. Called in difference expressions.

Parameters:

Return Value:

The TULongPair result of the unary operation or the subtraction.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator+

TULongPair operator + (const TULongPair & Src) const

Interface Category:

API.

Purpose:

Addition operator.

Calling Context:

Called in addition expressions.

Parameters:

Return Value:

The TULongPair result of the addition.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator*

TULongPair operator * (const TULongPair & Src) const

Interface Category:

API.

Purpose:

Does a component-wise multiplication of each field with each field of the source.

Calling Context:

Called in expressions containing multiplication with other TULongPairs.

Parameters:

Return Value:

The TULongPair result of the multiplication.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator/

TULongPair operator / (const TULongPair & Src) const

Interface Category:

API.

Purpose:

Does component-wise division of points.

Calling Context:

Called in division expressions.

Parameters:

Return Value:

The TULongPair result of the division.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator+=

TULongPair & operator += (const TULongPair & Src)

Interface Category:

API.

Purpose:

Component-wise addition to itself.

Calling Context:

Called in += expressions.

Parameters:

Return Value:

Returns itself as the result of the addition to itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator-=

TULongPair & operator -=(const TULongPair & Src)

Interface Category:

API.

Purpose:

Component-wise subtraction of itself.

Calling Context:

Called in -=expressions.

Parameters:

Return Value:

Returns itself as a result of the subtraction from itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator*=

TULongPair & operator *= (const TULongPair & Src)

Interface Category:

API.

Purpose:

Component-wise multiplication of itself.

Calling Context:

Called in *= expressions.

Parameters:

Return Value:

Returns itself as a result of the multiplication to itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator/=

TULongPair & operator /= (const TULongPair & Src)

Interface Category:

API.

Purpose:

Component-wise division of itself by input point.

Calling Context:

Called in /= expressions.

Parameters:

Return Value:

Returns itself as the result of the division into itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

Arithmetic operations can cause underflow or overflow. There is no check.

Member Function: TULongPair::operator==

bool operator ==(const TULongPair & Src) const

Interface Category:

API.

Purpose:

Compares itself with input.

Calling Context:

Called to compare TULongPairs.

Parameters:

Return Value:

Returns true if the source is equal to this.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::operator!=

bool operator != (const TULongPair & Src) const

Interface Category:

API.

Purpose:

Compares itself with input, but returns the logical complement.

Calling Context:

Called to compare TULongPairs.

Parameters:

Return Value:

Returns true if the source is not equal to this.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::operator=

TULongPair & operator =(const TULongPair &)

Interface Category:

API.

Purpose:

Assignment operator.

Calling Context:

Called when an object is assigned to another compatible object.

Parameters:

Return Value:

A non-const reference to the left-hand side object. Returns itself as a result of the assignment.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::operatorTGPoint

operator TGPoint () const

Interface Category:

API.

Purpose:

Converts (or casts) a TGPoint to a TULongPair.

Calling Context:

Called by conversion or TGPoint casting operator.

Parameters:

Return Value:

Returns a TGPoint whose fields are the same values as itself.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::operator<<=

TStream & operator <<= (TStream & fromWhere)

Interface Category:

API.

Purpose:

Stream-in operator.

Calling Context:

Called to stream in data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself in from.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::operator>>=

TStream & operator >>=(TStream & toWhere) const

Interface Category:

API.

Purpose:

Stream-out operator.

Calling Context:

Called to stream out data.

Parameters:

Return Value:

Returns a reference to the stream the object streams itself out to.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TULongPair::Set

void Set (unsigned long x, unsigned long y)

Interface Category:

API.

Purpose:

Sets the point to be the x, y values of the input.

Calling Context:

Called to set fields to explicit values.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not 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.