bes Updated for version 3.21.1
The Backend Server (BES) is the lower two tiers of the Hyrax data server
BESUncompressManager3.h
1// BESUncompressManager3.h
2
3// This file is part of bes, A C++ back-end server implementation framework
4// for the OPeNDAP Data Access Protocol.
5
6// Copyright (c) 2012 OPeNDAP, Inc
7// Author: James Gallagher <jgallagher@opendap.org>
8// Based in code by Patrick West <pwest@ucar.edu> and Jose Garcia <jgarcia@ucar.edu>
9//
10// This library is free software; you can redistribute it and/or
11// modify it under the terms of the GNU Lesser General Public
12// License as published by the Free Software Foundation; either
13// version 2.1 of the License, or (at your option) any later version.
14//
15// This library is distributed in the hope that it will be useful,
16// but WITHOUT ANY WARRANTY; without even the implied warranty of
17// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18// Lesser General Public License for more details.
19//
20// You should have received a copy of the GNU Lesser General Public
21// License along with this library; if not, write to the Free Software
22// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
23//
24// You can contact University Corporation for Atmospheric Research at
25// 3080 Center Green Drive, Boulder, CO 80301
26
27#ifndef I_BESUncompressManager3_h
28#define I_BESUncompressManager3_h 1
29
30#include <map>
31#include <string>
32#include <mutex>
33
34#include "BESObj.h"
35
37
38typedef void (*p_bes_uncompress)(const std::string &src, int fd);
39
57private:
58 static BESUncompressManager3 * d_instance;
59 mutable std::recursive_mutex d_cache_lock_mutex;
60
61 static void initialize_instance();
62 static void delete_instance();
63
64 std::map<std::string, p_bes_uncompress> _uncompress_list;
65 typedef std::map<std::string, p_bes_uncompress>::const_iterator UCIter;
66
67public:
69 virtual ~BESUncompressManager3();
70
71 virtual bool add_method(const std::string &name, p_bes_uncompress method);
72 virtual p_bes_uncompress find_method(const std::string &name);
73
74 virtual bool uncompress(const std::string &src, std::string &target, BESFileLockingCache *cache);
75
76 virtual void dump(std::ostream &strm) const ;
77
78 static BESUncompressManager3 * TheManager();
79};
80
81#endif // I_BESUncompressManager3_h
Implementation of a caching mechanism for compressed data.
top level BES object to house generic methods
Definition BESObj.h:54
BESUncompressManager3()
constructs an uncompression manager adding gz, z, and bz2 uncompression methods by default.
virtual bool add_method(const std::string &name, p_bes_uncompress method)
create_and_lock a uncompress method to the list
virtual p_bes_uncompress find_method(const std::string &name)
returns the uncompression method specified
virtual bool uncompress(const std::string &src, std::string &target, BESFileLockingCache *cache)
If the file 'src' should be uncompressed, do so and return a new file name on the value-result param ...
virtual void dump(std::ostream &strm) const
dumps information about this object