diff options
Diffstat (limited to 'gnuradio-runtime/include')
-rw-r--r-- | gnuradio-runtime/include/gnuradio/CMakeLists.txt | 12 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/basic_block.h | 20 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/block.h | 24 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/hier_block2.h | 25 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/logger.h (renamed from gnuradio-runtime/include/gnuradio/logger.h.in) | 140 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt | 1 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/tpb_detail.h | 3 | ||||
-rw-r--r-- | gnuradio-runtime/include/gnuradio/types.h | 23 | ||||
-rw-r--r-- | gnuradio-runtime/include/pmt/CMakeLists.txt | 2 |
10 files changed, 61 insertions, 190 deletions
diff --git a/gnuradio-runtime/include/gnuradio/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/CMakeLists.txt index 472f91847b..230f8d6e6d 100644 --- a/gnuradio-runtime/include/gnuradio/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/CMakeLists.txt @@ -44,6 +44,7 @@ install(FILES hier_block2.h high_res_timer.h io_signature.h + logger.h math.h message.h misc.h @@ -81,9 +82,7 @@ install(FILES rpcserver_booter_aggregator.h rpcserver_booter_base.h rpcserver_selector.h - ${CMAKE_CURRENT_BINARY_DIR}/logger.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "runtime_devel" ) if(THRIFT_FOUND) @@ -92,14 +91,5 @@ install(FILES thrift_application_base.h thrift_server_template.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio - COMPONENT "runtime_devel" ) endif(THRIFT_FOUND) - -########################################################################## -# Configure logger -########################################################################## -CONFIGURE_FILE( - ${CMAKE_CURRENT_SOURCE_DIR}/logger.h.in - ${CMAKE_CURRENT_BINARY_DIR}/logger.h -) diff --git a/gnuradio-runtime/include/gnuradio/basic_block.h b/gnuradio-runtime/include/gnuradio/basic_block.h index 25d9fb5a78..7c343220b9 100644 --- a/gnuradio-runtime/include/gnuradio/basic_block.h +++ b/gnuradio-runtime/include/gnuradio/basic_block.h @@ -252,13 +252,6 @@ namespace gr { */ pmt::pmt_t delete_head_nowait( pmt::pmt_t which_port); - /*! - * \param[in] which_port The message port from which to get the message. - * \param[in] millisec Optional timeout value (0=no timeout). - * \returns returns pmt at head of queue or pmt::pmt_t() if empty. - */ - pmt::pmt_t delete_head_blocking(pmt::pmt_t which_port, unsigned int millisec = 0); - msg_queue_t::iterator get_iterator(pmt::pmt_t which_port) { return msg_queue[which_port].begin(); } @@ -376,14 +369,15 @@ namespace gr { d_msg_handlers[which_port] = msg_handler_t(msg_handler); } - virtual void set_processor_affinity(const std::vector<int> &mask) - { throw std::runtime_error("set_processor_affinity not overloaded in child class."); } + virtual void set_processor_affinity(const std::vector<int> &mask) = 0; + + virtual void unset_processor_affinity() = 0; + + virtual std::vector<int> processor_affinity() = 0; - virtual void unset_processor_affinity() - { throw std::runtime_error("unset_processor_affinity not overloaded in child class."); } + virtual void set_log_level(std::string level) = 0; - virtual std::vector<int> processor_affinity() - { throw std::runtime_error("processor_affinity not overloaded in child class."); } + virtual std::string log_level() = 0; }; inline bool operator<(basic_block_sptr lhs, basic_block_sptr rhs) diff --git a/gnuradio-runtime/include/gnuradio/block.h b/gnuradio-runtime/include/gnuradio/block.h index 3e85f22823..21d41c0b63 100644 --- a/gnuradio-runtime/include/gnuradio/block.h +++ b/gnuradio-runtime/include/gnuradio/block.h @@ -633,6 +633,30 @@ namespace gr { */ void system_handler(pmt::pmt_t msg); + /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger. This takes a string that is + * translated to the standard levels and can be (case insensitive): + * + * \li off , notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + */ + void set_log_level(std::string level); + + /*! + * \brief Get the logger's output level + */ + std::string log_level(); + /*! * \brief returns true when execution has completed due to a message connection */ diff --git a/gnuradio-runtime/include/gnuradio/hier_block2.h b/gnuradio-runtime/include/gnuradio/hier_block2.h index 08a5389e96..b7c6be2441 100644 --- a/gnuradio-runtime/include/gnuradio/hier_block2.h +++ b/gnuradio-runtime/include/gnuradio/hier_block2.h @@ -267,6 +267,31 @@ namespace gr { std::vector<int> processor_affinity(); /*! + * \brief Set the logger's output level. + * + * Sets the level of the logger for all connected blocks. This takes + * a string that is translated to the standard levels and can be + * (case insensitive): + * + * \li off , notset + * \li debug + * \li info + * \li notice + * \li warn + * \li error + * \li crit + * \li alert + * \li fatal + * \li emerg + */ + void set_log_level(std::string level); + + /*! + * \brief Get the logger's output level + */ + std::string log_level(); + + /*! * \brief Get if all block min buffers should be set. * * \details this returns whether all the block min output buffers diff --git a/gnuradio-runtime/include/gnuradio/logger.h.in b/gnuradio-runtime/include/gnuradio/logger.h index 08cb209c7b..4299a11beb 100644 --- a/gnuradio-runtime/include/gnuradio/logger.h.in +++ b/gnuradio-runtime/include/gnuradio/logger.h @@ -20,12 +20,6 @@ * Boston, MA 02110-1301, USA. */ -/******************************************************************************* -* Author: Mark Plett -* Description: -* The gr::logger module wraps the log4cpp library for logging in gnuradio -*******************************************************************************/ - #ifndef INCLUDED_GR_LOGGER_H #define INCLUDED_GR_LOGGER_H @@ -35,13 +29,6 @@ * */ -#ifndef ENABLE_GR_LOG -#cmakedefine ENABLE_GR_LOG -#endif -#ifndef HAVE_LOG4CPP -#cmakedefine HAVE_LOG4CPP -#endif - #ifdef _MSC_VER typedef unsigned short mode_t; #else @@ -56,71 +43,6 @@ typedef unsigned short mode_t; #include <boost/thread.hpp> #include <boost/format.hpp> #include <pmt/pmt.h> - -#ifdef ENABLE_GR_LOG - -// We have three configurations... first logging to stdout/stderr -#ifndef HAVE_LOG4CPP - -namespace gr { - //#warning GR logging Enabled and using std::cout - typedef std::string logger_ptr; -} /* namespace gr */ - -#define GR_LOG_DECLARE_LOGPTR(logger) -#define GR_LOG_ASSIGN_LOGPTR(logger,name) -#define GR_CONFIG_LOGGER(config) -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) -#define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) -#define GR_GET_LEVEL(name, level) -#define GR_LOG_GET_LEVEL(logger, level) -#define GR_ADD_APPENDER(name,appender) -#define GR_LOG_ADD_APPENDER(logger,appender) -#define GR_SET_APPENDER(name,appender) -#define GR_LOG_SET_APPENDER(logger,appender) -#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) -#define GR_SET_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_SET_FILE_APPENDER(logger,filename,append,pattern) -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) -#define GR_GET_LOGGER_NAMES(names) -#define GR_RESET_CONFIGURATION() -#define GR_DEBUG(name, msg) std::cout<<"DEBUG: "<<msg<<std::endl -#define GR_INFO(name, msg) std::cout<<"INFO: "<<msg<<std::endl -#define GR_NOTICE(name, msg) std::cout<<"NOTICE: "<<msg<<std::endl -#define GR_WARN(name, msg) std::cerr<<"WARN: "<<msg<<std::endl -#define GR_ERROR(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_ALERT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_CRIT(name, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_FATAL(name, msg) std::cerr<<"FATAL: "<<msg<<std::endl -#define GR_EMERG(name, msg) std::cerr<<"EMERG: "<<msg<<std::endl -#define GR_ERRORIF(name, cond, msg) {if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} -#define GR_ASSERT(name, cond, msg) {if(!(cond)) std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);} -#define GR_LOG_DEBUG(logger, msg) std::cout<<"DEBUG: "<<msg<<std::endl -#define GR_LOG_INFO(logger, msg) std::cout<<"INFO: "<<msg<<std::endl -#define GR_LOG_NOTICE(logger, msg) std::cout<<"NOTICE: "<<msg<<std::endl -#define GR_LOG_WARN(logger, msg) std::cerr<<"WARN: "<<msg<<std::endl -#define GR_LOG_ERROR(logger, msg) std::cerr<<"ERROR: "<<msg<<std::endl -#define GR_LOG_ALERT(logger, msg) std::cerr<<"ALERT: "<<msg<<std::endl -#define GR_LOG_CRIT(logger, msg) std::cerr<<"CRIT: "<<msg<<std::endl -#define GR_LOG_FATAL(logger, msg) std::cerr<<"FATAL: "<<msg<<std::endl -#define GR_LOG_EMERG(logger, msg) std::cerr<<"EMERG: "<<msg<<std::endl -#define GR_LOG_ERRORIF(logger, cond, msg) { \ - if((cond)) std::cerr<<"ERROR: "<<msg<<std::endl;} -#define GR_LOG_ASSERT(logger, cond, msg) { \ - if(!(cond)) {std::cerr<<"FATAL: "<<msg<<std::endl; assert(cond);};} - - -#else /* HAVE_LOG4CPP */ - -// Second configuration...logging to log4cpp #include <log4cpp/Category.hh> #include <log4cpp/PropertyConfigurator.hh> #include <log4cpp/FileAppender.hh> @@ -640,69 +562,8 @@ namespace gr { } /* namespace gr */ -#endif /* HAVE_LOG4CPP */ - // If Logger disable do nothing -#else /* ENABLE_GR_LOG */ - namespace gr { - typedef void* logger_ptr; -} /* namespace gr */ - -#define GR_LOG_DECLARE_LOGPTR(logger) -#define GR_LOG_ASSIGN_LOGPTR(logger,name) -#define GR_CONFIG_LOGGER(config) -#define GR_CONFIG_AND_WATCH_LOGGER(config,period) -#define GR_LOG_GETLOGGER(logger, name) -#define GR_SET_LEVEL(name, level) -#define GR_LOG_SET_LEVEL(logger, level) -#define GR_GET_LEVEL(name, level) -#define GR_LOG_GET_LEVEL(logger, level) -#define GR_ADD_APPENDER(name,appender) -#define GR_LOG_ADD_APPENDER(logger,appender) -#define GR_SET_APPENDER(name,appender) -#define GR_LOG_SET_APPENDER(logger,appender) -#define GR_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_ADD_CONSOLE_APPENDER(logger,target,pattern) -#define GR_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_LOG_SET_CONSOLE_APPENDER(logger,target,pattern) -#define GR_ADD_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_ADD_FILE_APPENDER(logger,filename,append,pattern) -#define GR_SET_FILE_APPENDER(name,filename,append,pattern) -#define GR_LOG_SET_FILE_APPENDER(logger,filename,append,pattern) -#define GR_ADD_ROLLINGFILE_APPENDER(name,filename,filesize,bkup_index,append,mode,pattern) -#define GR_LOG_ADD_ROLLINGFILE_APPENDER(logger,filename,filesize,bkup_index,append,mode,pattern) -#define GR_GET_LOGGER_NAMES(names) -#define GR_RESET_CONFIGURATION() -#define GR_DEBUG(name, msg) -#define GR_INFO(name, msg) -#define GR_NOTICE(name, msg) -#define GR_WARN(name, msg) -#define GR_ERROR(name, msg) -#define GR_ALERT(name, msg) -#define GR_CRIT(name, msg) -#define GR_FATAL(name, msg) -#define GR_EMERG(name, msg) -#define GR_ERRORIF(name, cond, msg) -#define GR_ASSERT(name, cond, msg) -#define GR_LOG_DEBUG(logger, msg) -#define GR_LOG_INFO(logger, msg) -#define GR_LOG_NOTICE(logger, msg) -#define GR_LOG_WARN(logger, msg) -#define GR_LOG_ERROR(logger, msg) -#define GR_LOG_ALERT(logger, msg) -#define GR_LOG_CRIT(logger, msg) -#define GR_LOG_FATAL(logger, msg) -#define GR_LOG_EMERG(logger, msg) -#define GR_LOG_ERRORIF(logger, cond, msg) -#define GR_LOG_ASSERT(logger, cond, msg) - -#endif /* ENABLE_GR_LOG */ - -namespace gr { - - // Even if logger is disabled we'll need for methods below to exist in python. - // The macros these call will be disabled if ENABLE_GR_LOG is undefined /********************* Start Classes and Methods for Python ******************/ /*! @@ -853,5 +714,4 @@ namespace gr { } /* namespace gr */ - #endif /* INCLUDED_GR_LOGGER_H */ diff --git a/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt index f79f2bd24f..7504cfeeb1 100644 --- a/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/messages/CMakeLists.txt @@ -27,5 +27,4 @@ install(FILES msg_producer.h msg_queue.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/messages - COMPONENT "runtime_devel" ) diff --git a/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt b/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt index 8ea4bfc66e..b9a4a98c13 100644 --- a/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt +++ b/gnuradio-runtime/include/gnuradio/thread/CMakeLists.txt @@ -25,5 +25,4 @@ install(FILES thread_body_wrapper.h thread_group.h DESTINATION ${GR_INCLUDE_DIR}/gnuradio/thread - COMPONENT "runtime_devel" ) diff --git a/gnuradio-runtime/include/gnuradio/tpb_detail.h b/gnuradio-runtime/include/gnuradio/tpb_detail.h index 9b7454b508..4e660144f2 100644 --- a/gnuradio-runtime/include/gnuradio/tpb_detail.h +++ b/gnuradio-runtime/include/gnuradio/tpb_detail.h @@ -58,7 +58,10 @@ namespace gr { //! Called by pmt msg posters void notify_msg() { + gr::thread::scoped_lock guard(mutex); + input_changed = true; input_cond.notify_one(); + output_changed = true; output_cond.notify_one(); } diff --git a/gnuradio-runtime/include/gnuradio/types.h b/gnuradio-runtime/include/gnuradio/types.h index 6cb0f72834..c91538e60e 100644 --- a/gnuradio-runtime/include/gnuradio/types.h +++ b/gnuradio-runtime/include/gnuradio/types.h @@ -37,29 +37,6 @@ typedef std::vector<double> gr_vector_double; typedef std::vector<void *> gr_vector_void_star; typedef std::vector<const void *> gr_vector_const_void_star; -/* - * #include <config.h> must be placed beforehand - * in the source file including gnuradio/types.h for - * the following to work correctly - */ -#ifdef HAVE_STDINT_H #include <stdint.h> -typedef int16_t gr_int16; -typedef int32_t gr_int32; -typedef int64_t gr_int64; -typedef uint16_t gr_uint16; -typedef uint32_t gr_uint32; -typedef uint64_t gr_uint64; -#else -/* - * Note: these defaults may be wrong on 64-bit systems - */ -typedef short gr_int16; -typedef int gr_int32; -typedef long long gr_int64; -typedef unsigned short gr_uint16; -typedef unsigned int gr_uint32; -typedef unsigned long long gr_uint64; -#endif /* HAVE_STDINT_H */ #endif /* INCLUDED_GR_TYPES_H */ diff --git a/gnuradio-runtime/include/pmt/CMakeLists.txt b/gnuradio-runtime/include/pmt/CMakeLists.txt index 4ae0e22431..f4a541e0dd 100644 --- a/gnuradio-runtime/include/pmt/CMakeLists.txt +++ b/gnuradio-runtime/include/pmt/CMakeLists.txt @@ -26,4 +26,4 @@ install(FILES pmt_pool.h pmt_sugar.h DESTINATION ${GR_INCLUDE_DIR}/pmt - COMPONENT "runtime_devel") +) |