# 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-2010 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   typedef FilenamesType::size_type  SizeType;
    00046
    00048   void SetPattern(const char *pattern) { Pattern = pattern; }
    00049   const char *GetPattern() const { return Pattern.c_str(); }
    00050
    00052   void SetPrefix(const char *prefix) { Prefix = prefix; }
    00053   const char *GetPrefix() const { return Prefix.c_str(); }
    00054
    00056   bool Generate();
    00057
    00059   void SetNumberOfFilenames(SizeType nfiles);
    00060   SizeType GetNumberOfFilenames() const;
    00061
    00063   const char * GetFilename(SizeType n) const;
    00064
    00066   FilenamesType const & GetFilenames() const { assert( !Pattern.empty() ); return Filenames; }
    00067
    00068 private:
    00069   FilenameType Pattern;
    00070   FilenameType Prefix;
    00071   FilenamesType Filenames;
    00072 };
    00073
    00074 } // end namespace gdcm
    00075
    00076 #endif //GDCMFILENAMEGENERATOR_H