IChecksum.cc 896 Bytes
Newer Older
1

2
3
#ifdef TEST_ON

4
5
#include "IChecksum.hh"

6
#include <fstream>
7
8
9
10
11
12
13
14
15
#include <iostream>

namespace Test {
namespace Checksum {

namespace {

Registry& registry_modify()
{
16
17
  static Registry chksm_reg;
  return chksm_reg;
18
19
20
21
22
23
24
25
26
27
28
29
}

}//namespace

const Registry& registry()
{
  return registry_modify();
}

///////////////////////////////////////////////////////////////////////////////
// class Checksum implementation

30
IChecksum::IChecksum(const char * _name) : name_(_name)
31
{
32
  auto pos = registry_modify().emplace(_name, this);
33
34
  if (!pos.second)
  {
35
    std::cout << "Duplicate checksum definition: " << _name << std::endl;
36
37
38
39
    throw;
  }
}

40
Base::IOutputStream& IChecksum::record(const Result& _rep_res) const
41
{
42
  static Base::OutputStreamAdaptT<std::ofstream> test_str(REPORT_FILENAME);
43
44
45
46
  test_str << _rep_res << "  " << name() << ": ";
  return test_str;
}

47
}//Checksum
48
49
50
}//namespace Test

#endif//TEST_ON