Skip to content
Snippets Groups Projects
Commit 75998a5f authored by Emmanuel Christophe's avatar Emmanuel Christophe
Browse files

BUG: avoid collisions in the temporary filename

parent bfbe2f37
No related branches found
No related tags found
No related merge requests found
......@@ -18,12 +18,15 @@
#include "otbCoordinateToName.h"
#include "otbMacro.h"
#include <sstream>
#ifdef OTB_USE_CURL
#include "tinyxml.h"
#include <curl/curl.h>
#endif
#include "itkMersenneTwisterRandomVariateGenerator.h"
namespace otb
{
......@@ -36,7 +39,18 @@ CoordinateToName::CoordinateToName():
{
m_PlaceName = "";
m_CountryName = "";
m_TempFileName = "out-SignayriUt1.xml";
//Avoid collision between different instance of the class
typedef itk::Statistics::MersenneTwisterRandomVariateGenerator RandomGenType;
RandomGenType::Pointer randomGen = RandomGenType::GetInstance();
randomGen->SetSeed(reinterpret_cast<long int>(this));//make sure the seed is unique for this class
int randomNum = randomGen->GetIntegerVariate();
std::stringstream filename;
filename << "tmp-coordinateToName-SignayriUt1-";
filename << randomNum;
filename << ".xml";
m_TempFileName = filename.str();
m_Threader = itk::MultiThreader::New();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment