Blame view

src/ParamGetImpl/ConstantInterface/Pusher.cc 691 Bytes
93809512   Benjamin Renard   Implements ParamG...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#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 */