UHD 003.004.003-0-unknown

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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 <uhd/utils/pimpl.hpp>
23 #include <ostream>
24 #include <string>
25
30 #define UHD_MSG(type) \
31 uhd::msg::_msg(uhd::msg::type)()
32
34 #define UHD_HERE() \
35 UHD_MSG(status) << __FILE__ << ":" << __LINE__ << std::endl
36
38 #define UHD_VAR(var) \
39 UHD_MSG(status) << #var << " = " << var << std::endl;
40
41 namespace uhd{ namespace msg{
42
44 enum type_t{
45 status = 's',
46 warning = 'w',
47 error = 'e',
48 fastpath= 'f'
49 };
50
52 typedef void (*handler_t)(type_t, const std::string &);
53
60 UHD_API void register_handler(const handler_t &handler);
61
63 class UHD_API _msg{
64 public:
65 _msg(const type_t type);
66 ~_msg(void);
67 std::ostream &operator()(void);
68 private:
69 UHD_PIMPL_DECL(impl) _impl;
70 };
71
72 }} //namespace uhd::msg
73
74 #endif /* INCLUDED_UHD_UTILS_MSG_HPP */