Class: TMemorySurrogate

Declaration: Memory.h

Taxonomy Categories:

Member Functions:


Interface Category:

API.

Inherits From:

MCollectible

Inherited By:

TMemoryRange

Purpose:

TMemorySurrogate is a concrete class that is used to describe a range of memory.

Instantiation:

Allocate on the heap or the stack.

Deriving Classes:

This class cannot be derived.

Concurrency:

Not multithread safe.

Resource Use:

No special requirements. Note: This class does not allocate memory. It is used to describe extant memory ranges.

Member Function: TMemorySurrogate::TMemorySurrogate

  1. TMemorySurrogate ()
  2. TMemorySurrogate (void * start)
  3. TMemorySurrogate (void * start, size_t length)
  4. TMemorySurrogate (const TMemorySurrogate & aRange)

Interface Category:

API.

Purpose:

  1. Default constructor. Creates a memory surrogate that describes a zero-length range of memory starting at address zero.
  2. Creates a memory surrogate that describes a zero-length range of memory starting at the address passed as an argument to the constructor (start).
  3. Creates a memory surrogate that describes a range of memory of length length starting at the address start.
  4. Copy constructor.

Calling Context:

  1. Called to create an object whose internal state will be set by some other member function, such as a stream-in operator.
  2. Called to construct a memory surrogate that denotes a specific memory address.
  3. Called to construct a memory surrogate that denotes a specific memory range.
  4. Called to copy an object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMemorySurrogate::~TMemorySurrogate

~ TMemorySurrogate ()

Interface Category:

API.

Purpose:

Destructor. Destroys an object, but does not release the memory range described by the object.

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: TMemorySurrogate::operator=

TMemorySurrogate & operator =(const TMemorySurrogate & theMemory)

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.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMemorySurrogate::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 TInvalidVersionError if the object read in from the stream has an invalid version number.

Concurrency:

Not multithread safe.

Other Considerations:

None

Member Function: TMemorySurrogate::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: TMemorySurrogate::GetLength

inline size_t GetLength () const

Interface Category:

API.

Purpose:

Returns the length of the memory range described by the object.

Calling Context:

Called to determine the amount of memory described by the object.

Parameters:

Return Value:

The length of the memory range described by the object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMemorySurrogate::SetLength

inline void SetLength (size_t length)

Interface Category:

API.

Purpose:

Sets the length of the memory range described by the object.

Calling Context:

Called to change the memory range described by the object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMemorySurrogate::GetStartAddress

inline void * GetStartAddress () const

Interface Category:

API.

Purpose:

Returns the starting address of the memory range described by the object.

Calling Context:

Called to determine the memory range described by the object.

Parameters:

Return Value:

The starting address of the memory range described by the object.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMemorySurrogate::SetStartAddress

inline void SetStartAddress (void * newStart)

Interface Category:

API.

Purpose:

Sets the starting address of the memory range described by the object.

Calling Context:

Called to change the memory range described by the object.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

None.

Member Function: TMemorySurrogate::FillWith

  1. void FillWith (unsigned long thePattern)
  2. void FillWith (unsigned short thePattern)
  3. void FillWith (unsigned char thePattern)
  4. void FillWith (const TMemorySurrogate & thePattern)

Interface Category:

API.

Purpose:

  1. Fills the memory range described by the object by repeatedly copying the parameter value.
  2. Fills the memory range described by the object by repeatedly copying the parameter value.
  3. Fills the memory range described by the object by repeatedly copying the parameter value.
  4. Fills the memory range described by the object by repeatedly copying the contents of the memory described by the memory surrogate passed into the member function. This member function copies overlapping ranges correctly.

Calling Context:

  1. Called to fill a range of memory with a repeating byte pattern.
  2. Called to fill a range of memory with a repeating byte pattern.
  3. Called to fill a range of memory with a repeating byte pattern.
  4. Called to fill a range of memory with a repeating byte pattern.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The FillWith routine is optimized for each platform; it is implemented to work as efficiently as possible on each platform.

Member Function: TMemorySurrogate::FillWithZeros

void FillWithZeros ()

Interface Category:

API.

Purpose:

Fills the memory region described by the TMemorySurrogate object with zeros.

Calling Context:

Called to initialize or erase the contents of a memory region.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The FillWithZeros routine is optimized for each platform; it is implemented to work as efficiently as possible on each platform.

Member Function: TMemorySurrogate::CopyFrom

void CopyFrom (const TMemorySurrogate & theSource)

Interface Category:

API.

Purpose:

Copies the contents of theSource memory to the memory region described by *this. The amount of memory copied is the minimum of the sizes of the two memory ranges. The routine copies overlapping ranges correctly.

Calling Context:

Called to copy the contents of one memory range to another.

Parameters:

Return Value:

None.

Exceptions:

Throws no exceptions, passes all exceptions through.

Concurrency:

Not multithread safe.

Other Considerations:

The CopyFrom routine is optimized for each platform; it is implemented to work as efficiently as possible on each platform.

Member Function: TMemorySurrogate::Hash

long Hash () const

Interface Category:

API.

Purpose:

Returns a hash value.

Calling Context:

Called whenever a hash value is required for the object.

Parameters:

Return Value:

Returns a HashResult.

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.