00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 1.12 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #include "mitkBaseDataSerializer.h" 00019 #include "mitkStandardFileLocations.h" 00020 #include <itksys/SystemTools.hxx> 00021 00022 mitk::BaseDataSerializer::BaseDataSerializer() 00023 : m_FilenameHint("unnamed") 00024 , m_WorkingDirectory("") 00025 { 00026 } 00027 00028 mitk::BaseDataSerializer::~BaseDataSerializer() 00029 { 00030 } 00031 00032 std::string mitk::BaseDataSerializer::Serialize() 00033 { 00034 MITK_INFO << this->GetNameOfClass() 00035 << " is asked to serialize an object " << (const void*) this->m_Data 00036 << " into a directory " << m_WorkingDirectory 00037 << " using a filename hint " << m_FilenameHint; 00038 00039 return ""; 00040 } 00041 00042 std::string mitk::BaseDataSerializer::GetUniqueFilenameInWorkingDirectory() 00043 { 00044 // tmpname 00045 static unsigned long count = 0; 00046 unsigned long n = count++; 00047 std::ostringstream name; 00048 for (int i = 0; i < 6; ++i) 00049 { 00050 name << char('a' + (n % 26)); 00051 n /= 26; 00052 } 00053 std::string myname; 00054 myname.append(name.str()); 00055 return myname; 00056 } 00057