Pusher.cc
691 Bytes
#include "Pusher.hh"
namespace AMDA {
namespace ConstantInterface {
int getNbDataByPacket(ConstantParamType paramType, int dim1, int dim2) {
int oneDataBytes = dim1*dim2;
switch (paramType) {
case TYPE_FLOAT:
oneDataBytes *= sizeof(float);
break;
case TYPE_DOUBLE:
oneDataBytes *= sizeof(double);
break;
case TYPE_SHORT:
oneDataBytes *= sizeof(short);
break;
case TYPE_INT:
oneDataBytes *= sizeof(int);
break;
}
int nbDataByPacket = PARAMPACKET_MAX_DATABYTES / oneDataBytes;
if (nbDataByPacket < PARAMPACKET_MIN_NBDATABYPACKET) {
nbDataByPacket = PARAMPACKET_MIN_NBDATABYPACKET;
}
return nbDataByPacket;
}
} /* ConstantInterface */
} /* AMDA */