User manual
Programmer’s Guide    Page 39 of 66 
long nbrSegments  = 10; 
long nbrPoints = 1000; 
char *dataArrayP; 
long currentSegmentPad; 
long nbrSamplesNom, nbrSegmentsNom; 
AqReadParameters    *readPar  = new AqReadParameters; 
AqDataDescriptor    *dataDesc  = new AqDataDescriptor; 
AqSegmentDescriptor  *segDesc  = new AqSegmentDescriptor[nbrSegments]; 
readPar->dataType = 0; // 0 = byte 
readPar->readMode = 1;  // 1 = sequence waveform  
readPar->nbrSegments = nbrSegments; 
readPar->firstSampleInSeg = 0; 
readPar->segmentOffset = nbrPoints;     
readPar->firstSegment = 0; 
readPar->nbrSamplesInSeg = nbrPoints; 
readPar->flags = 0; 
readPar->reserved = 0; 
readPar->reserved2 = 0.0; 
readPar->reserved3 = 0.0; 
status = Acqrs_getInstrumentInfo (instrID, ”TbSegmentPad”, 
¤tSegmentPad); 
// in this case the next call doesn‟t have any surprises 
status = AcqrsD1_getMemory(instrID, 
          &nbrSamplesNom, &nbrSegmentsNom); 
readPar->dataArraySize = 
(nbrSamplesNom+currentSegmentPad)*(1+nbrSegments); 
// here we show the malloc explicitly  
dataArrayP = (char *)malloc(readPar->dataArraySize); 
readPar->segDescArraySize = sizeof(AqSegmentDescriptor)*nbrSegments; 
status = AcqrsD1_readData(instrID, channel, readPar, dataArrayP, 
dataDesc, segDesc); 
Comments: 
  The explicit malloc call will normally not be repeated for every acquisition. Obviously, a larger than needed 
allocation is perfectly acceptable. Also, any space allocated this  way ought to be returned to the heap at 
some point. 
  It is possible to allocate dataArray space that is not aligned on a 32-bit boundary. This is not acceptable for 
some of our modules and the AcqrsD1_readData routine will return an error in such a case. 
3.11.3. Reading Raw Sequences of Waveforms  
In the example  given above  the  driver  software in  the  PC  does  the  work  of  reordering  the  raw  data  sent  by  the 
digitizer so that it can be conveniently used from the dataArrayP vector. Readout time can be slightly reduced even 
further by  postponing  the reorder until  later at a  less time critical  moment. This functionality is offered with  the 
readMode = 11, raw sequence waveform read. The segment descriptor is modified to include the information needed 
by the user to the post-acquisition reordering; this requires more space. The dataArray storage space requirements are 
the same as for readMode = 11. A typical piece of code to do the reorder could look as follows: 










