Blame view

src/PostProcessing/PostProcessingRegistry.cc 1.06 KB
fbe3c2bb   Benjamin Renard   First commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
 * PostProcessingRegistry.cc
 *
 *  Created on: 27 sept. 2013
 *      Author: CS
 */

#include "PostProcessingRegistry.hh"

namespace postprocessing {


PostProcessingRegistry PostProcessingRegistry::_Instance;

// std::unique_ptr<PostProcessingRegistry> PostProcessingRegistry::_instance =
// 		nullptr;

// std::once_flag PostProcessingRegistry::_instanceOnceFlag;


PostProcessingRegistry::PostProcessingRegistry() 
{
}

PostProcessingRegistry::~PostProcessingRegistry() 
{
  std::map<const std::string, PostProcessing*>::const_iterator itr;
  for (itr = getPostProcessingMap().begin(); itr != getPostProcessingMap().end(); ++itr) {
    delete (*itr).second;
  }
}

std::string PostProcessingRegistry::addElement(const std::string& pkey, PostProcessing* pp) {
  // register if not already in
  if (getPostProcessingMap().find(pkey) == getPostProcessingMap().end()) {
    getPostProcessingMap().insert(std::pair<std::string,
                                  PostProcessing*>(pkey, pp));
  }
  return pkey;
}

} /* namespace postprocessing */