Line | |
---|
1 | #include "LogWriter.h"
|
---|
2 | #include "ViewCellsManager.h"
|
---|
3 |
|
---|
4 |
|
---|
5 | namespace GtpVisibilityPreprocessor
|
---|
6 | {
|
---|
7 |
|
---|
8 |
|
---|
9 | LogWriter::LogWriter()
|
---|
10 | {
|
---|
11 | }
|
---|
12 |
|
---|
13 |
|
---|
14 | LogWriter::LogWriter(const std::string &filename): mFilename(filename)
|
---|
15 | {
|
---|
16 | }
|
---|
17 |
|
---|
18 |
|
---|
19 | void LogWriter::SetFilename(const std::string &filename)
|
---|
20 | {
|
---|
21 | mFilename = filename;
|
---|
22 | }
|
---|
23 |
|
---|
24 |
|
---|
25 | void LogWriter::Write(//ofstream &myfile,
|
---|
26 | const int numSamples, const ViewCellInfoContainer &infos)
|
---|
27 | {
|
---|
28 | ofstream myfile;
|
---|
29 | myfile.open(mFilename.c_str());
|
---|
30 |
|
---|
31 | if (!myfile.is_open())
|
---|
32 | myfile.open(mFilename.c_str());
|
---|
33 |
|
---|
34 | ViewCellInfoContainer::const_iterator vit, vit_end = infos.end();
|
---|
35 |
|
---|
36 | for (vit = infos.begin(); vit != vit_end; ++ vit)
|
---|
37 | {
|
---|
38 | myfile << (*vit).mPiercingRays;
|
---|
39 | //ViewCell *vc = *vit;
|
---|
40 | //myfile << "vc: " << vc->GetPvs().GetSize() << " " << vc->GetNumPiercingRays();
|
---|
41 | }
|
---|
42 | }
|
---|
43 |
|
---|
44 | /*
|
---|
45 | void LogWriter::Write(const ViewCellHistoryContainer &hist)
|
---|
46 | {
|
---|
47 | //ofstream myfile;
|
---|
48 | //char filename[64];
|
---|
49 | //sprintf(filename, "%s %06d", mFilename.c_str(), numSamples);
|
---|
50 | //myfile.open(filename);
|
---|
51 | if (!mFile.is_open())
|
---|
52 | mFile.open(mFilename.c_str());
|
---|
53 |
|
---|
54 | ViewCellHistoryContainer::const_iterator vit, vit_end = hist.end();
|
---|
55 |
|
---|
56 | // number of samples
|
---|
57 | //myfile << "samples: " << numSamples << endl;
|
---|
58 | mFile << (int)hist.size() << endl;
|
---|
59 |
|
---|
60 | for (vit = hist.begin(); vit != vit_end; ++ vit)
|
---|
61 | {
|
---|
62 | Write(myfile, (*vit).first, *(*vit).second);
|
---|
63 | }
|
---|
64 | }
|
---|
65 |
|
---|
66 | */
|
---|
67 |
|
---|
68 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.