15 #include <boost/filesystem/path.hpp>
16 #include <boost/filesystem/operations.hpp>
19 using namespace kome::operation;
24 #define new new( _NORMAL_BLOCK, __FILE__, __LINE__ )
25 #define malloc( s ) _malloc_dbg( s, _NORMAL_BLOCK, __FILE__, __LINE__ )
105 kome::plugin::SettingsValue* value = params.addValue();
106 value->setType( kome::plugin::SettingsValue::TYPE_DIR );
107 value->setRequired(
true );
110 kome::plugin::SettingsParam* param = params.addParam();
111 param->setSection( FMT(
"Batch Analysis (%s)",
m_name.c_str() ).c_str() );
112 param->setKey(
"DIR" );
116 kome::plugin::SettingsForm* form = page.addForm();
117 form->setTitle(
"Directory" );
118 form->setParam( param );
119 form->setDesc(
"Select the data folder." );
151 for(
unsigned int i = 0; i < paths.size() && !progress.
isStopped(); i++ ) {
153 std::string message = FMT(
"Analyzing ... [%d/%d]", ( i + 1 ), paths.size() );
159 onAnalyze( paths[ i ].c_str(), *subProgress );
183 LOG_WARN( FMT(
"This method is underconstruction. Please implement onCreateParametersPage method in the subclass of BatchAnalysis." ) );
189 boost::filesystem::path p( dir, boost::filesystem::native );
192 if( boost::filesystem::is_directory( p ) ) {
193 boost::filesystem::directory_iterator end;
194 for( boost::filesystem::directory_iterator it( p ); it != end; it++ ) {
195 boost::filesystem::path child = (*it);
196 getFiles( boost::filesystem::absolute( child ).
string().c_str(), files );
200 files.resize( files.size() + 1 );
201 files.back().first = boost::filesystem::absolute( p ).string();
static const char * DIR_PARAM_NAME
virtual void onShowResult()=0
shows analysis result
virtual void onFinishAnalysis(kome::core::Progress &progress)=0
on finish analysis
void clearFileProperties()
clears file propertyes
void fill()
sets end position
virtual ~BatchAnalysis()
destructor
virtual void onCreateFilesPage(kome::plugin::ParameterSettings ¶ms, kome::plugin::SettingsPage &page)
creates files page
Progress * getSubProgress(const unsigned int idx)
gets subprogress
setting parameter values management class
virtual void onAnalyze(const char *path, kome::core::Progress &progress)=0
on analyze
int addFileProperty(const char *prop)
adds file property
bool isStopped()
judges whether it has to finish
kome::plugin::SettingsPage * m_parametersPage
void getFiles(kome::objects::SettingParameterValues *settings, std::vector< std::pair< std::string, kome::core::Properties > > &files)
gets files
void showResult()
shows analysis result
void analyze(std::vector< std::string > &paths, kome::core::Progress &progress)
analyzes
kome::plugin::SettingsPage * m_filesPage
progress display abstract class
const char * getFileProperty(const unsigned int idx)
gets the file property
#define NVL(checkVal, replaceVal)
interfaces of BatchAnalysis class
const char * getParameterValue(const unsigned int index)
gets parameter value
virtual void onCreateParametersPage(kome::plugin::ParameterSettings ¶ms, kome::plugin::SettingsPage &page)
creates parameters
static const char * FILE_NAME_PROP_NAME
BatchAnalysis(const char *analysisName)
constructor
void createSubProgresses(const unsigned int num)
creates sub progresses
virtual void onPrepareAnalysis(std::vector< std::string > &paths, kome::core::Progress &progress)=0
on prepares analysis
virtual void onGetFiles(kome::objects::SettingParameterValues *settings, std::vector< std::pair< std::string, kome::core::Properties > > &files)
This method is called form the getFiles method.
kome::plugin::SettingsPage * getParametersPage()
gets the parameters page
std::vector< std::string > m_fileProperties
void setStatus(const char *status, const bool bForced=false)
sets status
kome::plugin::ParameterSettings m_params
unsigned int getNumberOfFileProperties()
gets the number of file properties
kome::plugin::SettingsPage * getFilesPage()
gets the files page