RetypedArraySetGet.h

Classes

Global Functions -- Helper functions for users of RetypedArrayEngine (full description)

Helper functions for users of RetypedArrayEngine (source)

Interface

void retypedArrayEngineSet (Array<SourceType>& out, const Array<TargetType>& in)
void retypedArrayEngineGet (Array<TargetType>& out, const Array<SourceType>& in)
void retypedArrayEngineSet (Array<SourceType>& out, const Array<TargetType>& in, const TargetType& shape, const void* extraArgument)
void retypedArrayEngineGet (Array<TargetType>& out, const Array<SourceType>& in, const SourceType& shape, const void* extraArgument)

Description

Review Status

Reviewed By:
UNKNOWN
Date Reviewed:
before2004/08/25
Programs:
Demos:
Tests:

Prerequisite

Synopsis

The functions in here can be used in the implementation of the CopyInfo class inside a SourceType class used by a RetypedArrayEngine.

Example

The example in RetypedArrayEngine shows how these functions can be used.

Motivation

These functions make the implementation of the set and get functions in the SourceType objects of the RetypedArrayEngine easier. They are not part of the RetypedArrayEngine.h file to avoid the inclusion of that (heavy) file in a SourceType.

Member Description

void retypedArrayEngineSet (Array<SourceType>& out, const Array<TargetType>& in)

Copy the entire target array to the source array. It will check if the shapes and sizes match.
This very efficient copy function can only be called by the static set function in the SourceType when the TargetType array can directly be copied to the SourceType array.
See RetypedArrayEngine for more information.

void retypedArrayEngineGet (Array<TargetType>& out, const Array<SourceType>& in)

Copy the entire source array to the target array. It will check if the shapes and sizes match.
This very efficient copy function can only be called by the static set function in the SourceType when the TargetType array can directly be copied to the SourceType array.
See RetypedArrayEngine for more information.

void retypedArrayEngineSet (Array<SourceType>& out, const Array<TargetType>& in, const TargetType& shape, const void* extraArgument)

Fill an array with SourceType objects from the target array. This is called when the target is incomplete. The shape and extra argument can help to set the correct elements in the source.
It loops through all elements in the SourceType array and calls the SourceType function It calls the SourceType function

    void setElem (const TargetType* data, const IPosition& shape,
                  const void* extraArgument);
for each element.
Tip This retypedArrayEngineSet function is only a convenience function. For optimal performance it may be needed to handcode the loop instead of using this function.

See RetypedArrayEngine for more information.

void retypedArrayEngineGet (Array<TargetType>& out, const Array<SourceType>& in, const SourceType& shape, const void* extraArgument)

Fill an array with TargetType objects from the source array. This is called when the target is incomplete. The shape and extra argument can help to get the correct elements from the source.
It loops through all elements in the SourceType array and calls the SourceType function

    void getElem (TargetType* data, const IPosition& shape,
                  const void* extraArgument);
for each element.
Tip This retypedArrayEngineGet function is only a convenience function. For optimal performance it may be needed to handcode the loop instead of using this function.

See RetypedArrayEngine for more information.