BlinkenArea - GitList
Repositories
Blog
Wiki
Blinker
Code
Commits
Branches
Tags
Search
Tree:
d47b86a
Branches
Tags
master
Blinker
src
noarch
Printer.cpp
implemented stream printer (for debug purposes)
Stefan Schuermans
commited
d47b86a
at 2011-10-23 19:20:38
Printer.cpp
Blame
History
Raw
/* Blinker Copyright 2011 Stefan Schuermans <stefan@blinkenarea.org> Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html a blinkenarea.org project */ #include <iostream> #include <stdlib.h> #include <string> #include <BlinkenLib/BlinkenFrame.h> #include "Directory.h" #include "File.h" #include "Printer.h" #include "SettingFile.h" #include "StreamMgr.h" #include "StreamRecv.h" namespace Blinker { /** * @brief constructor * @param[in] streamMgr stream manager * @param[in] dirBase base directory */ Printer::Printer(StreamMgr &streamMgr, const Directory &dirBase): m_streamMgr(streamMgr), m_dirBase(dirBase), m_fileInStream(dirBase.getFile("instream")), m_pInStream(NULL) { // get input stream m_fileInStream.getStr(m_nameInStream); m_pInStream = &m_streamMgr.refStream(m_nameInStream); // attach to input stream if (m_pInStream) m_pInStream->attach(this); } /// virtual destructor Printer::~Printer() { // detach from input stream if (m_pInStream) m_pInStream->detach(this); // unreference stream m_pInStream = NULL; m_streamMgr.unrefStream(m_nameInStream); } /** * @brief set current frame * @param[in] pFrame current frame */ void Printer::setFrame(stBlinkenFrame *pFrame) { char *str = BlinkenFrameToString(pFrame); std::cout << str; free(str); } /// set current frame to none void Printer::setNoFrame() { std::cout << "no frame" << std::endl; } } // namespace Blinker