PostProcessingRegistry.cc 1.06 KB
/*
 * 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 */