From 0467adc104ef0a53e5e7e7ee9ed25a3254d0804a Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Mon, 4 Jul 2016 15:39:00 +0200 Subject: Properly copy DabOutputFile, make get_info() const --- src/dabOutput/dabOutput.h | 18 ++++++++++-------- src/utils.cpp | 2 +- src/utils.h | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/dabOutput/dabOutput.h b/src/dabOutput/dabOutput.h index 5f02f76..d68cd9c 100644 --- a/src/dabOutput/dabOutput.h +++ b/src/dabOutput/dabOutput.h @@ -99,7 +99,7 @@ class DabOutput virtual ~DabOutput() {} - virtual std::string get_info() = 0; + virtual std::string get_info() const = 0; }; // ----- used in File and Fifo outputs @@ -122,18 +122,20 @@ class DabOutputFile : public DabOutput DabOutputFile(const DabOutputFile& other) { + filename_ = other.filename_; file_ = other.file_; nbFrames_ = other.nbFrames_; type_ = other.type_; } ~DabOutputFile() {} + const DabOutputFile& operator=(const DabOutputFile& other) = delete; int Open(const char* filename); int Write(void* buffer, int size); int Close(); - std::string get_info() { + std::string get_info() const { return "file://" + filename_; } @@ -154,7 +156,7 @@ class DabOutputFifo : public DabOutputFile int Write(void* buffer, int size); - std::string get_info() { + std::string get_info() const { return "fifo://" + filename_; } @@ -195,7 +197,7 @@ class DabOutputRaw : public DabOutput int Write(void* buffer, int size); int Close(); - std::string get_info() { + std::string get_info() const { return "raw://" + filename_; } private: @@ -234,7 +236,7 @@ class DabOutputUdp : public DabOutput int Write(void* buffer, int size); int Close() { return 0; } - std::string get_info() { + std::string get_info() const { return "udp://" + uri_; } private: @@ -271,7 +273,7 @@ class DabOutputTcp : public DabOutput int Write(void* buffer, int size); int Close(); - std::string get_info() { + std::string get_info() const { return "tcp://" + uri_; } @@ -299,7 +301,7 @@ class DabOutputSimul : public DabOutput int Write(void* buffer, int size); int Close() { return 0; } - std::string get_info() { + std::string get_info() const { return "simul://" + name_; } private: @@ -376,7 +378,7 @@ class DabOutputZMQ : public DabOutput zmq_pub_sock_.close(); } - std::string get_info() { + std::string get_info() const { return "zmq: " + zmq_proto_ + "://" + endpoint_; } diff --git a/src/utils.cpp b/src/utils.cpp index 071c0e9..ec3e0c7 100644 --- a/src/utils.cpp +++ b/src/utils.cpp @@ -354,7 +354,7 @@ void printUsage(char *name, FILE* out) } #endif -void printOutputs(vector >& outputs) +void printOutputs(const vector >& outputs) { int index = 0; diff --git a/src/utils.h b/src/utils.h index 485ca9b..544c6ca 100644 --- a/src/utils.h +++ b/src/utils.h @@ -51,7 +51,7 @@ void printUsageConfigfile(char *name, FILE* out = stderr); /* The following four utility functions display a * description of all outputs, services, components * resp. subchannels*/ -void printOutputs(std::vector >& outputs); +void printOutputs(const std::vector >& outputs); void printServices(const std::vector >& services); -- cgit v1.2.3