#include Communicator::Communicator(__SIZE_TYPE__ bufferSize) { this->messageBuffer = new char[bufferSize]; this->bufferSize = bufferSize; } char *Communicator::getBuffer() { return messageBuffer; } int Communicator::getBufferSize() { return this->bufferSize; } int Communicator::calculateMessageOutSize(int numberOfValues) { return numberOfValues + (numberOfValues - 1) + 1; } void Communicator::parseIDs(int *values, int numberOfValues, char *output) { __SIZE_TYPE__ outputSize = calculateMessageOutSize(numberOfValues); __SIZE_TYPE__ outputCharPointer = 0; output[outputSize - 1] = '\0'; for (__SIZE_TYPE__ i = 0; i < numberOfValues; i++) { output[outputCharPointer++] = values[i] + '0'; if (outputCharPointer < outputSize - 1) output[outputCharPointer++] = ','; } }