IChecksum.cc 658 Bytes
Newer Older
1

2
3
#ifdef TEST_ON

4
5
6
7
8
9
10
11
12
13
14
#include "IChecksum.hh"

#include <iostream>

namespace Test {
namespace Checksum {

namespace {

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

}//namespace

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

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

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

}//Checksum
40
41
42
}//namespace Test

#endif//TEST_ON