Changeset 710


Ignore:
Timestamp:
Dec 20, 2006, 11:08:25 PM (14 years ago)
Author:
Jari Häkkinen
Message:

Addresses #1 and #80. Changed FileIO to FileUtil? and added tests on FileUtil?.

Location:
trunk
Files:
4 edited
2 moved

Legend:

Unmodified
Added
Removed
  • trunk/test/Makefile.am

    r675 r710  
    2525# 02111-1307, USA.
    2626
    27 TESTS = alignment_test averager_test commandline_test \
    28   consensus_inputranker_test \
    29   crossvalidation_test data_lookup_1d_test ensemble_test \
    30   feature_selection_test inputranker_test \
    31   kernel_test kernel_lookup_test matrix_test matrix_lookup_test \
    32   ncc_test nni_test pca_test regression_test rnd_test score_test \
    33   statistics_test stl_utility_test \
    34   subset_generator_test \
    35   svd_test svm_test target_test \
    36   utility_test vector_test
     27TESTS = alignment_test averager_test commandline_test                 \
     28  consensus_inputranker_test crossvalidation_test data_lookup_1d_test \
     29  ensemble_test feature_selection_test fileutil_test inputranker_test \
     30  kernel_test kernel_lookup_test matrix_test matrix_lookup_test       \
     31  ncc_test nni_test pca_test regression_test rnd_test score_test      \
     32  statistics_test stl_utility_test subset_generator_test svd_test     \
     33  svm_test target_test utility_test vector_test
    3734
    3835check_PROGRAMS = $(TESTS)
     
    5249ensemble_test_SOURCES = ensemble_test.cc
    5350feature_selection_test_SOURCES = feature_selection_test.cc
     51fileutil_test_SOURCES = fileutil_test.cc
    5452inputranker_test_SOURCES = inputranker_test.cc
    5553kernel_test_SOURCES = kernel_test.cc
  • trunk/test/nni_test.cc

    r680 r710  
    2222*/
    2323
    24 #include "yat/utility/FileIO.h"
     24#include "yat/utility/FileUtil.h"
    2525#include "yat/utility/matrix.h"
    2626#include "yat/utility/kNNI.h"
     
    3636void check_file_access(std::string& str)
    3737{
    38   if (utility::FileIO().access_rights(str,"r")) {
     38  utility::FileUtil file(str);
     39  if (file.access_rights(str,"r")) {
    3940    std::cerr << "test_nni: Cannot access file " << str << std::endl;
    4041    exit(-1);
  • trunk/test/vector_test.cc

    r680 r710  
    2323
    2424#include "yat/utility/Exception.h"
    25 #include "yat/utility/FileIO.h"
     25#include "yat/utility/FileUtil.h"
    2626#include "yat/utility/utility.h"
    2727#include "yat/utility/vector.h"
     
    3434void check_file_access(std::string& str)
    3535{
    36   if (utility::FileIO().access_rights(str,"r")) {
     36  utility::FileUtil file(str);
     37  if (file.access_rights(str,"r")) {
    3738    std::cerr << "test_nni: Cannot access file " << str << std::endl;
    3839    exit(-1);
  • trunk/yat/utility/FileUtil.cc

    r709 r710  
    2424*/
    2525
    26 #include "FileIO.h"
     26#include "FileUtil.h"
    2727
    2828#include <cerrno>
     
    3939
    4040
    41   FileIO::FileIO(const std::string& path)
     41  FileUtil::FileUtil(const std::string& path)
    4242    : no_file_(false), path_(path)
    4343  {
     
    4747
    4848
    49   int FileIO::access_rights(const std::string& path,
    50                             const std::string& bits) const
     49  int FileUtil::access_rights(const std::string& path,
     50                              const std::string& bits) const
    5151  {
    5252    std::string tryme=path_;
     
    7474
    7575
    76   bool FileIO::file_exists(const std::string& file) const
     76  bool FileUtil::file_exists(const std::string& file) const
    7777  {
    7878    return !no_file_;
     
    8080
    8181
    82   const std::string& FileIO::path(void) const
     82  const std::string& FileUtil::path(void) const
    8383  {
    8484    return path_;
  • trunk/yat/utility/FileUtil.h

    r709 r710  
    1 #ifndef _theplu_yat_utility_fileio_
    2 #define _theplu_yat_utility_fileio_
     1#ifndef _theplu_yat_utility_fileutil_
     2#define _theplu_yat_utility_fileutil_
    33
    44// $Id$
     
    3838
    3939  ///
    40   /// FileIO is useful for many common task on files.
     40  /// FileUtil is useful for many common task on files.
    4141  ///
    42   class FileIO {
     42  class FileUtil {
    4343  public:
    4444
     
    4949    /// ways than file does not exist.
    5050    ///
    51     explicit FileIO(const std::string& path);
     51    explicit FileUtil(const std::string& path);
    5252
    5353    ///
     
    8585    /// \brief The copy constructor, not implemented
    8686    ///
    87     FileIO(const FileIO&);
     87    FileUtil(const FileUtil&);
    8888
    8989    bool no_file_;
  • trunk/yat/utility/Makefile.am

    r675 r710  
    2525noinst_LTLIBRARIES = libutility.la
    2626libutility_la_SOURCES = \
    27   Alignment.cc CommandLine.cc FileIO.cc kNNI.cc matrix.cc NNI.cc        \
     27  Alignment.cc CommandLine.cc FileUtil.cc kNNI.cc matrix.cc NNI.cc      \
    2828  Option.cc PCA.cc stl_utility.cc SVD.cc utility.cc vector.cc WeNNI.cc
    2929
     
    3232
    3333include_utility_HEADERS = \
    34   Alignment.h CommandLine.h Exception.h FileIO.h kNNI.h matrix.h NNI.h  \
     34  Alignment.h CommandLine.h Exception.h FileUtil.h kNNI.h matrix.h NNI.h  \
    3535  Option.h PCA.h stl_utility.h SVD.h utility.h vector.h WeNNI.h
Note: See TracChangeset for help on using the changeset viewer.