]> Creatis software - bbtk.git/blob - packages/std/src/bbstdFilesFromDirectory.h
6223255fa84d45e93db141017aa99d37973069c8
[bbtk.git] / packages / std / src / bbstdFilesFromDirectory.h
1 #ifndef __bbstdFilesFromDirectory_h_INCLUDED__
2 #define __bbstdFilesFromDirectory_h_INCLUDED__
3 #include "bbtkAtomicBlackBox.h"
4 #include "iostream"
5 #include "bbstd_EXPORT.h"
6
7 namespace bbstd
8 {
9
10   class bbstd_EXPORT FilesFromDirectory
11     : 
12     public bbtk::AtomicBlackBox
13   {
14     BBTK_BLACK_BOX_INTERFACE(FilesFromDirectory,bbtk::AtomicBlackBox);
15     BBTK_DECLARE_INPUT(In,std::string);
16     BBTK_DECLARE_INPUT(Recursive,bool);  
17     BBTK_DECLARE_OUTPUT(Out,std::vector<std::string>);
18     BBTK_PROCESS(Process);
19     void Process();
20     
21   private :
22     std::string NormalizePath(std::string const &pathname);
23     int Explore(std::string const &dirpath, bool recursive);
24     
25     /// List of file names
26     std::vector<std::string> Filenames;
27     /// name of the root directory to explore
28     std::string DirName;
29   };
30   
31   //=================================================================
32   // BlackBox description
33   BBTK_BEGIN_DESCRIBE_BLACK_BOX(FilesFromDirectory,bbtk::AtomicBlackBox);
34   BBTK_NAME("FilesFromDirectory");
35   BBTK_AUTHOR("jpr@creatis.univ-lyon1.fr");
36   BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory");
37   BBTK_CATEGORY("");
38   BBTK_INPUT(FilesFromDirectory,In,"Directory Name",std::string,"");
39   BBTK_INPUT(FilesFromDirectory,Recursive,"Recursive directory exploration",bool,"");
40   
41   BBTK_OUTPUT(FilesFromDirectory,Out,"FullPathNames of the files",std::vector<std::string>,"");
42   BBTK_END_DESCRIBE_BLACK_BOX(FilesFromDirectory);
43
44 }
45 // EO namespace bbstd
46
47 #endif // __bbstdFilesFromDirectory_h_INCLUDED__
48