TPIE

11a2c2d
file_manager.h
1 // -*- mode: c++; tab-width: 4; indent-tabs-mode: t; eval: (progn (c-set-style "stroustrup") (c-set-offset 'innamespace 0)); -*-
2 // vi:set ts=4 sts=4 sw=4 noet :
3 //
4 // Copyright 2011, The TPIE development team
5 //
6 // This file is part of TPIE.
7 //
8 // TPIE is free software: you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License as published by the
10 // Free Software Foundation, either version 3 of the License, or (at your
11 // option) any later version.
12 //
13 // TPIE is distributed in the hope that it will be useful, but WITHOUT ANY
14 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16 // License for more details.
17 //
18 // You should have received a copy of the GNU Lesser General Public License
19 // along with TPIE. If not, see <http://www.gnu.org/licenses/>
20 
24 
25 #ifndef __TPIE_FILE_MANAGER_H__
26 #define __TPIE_FILE_MANAGER_H__
27 
28 #include <tpie/tpie_export.h>
29 #include <tpie/config.h>
30 #include <tpie/util.h>
31 #include <tpie/resource_manager.h>
32 
33 namespace tpie {
34 
38 class TPIE_EXPORT file_manager final : public resource_manager {
39 public:
44  file_manager();
45 
46  void increment_open_file_count() {
47  register_increased_usage(1);
48  }
49 
50  void decrement_open_file_count() {
51  register_decreased_usage(1);
52  }
53 
54  std::string amount_with_unit(size_t amount) const override;
55 
56 protected:
57  void throw_out_of_resource_error(const std::string & s) override;
58 };
59 
63 void init_file_manager();
64 
68 void finish_file_manager();
69 
75 TPIE_EXPORT file_manager & get_file_manager();
76 
77 } //namespace tpie
78 
79 #endif //__TPIE_MEMORY_H__
tpie::finish_file_manager
void finish_file_manager()
Used by tpie_finish to deinitialize the file manager.
tpie::init_file_manager
void init_file_manager()
Used by tpie_init to initialize the file manager.
tpie::resource_manager
Resource management object used to track resource usage.
Definition: resource_manager.h:38
tpie::file_manager
File management object used to track file usage.
Definition: file_manager.h:38
util.h
tpie::get_file_manager
TPIE_EXPORT file_manager & get_file_manager()
Return a reference to the file manager.
tpie
Definition: access_type.h:26