]> Creatis software - bbtk.git/blob - packages/std/src/bbstdFilesFromDirectory.h
*** empty log message ***
[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     //==================================================================
16     /// User callback called in the box contructor
17     virtual void bbUserConstructor();
18     /// User callback called in the box copy constructor
19     virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer);
20     /// User callback called in the box destructor
21     virtual void bbUserDestructor();
22     //==================================================================
23     BBTK_DECLARE_INPUT(In,std::string);
24     BBTK_DECLARE_INPUT(Recursive,bool);  
25     BBTK_DECLARE_OUTPUT(Out,std::vector<std::string>);
26     BBTK_PROCESS(Process);
27     void Process();
28     
29   private :
30     std::string NormalizePath(std::string const &pathname);
31     int Explore(std::string const &dirpath, bool recursive);
32     
33     /// List of file names
34     std::vector<std::string> Filenames;
35     /// name of the root directory to explore
36     std::string DirName;
37   };
38   
39   //=================================================================
40   // BlackBox description
41   BBTK_BEGIN_DESCRIBE_BLACK_BOX(FilesFromDirectory,bbtk::AtomicBlackBox);
42   BBTK_NAME("FilesFromDirectory");
43   BBTK_AUTHOR("jpr@creatis.univ-lyon1.fr");
44   BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory");
45   BBTK_CATEGORY("");
46   BBTK_INPUT(FilesFromDirectory,In,"Directory Name",std::string,"");
47   BBTK_INPUT(FilesFromDirectory,Recursive,"Recursive directory exploration",bool,"");
48   
49   BBTK_OUTPUT(FilesFromDirectory,Out,"FullPathNames of the files",std::vector<std::string>,"");
50   BBTK_END_DESCRIBE_BLACK_BOX(FilesFromDirectory);
51
52 }
53 // EO namespace bbstd
54
55 #endif // __bbstdFilesFromDirectory_h_INCLUDED__
56