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