UHD  003.001.000
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
msg.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011 Ettus Research LLC
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 //
17 
18 #ifndef INCLUDED_UHD_UTILS_MSG_HPP
19 #define INCLUDED_UHD_UTILS_MSG_HPP
20 
21 #include <uhd/config.hpp>
22 #include <ostream>
23 #include <string>
24 
29 #define UHD_MSG(type) \
30  uhd::msg::_msg(uhd::msg::type)()
31 
32 
33 namespace uhd{ namespace msg{
34 
36  enum type_t{
37  status = 's',
38  warning = 'w',
39  error = 'e',
40  fastpath= 'f'
41  };
42 
44  typedef void (*handler_t)(type_t, const std::string &);
45 
52  UHD_API_FUTURE void register_handler(const handler_t &handler);
53 
56  _msg(const type_t type);
57  ~_msg(void);
58  std::ostream &operator()(void);
59  };
60 
61 }} //namespace uhd::msg
62 
63 #endif /* INCLUDED_UHD_UTILS_MSG_HPP */
Definition: msg.hpp:38
Internal message object (called by UHD_MSG macro)
Definition: msg.hpp:55
void(* handler_t)(type_t, const std::string &)
Typedef for a user-registered message handler.
Definition: msg.hpp:44
UHD_API_FUTURE void register_handler(const handler_t &handler)
type_t
Possible message types.
Definition: msg.hpp:36
Definition: convert.hpp:28
Definition: msg.hpp:39
Definition: msg.hpp:40
#define UHD_API_FUTURE
Definition: config.hpp:83
Definition: msg.hpp:37