# gdcmFilenameGenerator.h

Go to the documentation of this file.

    00001 /*=========================================================================
    00002
    00003   Program: GDCM (Grassroots DICOM). A DICOM library
    00004   Module:  $URL$
    00005
    00006   Copyright (c) 2006-2009 Mathieu Malaterre
    00007   All rights reserved.
    00008   See Copyright.txt or http://gdcm.sourceforge.net/Copyright.html for details.
    00009
    00010      This software is distributed WITHOUT ANY WARRANTY; without even
    00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00012      PURPOSE.  See the above copyright notice for more information.
    00013
    00014 =========================================================================*/
    00015 #ifndef __gdcmFilenameGenerator_h
    00016 #define __gdcmFilenameGenerator_h
    00017
    00018 #include "gdcmTypes.h"
    00019 #include <string>
    00020 #include <vector>
    00021
    00022
    00023 namespace gdcm
    00024 {
    00037 class GDCM_EXPORT FilenameGenerator
    00038 {
    00039 public:
    00040   FilenameGenerator():Pattern(),Prefix(),Filenames() {}
    00041   ~FilenameGenerator() {}
    00042   // FIXME: already defines in gdcm::Directory
    00043   typedef std::string FilenameType;
    00044   typedef std::vector<FilenameType> FilenamesType;
    00045
    00047   void SetPattern(const char *pattern) { Pattern = pattern; }
    00048   const char *GetPattern() const { return Pattern.c_str(); }
    00049
    00051   void SetPrefix(const char *prefix) { Prefix = prefix; }
    00052   const char *GetPrefix() const { return Prefix.c_str(); }
    00053
    00055   bool Generate();
    00056
    00058   void SetNumberOfFilenames(unsigned int nfiles);
    00059   unsigned int GetNumberOfFilenames() const;
    00060
    00062   const char * GetFilename(unsigned int n) const;
    00063
    00065   FilenamesType const & GetFilenames() const { assert( !Pattern.empty() ); return Filenames; }
    00066
    00067 private:
    00068   FilenameType Pattern;
    00069   FilenameType Prefix;
    00070   FilenamesType Filenames;
    00071 };
    00072
    00073 } // end namespace gdcm
    00074
    00075 #endif //__gdcmFilenameGenerator_h