Commit 01fbe151 authored by thomas.forbriger's avatar thomas.forbriger Committed by thomas.forbriger
Browse files

proceeding

This is a legacy commit from before 2015-03-01.
It may be incomplete as well as inconsistent.
See COPYING.legacy and README.history for details.


SVN Path:     http://gpitrsvn.gpi.uni-karlsruhe.de/repos/TFSoftware/trunk
SVN Revision: 2684
SVN UUID:     67feda4a-a26e-11df-9d6e-31afc202ad0c
parent 52787390
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: DL1logger.cc,v 1.5 2008-11-28 17:47:33 tforb Exp $
* $Id: DL1logger.cc,v 1.6 2008-11-28 18:03:34 tforb Exp $
* \author Thomas Forbriger
* \date 27/11/2008
*
......@@ -36,7 +36,7 @@
#define DL1LOGGER_VERSION \
"DL1LOGGER V1.0 data logging program for Thies DL1"
#define DL1LOGGER_CVSID \
"$Id: DL1logger.cc,v 1.5 2008-11-28 17:47:33 tforb Exp $"
"$Id: DL1logger.cc,v 1.6 2008-11-28 18:03:34 tforb Exp $"
// #define _GNU_SOURCE
#include <string.h>
......@@ -215,6 +215,9 @@ int main(int iargc, char* argv[])
else
{ cout << "skipping clock initialisation!" << endl; }
// log status
Logger() << status(port);
while(true)
{
sleep(1);
......
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: functions.cc,v 1.4 2008-11-28 17:47:33 tforb Exp $
* $Id: functions.cc,v 1.5 2008-11-28 18:03:35 tforb Exp $
* \author Thomas Forbriger
* \date 27/11/2008
*
......@@ -36,7 +36,7 @@
#define DL_FUNCTIONS_CC_VERSION \
"DL_FUNCTIONS_CC V1.0 "
#define DL_FUNCTIONS_CC_CVSID \
"$Id: functions.cc,v 1.4 2008-11-28 17:47:33 tforb Exp $"
"$Id: functions.cc,v 1.5 2008-11-28 18:03:35 tforb Exp $"
#include<iostream>
#include<syslog.h>
......@@ -99,13 +99,13 @@ namespace dl1 {
/*----------------------------------------------------------------------*/
void logstringstream(Logger& logger, const std::ostringstream& oss)
void logvecofstring(Logger& logger, const Tvecofstring& vec)
{
Tvecofstring v=vecofstring(oss);
for (Tvecofstring::iterator i=v.begin(); i!=v.end(); ++i)
{
Logger() << *i;
for (unsigned int i=0; i<vec.size()-1; ++i)
{
Logger() << vec[i];
}
logger << vec[vec.size()-1];
} // void logstringstream(Logger& logger, const std::ostringstream& oss)
/*======================================================================*/
......@@ -115,7 +115,7 @@ namespace dl1 {
Logger() << "initialize DL1 clock at " << libtime::utc().timestring();
std::ostringstream oss;
dl1.setcurrenttime(oss);
Logger() << oss;
Logger() << vecofstring(oss);
} // void initializeclock()
/*----------------------------------------------------------------------*/
......@@ -129,6 +129,31 @@ namespace dl1 {
} // Tvecofstring vecofstring(const std::ostringstream& oss,
// const std::string& eol)
/*----------------------------------------------------------------------*/
Tvecofstring status(DL1& dl1)
{
Tvecofstring retval;
dl1.sendLL();
bool hot=true;
while (hot)
{
std::string line=tfxx::string::trimws(dl1.getline(normaltimeout));
if (line.size()>0)
{
if (line=="END")
{
hot=false;
}
else
{
retval.push_back(line);
}
}
}
return(retval);
} // Tvecofstring status(DL1& dl1)
} // namespace dl1
/* ----- END OF functions.cc ----- */
......@@ -3,7 +3,7 @@
*
* ----------------------------------------------------------------------------
*
* $Id: functions.h,v 1.4 2008-11-28 17:47:33 tforb Exp $
* $Id: functions.h,v 1.5 2008-11-28 18:03:35 tforb Exp $
* \author Thomas Forbriger
* \date 27/11/2008
*
......@@ -40,7 +40,7 @@
#define DL_FUNCTIONS_H_VERSION \
"DL_FUNCTIONS_H V1.0 "
#define DL_FUNCTIONS_H_CVSID \
"$Id: functions.h,v 1.4 2008-11-28 17:47:33 tforb Exp $"
"$Id: functions.h,v 1.5 2008-11-28 18:03:35 tforb Exp $"
#include<sstream>
#include<vector>
......@@ -51,6 +51,10 @@ namespace dl1 {
typedef std::vector<std::string> Tvecofstring;
// standard timeout values (seconds)
const int normaltimeout=10;
const int longtimeout=90;
/*! logging levels
*/
enum loglevel {
......@@ -65,7 +69,7 @@ namespace dl1 {
}; // enum loglevel
class Logger;
void logstringstream(Logger& logger, const std::ostringstream& oss);
void logvecofstring(Logger& logger, const Tvecofstring& vec);
/*! logger class
*/
......@@ -75,9 +79,9 @@ namespace dl1 {
~Logger();
static void setident(const char* ident);
static void beverbose(const bool& flag);
Logger& operator<<(const std::ostringstream& oss)
Logger& operator<<(const Tvecofstring& vec)
{
logstringstream(*this, oss);
logvecofstring(*this, vec);
return(*this);
}
template<class T>
......@@ -106,6 +110,9 @@ namespace dl1 {
Tvecofstring vecofstring(const std::ostringstream& oss,
const std::string& eol=DL1::dumpEOL);
//! return current status of logger
Tvecofstring status(DL1& dl1);
} // namespace dl1
#endif // DL_FUNCTIONS_H_VERSION (includeguard)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment