From 307996c7ebfd03186a8044cc69b764b71c51e79e Mon Sep 17 00:00:00 2001 From: "Matthias P. Braendli" Date: Wed, 16 Apr 2014 21:07:10 +0200 Subject: remove using directives from .h files --- src/DabMod.cpp | 2 +- src/FIRFilter.cpp | 1 + src/FIRFilter.h | 7 +++++-- src/OutputUHD.cpp | 3 +++ src/OutputUHD.h | 12 +++++------ src/RemoteControl.cpp | 1 + src/RemoteControl.h | 58 ++++++++++++++++++++++++--------------------------- 7 files changed, 44 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/DabMod.cpp b/src/DabMod.cpp index 92da99a..76c2068 100644 --- a/src/DabMod.cpp +++ b/src/DabMod.cpp @@ -517,7 +517,7 @@ int main(int argc, char* argv[]) outputuhd_conf.pps_src = pt.get("uhdoutput.pps_source", "int"); outputuhd_conf.pps_polarity = pt.get("uhdoutput.pps_polarity", "pos"); - string behave = pt.get("uhdoutput.behaviour_refclk_lock_lost", "ignore"); + std::string behave = pt.get("uhdoutput.behaviour_refclk_lock_lost", "ignore"); if (behave == "crash") { outputuhd_conf.refclk_lock_loss_behaviour = CRASH; diff --git a/src/FIRFilter.cpp b/src/FIRFilter.cpp index f9ad31d..805c6d2 100644 --- a/src/FIRFilter.cpp +++ b/src/FIRFilter.cpp @@ -44,6 +44,7 @@ # endif #endif +using namespace std; #include diff --git a/src/FIRFilter.h b/src/FIRFilter.h index 59e954d..0ecae3e 100644 --- a/src/FIRFilter.h +++ b/src/FIRFilter.h @@ -108,8 +108,11 @@ public: const char* name() { return "FIRFilter"; } /******* REMOTE CONTROL ********/ - virtual void set_parameter(const string& parameter, const string& value); - virtual const string get_parameter(const string& parameter) const; + virtual void set_parameter(const std::string& parameter, + const std::string& value); + + virtual const std::string get_parameter( + const std::string& parameter) const; protected: diff --git a/src/OutputUHD.cpp b/src/OutputUHD.cpp index 62708f1..b0600cd 100644 --- a/src/OutputUHD.cpp +++ b/src/OutputUHD.cpp @@ -38,6 +38,9 @@ #include #include +using namespace boost; +using namespace std; + typedef std::complex complexf; OutputUHD::OutputUHD( diff --git a/src/OutputUHD.h b/src/OutputUHD.h index 530a30a..990822e 100644 --- a/src/OutputUHD.h +++ b/src/OutputUHD.h @@ -71,8 +71,6 @@ DESCRIPTION: typedef std::complex complexf; -using namespace boost; - struct UHDWorkerFrameData { // Buffer holding frame data void* buf; @@ -112,7 +110,7 @@ struct UHDWorkerData { bool muting; // A barrier to synchronise the two threads - shared_ptr sync_barrier; + boost::shared_ptr sync_barrier; // What to do when the reference clock PLL loses lock refclk_lock_loss_behaviour_t refclk_lock_loss_behaviour; @@ -197,10 +195,12 @@ class OutputUHD: public ModOutput, public RemoteControllable { */ /* Base function to set parameters. */ - virtual void set_parameter(const string& parameter, const string& value); + virtual void set_parameter(const std::string& parameter, + const std::string& value); /* Getting a parameter always returns a string. */ - virtual const string get_parameter(const string& parameter) const; + virtual const std::string get_parameter( + const std::string& parameter) const; protected: @@ -208,7 +208,7 @@ class OutputUHD: public ModOutput, public RemoteControllable { EtiReader *myEtiReader; OutputUHDConfig myConf; uhd::usrp::multi_usrp::sptr myUsrp; - shared_ptr mySyncBarrier; + boost::shared_ptr mySyncBarrier; UHDWorker worker; bool first_run; struct UHDWorkerData uwd; diff --git a/src/RemoteControl.cpp b/src/RemoteControl.cpp index 03cef2c..b3fdfec 100644 --- a/src/RemoteControl.cpp +++ b/src/RemoteControl.cpp @@ -32,6 +32,7 @@ #include "RemoteControl.h" using boost::asio::ip::tcp; +using namespace std; void RemoteControllerTelnet::restart() diff --git a/src/RemoteControl.h b/src/RemoteControl.h index dd31fc2..ede727b 100644 --- a/src/RemoteControl.h +++ b/src/RemoteControl.h @@ -32,7 +32,6 @@ #include #include #include -#include #include #include #include @@ -44,25 +43,22 @@ #define RC_ADD_PARAMETER(p, desc) { \ - vector p; \ + std::vector p; \ p.push_back(#p); \ p.push_back(desc); \ m_parameters.push_back(p); \ } -using namespace std; -using boost::asio::ip::tcp; - class ParameterError : public std::exception { public: - ParameterError(string message) : m_message(message) {} + ParameterError(std::string message) : m_message(message) {} ~ParameterError() throw() {}; const char* what() const throw() { return m_message.c_str(); } private: - string m_message; + std::string m_message; }; class RemoteControllable; @@ -90,7 +86,7 @@ class BaseRemoteController { class RemoteControllable { public: - RemoteControllable(string name) : m_name(name) {} + RemoteControllable(std::string name) : m_name(name) {} /* return a short name used to identify the controllable. * It might be used in the commands the user has to type, so keep @@ -104,9 +100,9 @@ class RemoteControllable { } /* Return a list of possible parameters that can be set */ - virtual list get_supported_parameters() const { - list parameterlist; - for (list< vector >::const_iterator it = m_parameters.begin(); + virtual std::list get_supported_parameters() const { + std::list parameterlist; + for (std::list< std::vector >::const_iterator it = m_parameters.begin(); it != m_parameters.end(); ++it) { parameterlist.push_back((*it)[0]); } @@ -120,11 +116,11 @@ class RemoteControllable { } /* Base function to set parameters. */ - virtual void set_parameter(const string& parameter, - const string& value) = 0; + virtual void set_parameter(const std::string& parameter, + const std::string& value) = 0; /* Getting a parameter always returns a string. */ - virtual const string get_parameter(const string& parameter) const = 0; + virtual const std::string get_parameter(const std::string& parameter) const = 0; protected: std::string m_name; @@ -168,26 +164,26 @@ class RemoteControllerTelnet : public BaseRemoteController { void process(long); - void dispatch_command(tcp::socket& socket, string command); + void dispatch_command(boost::asio::ip::tcp::socket& socket, std::string command); - void reply(tcp::socket& socket, string message); + void reply(boost::asio::ip::tcp::socket& socket, std::string message); RemoteControllerTelnet& operator=(const RemoteControllerTelnet& other); RemoteControllerTelnet(const RemoteControllerTelnet& other); - vector tokenise_(string message) { - vector all_tokens; + std::vector tokenise_(std::string message) { + std::vector all_tokens; boost::char_separator sep(" "); boost::tokenizer< boost::char_separator > tokens(message, sep); - BOOST_FOREACH (const string& t, tokens) { + BOOST_FOREACH (const std::string& t, tokens) { all_tokens.push_back(t); } return all_tokens; } - RemoteControllable* get_controllable_(string name) { - for (list::iterator it = m_cohort.begin(); + RemoteControllable* get_controllable_(std::string name) { + for (std::list::iterator it = m_cohort.begin(); it != m_cohort.end(); ++it) { if ((*it)->get_rc_name() == name) { @@ -197,24 +193,24 @@ class RemoteControllerTelnet : public BaseRemoteController { throw ParameterError("Module name unknown"); } - list< vector > get_parameter_descriptions_(string name) { + std::list< std::vector > get_parameter_descriptions_(std::string name) { RemoteControllable* controllable = get_controllable_(name); return controllable->get_parameter_descriptions(); } - list get_param_list_(string name) { + std::list get_param_list_(std::string name) { RemoteControllable* controllable = get_controllable_(name); return controllable->get_supported_parameters(); } - list< vector > get_param_list_values_(string name) { + std::list< std::vector > get_param_list_values_(std::string name) { RemoteControllable* controllable = get_controllable_(name); - list< vector > allparams; - list params = controllable->get_supported_parameters(); - for (list::iterator it = params.begin(); + std::list< std::vector > allparams; + std::list params = controllable->get_supported_parameters(); + for (std::list::iterator it = params.begin(); it != params.end(); ++it) { - vector item; + std::vector item; item.push_back(*it); item.push_back(controllable->get_parameter(*it)); @@ -223,12 +219,12 @@ class RemoteControllerTelnet : public BaseRemoteController { return allparams; } - string get_param_(string name, string param) { + std::string get_param_(std::string name, std::string param) { RemoteControllable* controllable = get_controllable_(name); return controllable->get_parameter(param); } - void set_param_(string name, string param, string value) { + void set_param_(std::string name, std::string param, std::string value) { RemoteControllable* controllable = get_controllable_(name); return controllable->set_parameter(param, value); } @@ -242,7 +238,7 @@ class RemoteControllerTelnet : public BaseRemoteController { boost::thread m_child_thread; /* This controller commands the controllables in the cohort */ - list m_cohort; + std::list m_cohort; std::string m_welcome; std::string m_prompt; -- cgit v1.2.3