// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
#include <cstring>

using namespace std;

#include "testimpl.h"

Long TestImpl::add(Long a, Long b)
{
    return a + b;
}

char *TestImpl::dup(const char *s)
{
    char *res = new char[2 * strlen(s) + 1];
    strcpy(res, s);
    strcat(res, s);
    return res;
}

Data *TestImpl::process(const Data& d)
{
    Data *res = new Data();
    res->iv = d.iv + 1;
    char *temp = new char[strlen(d.sv) + 2];
    strcpy(temp, d.sv);
    strcat(temp, "X");
    res->sv = temp;
    return res;
}

Long TestImpl::getCounter()
{
    counter++;
    return counter;
}

void TestImpl::noop()
{
    // nothing
}
