4 * Created on: Feb 24, 2009
8 #include "proc_wrapper.h"
10 proc_wrapper::proc_wrapper() {
16 proc_wrapper::~proc_wrapper() {
22 void proc_wrapper::init() {
23 _process.init(&_process);
29 int proc_wrapper::fire() {
30 return _process.fire(&_process);
36 void proc_wrapper::detach() {
41 * Gets an index of a string, where the index must be separated by
42 * a character specified in tokens.
43 * Returns -1, when an error occurs.
46 * getIndex("name_1_2", "_", 0) will return 1.
47 * getIndex("name_1_2", "_", 1) will return 2.
49 * @param string string to parse
50 * @param tokens delimiter of indices
51 * @param indexNumber position of index (starting at 0)
53 int proc_wrapper::getIndex(const char* string, char* tokens,
59 string_copy = (char*) malloc(sizeof(char) * (strlen(string) + 1));
61 fprintf(stderr, "getIndex(): could not allocate memory.\n");
65 strcpy(string_copy, string);
67 token_pointer = strtok(string_copy, tokens);
69 token_pointer = strtok(NULL, tokens);
71 } while (index <= indexNumber && token_pointer != 0);
74 index = atoi(token_pointer);
84 * Get the index of this process.
85 * @param indexNumber position of index (starting at 0)
87 int proc_wrapper::getIndex(unsigned indexNumber) const {
88 if (indexNumber < 4) {
89 return _iteratorIndex[indexNumber];