#include <Copy.h>
Part of API
Objset is used to fill a C-style array of objects.
Objcopy and objmove are used to copy objects from one place to another. Optionally a stride can be supplied.
The functions are equivalent to C's memcpy and memmove. When possible C++ standard library functions are used to implement them
Similar to memcpy and memmove, the difference between objcopy and objmove is that objmove takes account of an overlap of source and destination. In general, objcopy is slighty (but only slighty) faster.
Setting and copying arrays of built-in types:
// Create uInt array of 4 elements uInt size=4; int* ia = new int[size]; // Initialize all elements to value 99 objset(ia, 99, size); // Change all odd elements to 66 -> [99 66 99 66] objset(ia+1,66, uInt(5), uInt(2)); // Create another 4-element uInt array int* ia2 = new int[size]; // Copy array ia into array ia2 -> [99 66 99 66] objmove(ia2, ia, size); // Copy the even elements of ia to the odd elements of ia2 // -> [99 99 99 99] objcopy(ia2+1, ia, uInt(size/2), uInt(2), uInt(2));
Setting and copying arrays of a randomly chosen type:
// Create 4-element array of 3-element Block<int> objects uInt size=4; Block<int>* ta = new Block<int>[size]; Block<int> set(3); // Initialize the array -> [[123][123][123][123]] set[0] = 1; set[1] = 2; set[2] = 3; objset(ta, set, size); // Change odd Blocks to [777]-> [[123][777][123][777]] set[0] = set[1] = set[2] = 7; objset(ta + 1, set, uInt(size/2), uInt(2)); // Create another Block<int> array Block<int>* ta2 = new Block<int>[size]; // Copy the even elements of ta to the first elements of ta2 // -> [[123][123].\..] objcopy(ta2, ta, uInt(size/2), uInt(1), uInt(2));
Definition at line 103 of file Copy.h.
Public Member Functions | |
| void | objthrowmv1 (const void *to, const void *from, const uInt n) |
| Throw the various AipsErrors when incorrect arguments used. | |
| void | objthrowmv2 (const void *to, const void *from, const uInt n, const uInt toStride, const uInt fromStride) |
| void | objthrowcp1 (const void *to, const void *from, const uInt n) |
| void | objthrowcp2 (const void *to, const void *from, const uInt n, const uInt toStride, const uInt fromStride) |
| void | objthrowfl1 (const void *to, const uInt n) |
| void | objthrowfl2 (const void *to, const uInt n, const uInt toStride) |
| void casa::Copy_global_functions_throw::objthrowmv1 | ( | const void * | to, | |
| const void * | from, | |||
| const uInt | n | |||
| ) |
Throw the various AipsErrors when incorrect arguments used.
| void casa::Copy_global_functions_throw::objthrowmv2 | ( | const void * | to, | |
| const void * | from, | |||
| const uInt | n, | |||
| const uInt | toStride, | |||
| const uInt | fromStride | |||
| ) |
| void casa::Copy_global_functions_throw::objthrowcp1 | ( | const void * | to, | |
| const void * | from, | |||
| const uInt | n | |||
| ) |
| void casa::Copy_global_functions_throw::objthrowcp2 | ( | const void * | to, | |
| const void * | from, | |||
| const uInt | n, | |||
| const uInt | toStride, | |||
| const uInt | fromStride | |||
| ) |
| void casa::Copy_global_functions_throw::objthrowfl1 | ( | const void * | to, | |
| const uInt | n | |||
| ) |
| void casa::Copy_global_functions_throw::objthrowfl2 | ( | const void * | to, | |
| const uInt | n, | |||
| const uInt | toStride | |||
| ) |
1.5.1