DiskUsage.h

Go to the documentation of this file.
00001 // ---------------------------------------------------------------------
00002 // $Id: DiskUsage.h 214 2008-07-30 09:56:16Z daaugusto $
00003 //
00004 //   DiskUsage.h (created on Tue Aug 23 01:08:35 BRT 2005)
00005 // 
00006 //   Genetic Algorithm File Fitter (gaffitter)
00007 //
00008 //   Copyright (C) 2005-2008 Douglas A. Augusto
00009 // 
00010 // This file is part of gaffitter.
00011 // 
00012 // gaffitter is free software; you can redistribute it and/or modify it
00013 // under the terms of the GNU General Public License as published by the
00014 // Free Software Foundation; either version 3 of the License, or (at
00015 // your option) any later version.
00016 // 
00017 // gaffitter is distributed in the hope that it will be useful, but
00018 // WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00020 // General Public License for more details.
00021 // 
00022 // You should have received a copy of the GNU General Public License
00023 // along with gaffitter; if not, see <http://www.gnu.org/licenses/>.
00024 //
00025 // ---------------------------------------------------------------------
00026 
00027 #ifndef disk_usage_hh
00028 #define disk_usage_hh
00029 
00030 #include "Params.h"
00031 
00032 //----------------------------------------------------------------------
00042 class DiskUsage {
00043 public:
00050   static Params::UBigInt GetSize(const char*);
00054   static void SetBlockSize(unsigned bs) { m_block_size = bs; }
00060   static Params::UBigInt AllocationSize(Params::UBigInt);
00064   static Params::Size_t  AllocationSize(Params::Size_t size)
00065   {
00066      // instead of doing a cast to long long int (UBigInt), it is
00067      // possible to use a floor, ceil or "round" function.
00068      return AllocationSize(static_cast<Params::UBigInt>(size));
00069   }
00070 
00071 private:
00077   static Params::UBigInt DepthFirstTraversal(const char*);
00078 
00079 private:
00083   static unsigned m_block_size;
00088   static const int m_max_path_name = 4096;
00089 };
00090   
00091 //----------------------------------------------------------------------
00092 #endif