Commit 7111b68d authored by flechsig's avatar flechsig
Browse files

new medm, still problem in case we start ith empty arrays - constructor of XGI_out

parent 65b5630b
// Time-stamp: <13 Feb 19 14:37:01 flechsig>
// Time-stamp: <18 Feb 19 14:25:29 flechsig>
/*
* NDPluginXGI.cpp
*
......@@ -10,6 +10,7 @@
* Extensions UF Feb 11, 2019
*/
#include <iostream>
#include <stdlib.h>
#include <string.h>
#include <string>
......@@ -57,9 +58,9 @@ static const char *driverName="NDPluginXGI";
class NDPluginXGI : public NDPluginDriver {
public:
NDPluginXGI(const char *portName, int queueSize, int blockingCallbacks,
const char *NDArrayPort, int NDArrayAddr,
int maxBuffers, size_t maxMemory,
int priority, int stackSize);
const char *NDArrayPort, int NDArrayAddr,
int maxBuffers, size_t maxMemory,
int priority, int stackSize);
~NDPluginXGI();
......@@ -294,14 +295,20 @@ void NDPluginXGI::processCallbacks(NDArray *pArray)
}
if (this->pArrays[i]) this->pArrays[i]->release();
this->pArrays[i] = matrixToNDArray(m);
/* Copy time stamp and uniqueId from input array */
this->pArrays[i]->uniqueId = pArray->uniqueId;
this->pArrays[i]->timeStamp = pArray->timeStamp;
/* Update attribute list */
this->getAttributes(this->pArrays[i]->pAttributeList);
/* Call the NDArray callback */
doCallbacksGenericPointer(this->pArrays[i], NDArrayData, i);
// UF problem if we start with unallocated arrays
if ( ! m ) // UF avoid a core dump
std::cout << "error: Matrix == NULL- skip matrixToNDArray " << std::endl;
else
{
this->pArrays[i] = matrixToNDArray(m);
/* Copy time stamp and uniqueId from input array */
this->pArrays[i]->uniqueId = pArray->uniqueId;
this->pArrays[i]->timeStamp = pArray->timeStamp;
/* Update attribute list */
this->getAttributes(this->pArrays[i]->pAttributeList);
/* Call the NDArray callback */
doCallbacksGenericPointer(this->pArrays[i], NDArrayData, i);
}
}
}
/* Leave output matrix, they are reused for the next processing */
......@@ -373,6 +380,14 @@ asynStatus NDPluginXGI::writeOctet(asynUser *pasynUser, const char *value,
NDArray *NDPluginXGI::matrixToNDArray(const Matrix *matrix)
{
int ndims = 2;
// UF it fails in case the matrix is not filled
if (! matrix)
{
std::cout << "error: matrixToNDArray: matrix== NULL" << std::endl;
return NULL;
}
size_t dims[2] = {matrix->width, matrix->height};
NDDataType_t dataType = NDFloat64;
size_t dataSize = matrix->width * matrix->height * sizeof(double);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment