#ifndef __bbstdFilesFromDirectory_h_INCLUDED__ #define __bbstdFilesFromDirectory_h_INCLUDED__ #include "bbtkAtomicBlackBox.h" #include "iostream" namespace bbstd { class /*BBTK_EXPORT*/ FilesFromDirectory : public bbtk::AtomicBlackBox { BBTK_BLACK_BOX_INTERFACE(FilesFromDirectory,bbtk::AtomicBlackBox); //================================================================== /// User callback called in the box contructor virtual void bbUserConstructor(); /// User callback called in the box copy constructor virtual void bbUserCopyConstructor(bbtk::BlackBox::Pointer); /// User callback called in the box destructor virtual void bbUserDestructor(); //================================================================== BBTK_DECLARE_INPUT(In,std::string); BBTK_DECLARE_INPUT(Recursive,bool); BBTK_DECLARE_OUTPUT(Out,std::vector); BBTK_PROCESS(Process); void Process(); private : std::string NormalizePath(std::string const &pathname); int Explore(std::string const &dirpath, bool recursive); /// List of file names std::vector Filenames; /// name of the root directory to explore std::string DirName; }; //================================================================= // UserBlackBox description BBTK_BEGIN_DESCRIBE_BLACK_BOX(FilesFromDirectory,bbtk::AtomicBlackBox); BBTK_NAME("FilesFromDirectory"); BBTK_AUTHOR("jpr@creatis.univ-lyon1.fr"); BBTK_DESCRIPTION("returns the fullPathNames of the files in a Directory"); BBTK_CATEGORY(""); BBTK_INPUT(FilesFromDirectory,In,"Directory Name",std::string,""); BBTK_INPUT(FilesFromDirectory,Recursive,"Recursive directory exploration",bool,""); BBTK_OUTPUT(FilesFromDirectory,Out,"FullPathNames of the files",std::vector,""); BBTK_END_DESCRIBE_BLACK_BOX(FilesFromDirectory); } // EO namespace bbstd #endif // __bbstdFilesFromDirectory_h_INCLUDED__