Changeset 1556


Ignore:
Timestamp:
Jan 4, 2013, 8:33:14 AM (9 years ago)
Author:
Peter Johansson
Message:

update to latest yat

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/.release_year

    r1463 r1556  
    1 2012
     12013
  • trunk/yat/ColumnStream.cc

    r1463 r1556  
    1 // $Id: ColumnStream.cc 2526 2011-07-25 02:03:35Z peter $
     1// $Id: ColumnStream.cc 2919 2012-12-19 06:54:23Z peter $
    22
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2010, 2011 Peter Johansson
     5  Copyright (C) 2010, 2011, 2012 Peter Johansson
    66
    77  This file is part of yat, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "ColumnStream.h"
  • trunk/yat/CommandLine.cc

    r1526 r1556  
    1 // $Id: CommandLine.cc 2853 2012-09-23 23:56:38Z peter $
     1// $Id: CommandLine.cc 2881 2012-11-18 01:28:05Z peter $
    22
    33/*
     
    2121  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2222*/
     23
     24#include <config.h>
    2325
    2426#include "CommandLine.h"
  • trunk/yat/Exception.cc

    r1463 r1556  
    1 // $Id: Exception.cc 2526 2011-07-25 02:03:35Z peter $
     1// $Id: Exception.cc 2919 2012-12-19 06:54:23Z peter $
    22
    33/*
    4   Copyright (C) 2010, 2011 Peter Johansson
     4  Copyright (C) 2010, 2011, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1919  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2020*/
     21
     22#include <config.h>
    2123
    2224#include "Exception.h"
  • trunk/yat/Option.cc

    r1463 r1556  
    1 // $Id: Option.cc 2384 2010-12-22 14:03:36Z peter $
     1// $Id: Option.cc 2919 2012-12-19 06:54:23Z peter $
    22
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009, 2010 Peter Johansson
     5  Copyright (C) 2009, 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "Option.h"
  • trunk/yat/OptionHelp.cc

    r1463 r1556  
    1 // $Id: OptionHelp.cc 2384 2010-12-22 14:03:36Z peter $
     1// $Id: OptionHelp.cc 2919 2012-12-19 06:54:23Z peter $
    22
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    5   Copyright (C) 2009, 2010 Peter Johansson
     5  Copyright (C) 2009, 2010, 2012 Peter Johansson
    66
    77  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2121*/
     22
     23#include <config.h>
    2224
    2325#include "OptionHelp.h"
  • trunk/yat/OptionSwitch.cc

    r1463 r1556  
    1 // $Id: OptionSwitch.cc 2119 2009-12-12 23:11:43Z peter $
     1// $Id: OptionSwitch.cc 2919 2012-12-19 06:54:23Z peter $
    22
    33/*
    44  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
     5  Copyright (C) 2012 Peter Johansson
    56
    67  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    1920  along with yat. If not, see <http://www.gnu.org/licenses/>.
    2021*/
     22
     23#include <config.h>
    2124
    2225#include "OptionSwitch.h"
  • trunk/yat/config_public.h.in

    r1463 r1556  
    22#define _theplu_yat_utility_config_public_
    33
    4 // $Id: config_public.h.in 2673 2011-12-03 00:30:12Z peter $
     4// $Id: config_public.h.in 2943 2013-01-04 06:38:38Z peter $
    55
    66/*
    77  Copyright (C) 2008 Jari Häkkinen, Peter Johansson
    8   Copyright (C) 2009, 2011 Peter Johansson
     8  Copyright (C) 2009, 2011, 2012 Peter Johansson
    99
    1010  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2828///
    2929
     30/// Define to 1 if you have the <bam/bam.h> header file.
     31#undef HAVE_BAM_BAM_H
     32
     33/// Define to 1 if you have the <bam.h> header file.
     34#undef HAVE_BAM_H
     35
     36/// Define if samtools executable is available
     37#undef HAVE_SAMTOOLS
     38
    3039/// Define if compiler supports deprecated attribute, as in g++ 4.0
    3140#undef YAT_HAVE_GCC_DEPRECATED
  • trunk/yat/split.cc

    r1463 r1556  
    1 // $Id: split.cc 2434 2011-03-08 16:52:23Z peter $
     1// $Id: split.cc 2881 2012-11-18 01:28:05Z peter $
    22
    33/*
    4   Copyright (C) 2010 Peter Johansson
     4  Copyright (C) 2010, 2012 Peter Johansson
    55
    66  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    2020*/
    2121
     22#include <config.h>
     23
    2224#include "split.h"
    2325
     
    2931namespace utility {
    3032
    31   void split(std::vector<std::string>& vec, const std::string& str, char delim)
     33namespace detail {
     34
     35  /*
     36    implementation of split functions is declared in private namespace
     37    and only available in this file.
     38   */
     39  template<typename T>
     40  void split(std::vector<std::string>& vec, const std::string& str, T delim)
    3241  {
    3342    size_t pos=0;
     
    4049    }
    4150  }
     51} // end of namespace detail
     52
     53
     54  void split(std::vector<std::string>& vec, const std::string& str, char delim)
     55  {
     56    detail::split(vec, str, delim);
     57  }
     58
     59
     60  void split(std::vector<std::string>& vec, const std::string& str,
     61             const std::string& delim)
     62  {
     63    detail::split(vec, str, delim);
     64  }
    4265
    4366}}} // of namespace utility, yat, and theplu
  • trunk/yat/split.h

    r1463 r1556  
    11#ifndef _theplu_yat_utility_split_
    2 #define _theplu_yat_utility_split_ 
     2#define _theplu_yat_utility_split_
    33
    4 // $Id: split.h 2434 2011-03-08 16:52:23Z peter $
     4// $Id: split.h 2898 2012-12-12 05:13:02Z peter $
    55
    66/*
    7   Copyright (C) 2010 Peter Johansson
     7  Copyright (C) 2010, 2012 Peter Johansson
    88
    99  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3636     result. If \a str contains N \a delim, the resulting \a result
    3737     will hold N+1 elements (given that it was empty to start
    38      with). If first or loast character in \a str is \a delim,
     38     with). If first or last character in \a str is \a delim,
    3939     corresponding element in \a result will be empty string ("").
    4040
    4141     \since New in yat 0.7
    4242   */
    43   void split(std::vector<std::string>& result, const std::string& str, 
     43  void split(std::vector<std::string>& result, const std::string& str,
    4444             char delim);
     45
     46  /**
     47     \brief split a string into substrings
     48
     49     Same as
     50     void split(std::vector<std::string>&, const std::string&,char delim);
     51     but split if character matches any in delims, i.e.,
     52     split(vec,"split,me;please", ",;") will be split into "split",
     53     "me", and "please".
     54
     55     \since New in yat 0.10
     56   */
     57  void split(std::vector<std::string>& result, const std::string& str,
     58             const std::string& delim);
    4559
    4660}}} // of namespace utility, yat, and theplu
  • trunk/yat/utility.h

    r1512 r1556  
    11#ifndef _theplu_yat_utility_utility_
    2 #define _theplu_yat_utility_utility_ 
    3 
    4 // $Id: utility.h 2820 2012-08-30 00:47:58Z peter $
     2#define _theplu_yat_utility_utility_
     3
     4// $Id: utility.h 2943 2013-01-04 06:38:38Z peter $
    55
    66/*
     
    88  Copyright (C) 2006 Jari Häkkinen
    99  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
    10   Copyright (C) 2009, 2010, 2011, 2012 Peter Johansson
     10  Copyright (C) 2009, 2010, 2011, 2012, 2013 Peter Johansson
    1111
    1212  This file is part of the yat library, http://dev.thep.lu.se/yat
     
    3535#include "Exception.h"
    3636#include "yat_assert.h"
     37
     38#include <gsl/gsl_math.h>
    3739
    3840#include <algorithm>
     
    5456
    5557  /**
     58     Same as posix C function with same name but works on \c
     59     std::string rather than \c char*.
     60
     61     \see http://linux.die.net/man/3/basename
     62
     63     \return everything after last '/'
     64
     65     \since New in yat 0.10
     66   */
     67  std::string basename(const std::string& fn);
     68
     69  /**
    5670     For each element in resulting range assign it to 0.0 if
    5771     corresponding element in input range is NaN else assign it to
     
    6478  */
    6579  template<typename InputIterator, typename OutputIterator>
    66   bool binary_weight(InputIterator first, InputIterator last, 
     80  bool binary_weight(InputIterator first, InputIterator last,
    6781                     OutputIterator result);
    6882
    6983  /**
     84     Same as C function \c chdir but throws on failure (instead of
     85     retrning non-zero).
     86
     87     \throw runtime_error if underlying chdir returns non-zero
     88
     89     \see http://linux.die.net/man/3/chdir
     90
     91     \since New in yat 0.10
     92   */
     93  void chdir(const std::string& dir);
     94
     95  /**
     96     same as C function \c chmod but throws on failure (instead of
     97     returning non-zero).
     98
     99     \see http://linux.die.net/man/3/chmod
     100
     101     \since New in yat 0.10
     102   */
     103  void chmod(const std::string& filename, mode_t mode);
     104
     105  /**
    70106     \brief convert T to a string
    71107
     
    84120  template<typename T>
    85121  T convert(const std::string& s);
     122
     123  /**
     124     @brief Copy file \a source to \a target.
     125
     126     @throw runtime_error if read error of \a source or write error
     127     for \a target is encountered.
     128  */
     129  void copy_file(const std::string& source, const std::string& target);
     130
     131  /**
     132     Same as posix C function with same name but works on \c
     133     std::string rather than \c char*.
     134
     135     \see http://linux.die.net/man/3/dirname
     136
     137     \return everything prior last '/'.
     138
     139     \since New in yat 0.10
     140   */
     141  std::string dirname(const std::string& fn);
     142
     143  /**
     144     \return true if \a str matches \a pattern
     145
     146     \see http://linux.die.net/man/3/fnmatch
     147
     148     \throw runtime_error if returned value from underlying fnmatch is
     149     neither zero nor \c FNM_NOMATCH.
     150
     151     \since New in yat 0.10
     152  */
     153  bool fnmatch(const std::string& pattern, const std::string& str,
     154               int flags=0);
    86155
    87156  /**
     
    194263  template<typename T>
    195264  void load(std::istream& is, std::vector<T>& vec, char sep='\0');
    196  
     265
     266  /**
     267     \return base-2 logarithm of x
     268
     269     \since New in yat 0.10
     270   */
     271  // c++11 provides std::log2 so perhaps we should call that one if
     272  // availalable (but a bit tricky since this is a public header)
     273  template<typename T>
     274  T log2(T x) { return std::log(x)/M_LN2; }
     275
    197276// private namespace
    198277namespace detail {
     
    250329} // end of namespace detail
    251330
     331
     332  /**
     333     \brief create a directory \a dir
     334
     335     \see http://linux.die.net/man/3/mkdir
     336
     337     \throw runtime_error if creation failed
     338   */
     339  void mkdir(const std::string& dir, mode_t mode=0777);
     340
     341  /**
     342     Similar to mkdir(const std::string&, mode_t).
     343
     344     No error if \a dir already exist. Make parent directories as needed.
     345   */
     346  void mkdir_p(const std::string& dir, mode_t mode=0777);
     347
     348  /**
     349     same as C function remove but throws errno_error at failure
     350
     351     \see http://linux.die.net/man/3/remove
     352   */
     353  void remove(const std::string& fn);
     354
     355  /**
     356     same as C function with same name but throws errno_error if error
     357     is encountered
     358
     359     \see http://linux.die.net/man/3/rename
     360
     361     \since New in yat 0.10
     362   */
     363  void rename(const std::string& from, const std::string to);
     364
     365  /**
     366     In \a full_str replace every sub-string \a old_str with \a
     367     new_str;
     368   */
     369  void replace(std::string& full_str, std::string old_str, std::string new_str);
    252370
    253371  // template implementations
     
    350468      pusher(element, vec);
    351469    }
    352   }           
    353 
     470  }
    354471
    355472namespace detail {
Note: See TracChangeset for help on using the changeset viewer.