PBBoundedArrayCreator template class:
SetAt method
Description
Sets a value or string to the array item at the specified
dimension.
Syntax
For arrays of a specified ValueType:
SetAt(pblong dim[], ValueType v)
For string arrays:
SetAt(pblong dim[], LPCTSTR string)
SetAt(pblong dim[], pbstring string)
Argument
|
Description
|
dim
|
The dimension of the array item to be
set
|
v
|
A ValueType defined in pbtraits.h
|
string
|
A string of type pbstring or LPCTSTR
|
Return Values
None.
Examples
This example shows the use of SetAt in
arrays of a type specified by a ValueType:
// arguments:
// ac: class object of PBBoundedArrayCreator or
// PBBoundedObjectArrayCreator to set items into
// dimensions: array dimension, can be 1,2,3,...,n
// bounds: upper and lower bound for each dimension
// iarg: T type array to store the data value set
// into array creator ac
// current_dim: remember which dimension is looped into
template < typename T, pbvalue_type I,class C>
void BoundedArrayItem<T,I,C>::f_set_arrayitem
(IPB_Session* session, C& ac, pblong dimensions,
arrayBounds* bounds, T* iarg, int current_dim)
{
int i;
if (current_dim > dimensions)
return;
for(i= bounds[current_dim-1].lowerBound;
i<= bounds[current_dim-1].upperBound; i++)
{
if (current_dim == dimensions)
{
dim[current_dim-1]= i;
ac.SetAt(dim,iarg[array_itemcount]);
array_itemcount++;
}
else
{
dim[current_dim-1]= i;
BoundedArrayItem<T,I,C>::f_set_arrayitem
(session, ac, dimensions, bounds, iarg,
current_dim+1);
}
}
}
See Also