source: branches/AddingGoogleTestEnvironment/mtemp/mwuerzburg/tools/dcconverter/DCCurrentEvent.cpp@ 19779

Last change on this file since 19779 was 4091, checked in by merck, 21 years ago
Merck: First commit to CVS
File size: 2.1 KB
Line 
1// DCCurrentEvent.cpp: Implementiberung der Klasse DCCurrentEvent.
2//
3//////////////////////////////////////////////////////////////////////
4
5#ifndef DCCURRENTEVENT_INCLUDED
6#include "DCCurrentEvent.h"
7#endif
8#ifndef GLOBALS_INCLUDED
9#include "Globals.h"
10#endif
11
12#include <sstream>
13#include <istream>
14#include <ostream>
15#include <iostream>
16#include <iomanip>
17#include <iterator>
18#include <vector>
19
20extern int gYear, gMonth, gDay;
21
22//////////////////////////////////////////////////////////////////////
23// Konstruktion/Destruktion
24//////////////////////////////////////////////////////////////////////
25
26DCCurrentEvent::DCCurrentEvent()
27{
28 m_dcValues.reserve( Globals::CAMERA_PIXELS );
29
30}
31
32DCCurrentEvent::~DCCurrentEvent()
33{
34}
35
36std::istream& operator >> ( std::istream& in, DCCurrentEvent& event )
37{
38 using std::string;
39 using std::getline;
40
41 // read the starting tag
42 string tag;
43 in >> tag;
44 if ( tag != "DC")
45 {
46 in.clear( std::ios_base::badbit);
47 return in;
48 }
49
50 // read error codes
51 in >> event.m_dcError1 >> event.m_dcError2;
52
53 // read in the timestamp
54 in >> event.m_dcHour >> event.m_dcMin >> event.m_dcSec >> event.m_dcMSec;
55
56 getline( in, event.m_dcCurr );
57
58 return in;
59}
60
61std::ostream& operator << ( std::ostream& out, const DCCurrentEvent& event )
62{
63 using namespace std;
64
65 out << "DC-REPORT ";
66 out << setfill('0') << right << resetiosflags(ios_base::showpos);
67 out << setw(2) << 0 << ' ';
68 out << setw(4) << gYear << ' ';
69 out << setw(2) << gMonth << ' ';
70 out << setw(2) << gDay << ' ';
71 out << setw(2) << event.m_dcHour << ' ';
72 out << setw(2) << event.m_dcMin << ' ';
73 out << setw(2) << event.m_dcSec << ' ';
74 out << setw(3) << event.m_dcMSec << ' ';
75
76 out << setfill('0') << internal << setiosflags(ios_base::showpos);
77 out << setw(3) << event.m_dcError1 << " ";
78 out << setw(3) << event.m_dcError2;
79 out << setfill('0') << right << resetiosflags(ios_base::showpos);
80
81 out << event.m_dcCurr;
82 return out;
83}
Note: See TracBrowser for help on using the repository browser.