CD
Size: a a a
CD
CD
LA
CD
CD
LA
CD
LA
CD
CD
s
#ifndef SERIALLOGGER_H
#define SERIALLOGGER_H
#include <cstdio>
#include <iostream>
#include <sstream>
#include <string>
#include "ILogging.h"
#include "Singleton.h"
#include "mbed.h"
namespace Teddy {
class SerialLogger : public ILogging, public Singleton<SerialLogger> {
public:
typedef std::ostream &(*ManipFn)(std::ostream &);
typedef std::ios_base &(*FlagsFn)(std::ios_base &);
SerialLogger(Stream &pc);
enum LogLevel { INFO, WARN, ERROR };
template <class T> // int, double, strings, etc
SerialLogger &operator<<(const T &output) {
m_stream << output;
return *this;
}
SerialLogger &operator<<(ManipFn manip) /// endl, flush, setw, setfill, etc.
{
_mutex->lock();
manip(m_stream);
if (manip == static_cast<ManipFn>(std::flush) ||
manip == static_cast<ManipFn>(std::endl))
this->flush();
_mutex->unlock();
return *this;
}
SerialLogger &operator<<(FlagsFn manip) /// setiosflags, resetiosflags
{
manip(m_stream);
return *this;
}
SerialLogger &operator()(TraceLevel_t e) {
m_logLevel = e;
return *this;
}
void flush();
// SerialLogger(const PinName usart_tx, const PinName usart_rx, const
// uint32_t baud = 9600);
~SerialLogger();
void printf(const char *format, ...) const override;
void debug(const char *format, ...) const override;
void warning(const char *format, ...) const override;
void error(const char *format, ...) const override;
void info(const char *format, ...) const override;
bool is_available(void) const override;
private:
Stream &_serial_p;
Mutex *_mutex;
std::stringstream m_stream;
TraceLevel_t m_logLevel;
};
}; // namespace Teddy
#endif // SERIALLOGGER_H
s
s
s
#ifndef _GLIBCXX_IOSTREAMа его имплементация - платформозависима
#define _GLIBCXX_IOSTREAM 1
#pragma GCC system_header
#include <bits/c++config.h>
#include <ostream>
#include <istream>
namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
/**
* @name Standard Stream Objects
*
* The <iostream> header declares the eight <em>standard stream
* objects</em>. For other declarations, see
* http://gcc.gnu.org/onlinedocs/libstdc++/manual/io.html
* and the @link iosfwd I/O forward declarations @endlink
*
* They are required by default to cooperate with the global C
* library's @c FILE streams, and to be available during program
* startup and termination. For more information, see the section of the
* manual linked to above.
*/
//@{
extern istream cin; /// Linked to standard input
extern ostream cout; /// Linked to standard output
extern ostream cerr; /// Linked to standard error (unbuffered)
extern ostream clog; /// Linked to standard error (buffered)
#ifdef _GLIBCXX_USE_WCHAR_T
extern wistream wcin; /// Linked to standard input
extern wostream wcout; /// Linked to standard output
extern wostream wcerr; /// Linked to standard error (unbuffered)
extern wostream wclog; /// Linked to standard error (buffered)
#endif
//@}
// For construction of filebuffers for cout, cin, cerr, clog et. al.
static ios_base::Init __ioinit;
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace
#endif /* _GLIBCXX_IOSTREAM */
s
IZ
С
namespace a = std;
Е
namespace a = std;
boost::mpl::fusion::hana::vector
?v
namespace a = std;
v