Public Member Functions | Protected Member Functions | Private Attributes

CreateTree Class Reference

#include <CreateTree.h>

Inheritance diagram for CreateTree:
Inheritance graph
[legend]
Collaboration diagram for CreateTree:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 CreateTree (const cmn_Path &a_path, UInt32_t a_dirs, UInt32_t a_files, UInt32_t a_depth, UInt64_t a_fsize, string a_suffix)

Protected Member Functions

virtual void PreprocessDir (const cmn_Path &a_dir, UInt32_t a_depth)

Private Attributes

 log_CLASSID_m
string m_suffix
UInt32_t m_dirs
UInt32_t m_files
UInt32_t m_depth
UInt64_t m_fsize

Detailed Description

Definition at line 33 of file CreateTree.h.


Constructor & Destructor Documentation

CreateTree::CreateTree ( const cmn_Path a_path,
UInt32_t  a_dirs,
UInt32_t  a_files,
UInt32_t  a_depth,
UInt64_t  a_fsize,
string  a_suffix 
)

Definition at line 50 of file CreateTree.cpp.

  : TreeWalk(a_path),
    m_suffix(a_suffix),
    m_dirs(a_dirs),
    m_files(a_files),
    m_depth(a_depth),
    m_fsize(a_fsize) {

}


Member Function Documentation

void CreateTree::PreprocessDir ( const cmn_Path a_dir,
UInt32_t  a_depth 
) [protected, virtual]

Definition at line 66 of file CreateTree.cpp.

References FailureCount::AddDirFailure(), FailureCount::AddDirSuccess(), FailureCount::AddFileFailure(), FailureCount::AddFileSuccess(), cmn_CreatePath(), ivd_BaseException::GetError(), log_FUNC_m, m_depth, m_dirs, m_files, m_fsize, and m_suffix.

                                                                      {

    log_FUNC_m(PreprocessDir);

//    cout << a_depth << endl;

    
    if (a_depth > m_depth) {
        return;
    }

    for (UInt32_t i = 0; i < m_dirs; i++) {

        ostringstream name;
        name
            << "D-" << a_depth << "-" << i
            << "-" << m_suffix;
        try {
            
            cmn_CreatePath(a_dir + name.str());
            AddDirSuccess();
            
        }
        
        catch (ivd_SysError &a_error) {
            if (a_error.GetError() != EEXIST) {
               AddDirFailure();
            }
        }
    }

    for (UInt32_t i = 0; i < m_files; i++) {

        ostringstream name;
        name
            << "F-" << a_depth << "-" << i
            << "-" <<  m_suffix;
        
        try {
            
            cmn_FileTest f(a_dir + name.str(), m_fsize);
            f.WriteContents(m_fsize, 'I');
            AddFileSuccess();
        }
        catch (ivd_SysError &a_error) {
        /* We don't treat alredy created files as errors */
            if (a_error.GetError() != EEXIST) {
                AddFileFailure();
            }
        } 
    }
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 47 of file CreateTree.h.

Definition at line 54 of file CreateTree.h.

Referenced by PreprocessDir().

Definition at line 52 of file CreateTree.h.

Referenced by PreprocessDir().

Definition at line 53 of file CreateTree.h.

Referenced by PreprocessDir().

Definition at line 55 of file CreateTree.h.

Referenced by PreprocessDir().

string CreateTree::m_suffix [private]

Definition at line 50 of file CreateTree.h.

Referenced by PreprocessDir().


The documentation for this class was generated from the following files: