diff options
author | Matthias P. Braendli (think) <matthias@mpb.li> | 2013-11-08 14:43:19 +0100 |
---|---|---|
committer | Matthias P. Braendli (think) <matthias@mpb.li> | 2013-11-08 14:43:19 +0100 |
commit | c5306f81a9d3b87df7e16c852f2505ac913193ca (patch) | |
tree | 40716835305aa871cae5a5b3c805f0c673f47108 /src/ParserConfigfile.cpp | |
parent | 573c7b63092618ecae86847d9d0a143801db0780 (diff) | |
download | dabmux-c5306f81a9d3b87df7e16c852f2505ac913193ca.tar.gz dabmux-c5306f81a9d3b87df7e16c852f2505ac913193ca.tar.bz2 dabmux-c5306f81a9d3b87df7e16c852f2505ac913193ca.zip |
make dabOutput more object-oriented
Diffstat (limited to 'src/ParserConfigfile.cpp')
-rw-r--r-- | src/ParserConfigfile.cpp | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/src/ParserConfigfile.cpp b/src/ParserConfigfile.cpp index 3746a1e..860b9b1 100644 --- a/src/ParserConfigfile.cpp +++ b/src/ParserConfigfile.cpp @@ -40,7 +40,7 @@ #include <string> #include <map> #include <cstring> -#include "dabOutput.h" +#include "dabOutput/dabOutput.h" #include "dabInput.h" #include "utils.h" #include "dabInputFile.h" @@ -374,32 +374,23 @@ void parse_configfile(string configuration_file, string outputuid = it->first; string uri = pt_outputs.get<string>(outputuid); - dabOutput* output = new dabOutput(); - - outputs.push_back(output); - - memset(output, 0, sizeof(dabOutput)); - output->outputProto = NULL; - output->outputName = NULL; - output->data = NULL; - output->operations = dabOutputDefaultOperations; - int proto_pos = uri.find("://"); if (proto_pos == std::string::npos) { stringstream ss; ss << "Output with uid " << outputuid << " no protocol defined!"; throw runtime_error(ss.str()); - } else { + } - char* uri_c = new char[512]; - memset(uri_c, 0, 512); - uri.copy(uri_c, 511); + char* uri_c = new char[512]; + memset(uri_c, 0, 512); + uri.copy(uri_c, 511); - uri_c[proto_pos] = '\0'; + uri_c[proto_pos] = '\0'; - output->outputProto = uri_c; - output->outputName = output->outputProto + proto_pos + 3; - } + char* outputName = uri_c + proto_pos + 3; + + dabOutput* output = new dabOutput(uri_c, outputName); + outputs.push_back(output); // keep outputs in map, and check for uniqueness of the uid if (alloutputs.count(outputuid) == 0) { |