librostlab  1.0.20
umask_resource.h
Go to the documentation of this file.
1 /*
2  Copyright (C) 2011 Laszlo Kajan, Technical University of Munich, Germany
3 
4  This file is part of librostlab.
5 
6  librostlab is free software: you can redistribute it and/or modify
7  it under the terms of the GNU Lesser General Public License as published by
8  the Free Software Foundation, either version 3 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU Lesser General Public License for more details.
15 
16  You should have received a copy of the GNU Lesser General Public License
17  along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19 #ifndef ROSTLAB_UMASK_RESOURCE
20 #define ROSTLAB_UMASK_RESOURCE 1
21 
22 #include <sys/types.h>
23 #include <sys/stat.h>
24 
25 namespace rostlab {
26 
28 {
29  private:
30  mode_t _old_mode;
31  // this is a resource - disable copy contructor and copy assignment
32  umask_resource( const umask_resource& ){};
34  operator=(const umask_resource&){return *this;};
35  public:
36  umask_resource( mode_t __new_mode ) : _old_mode( umask( __new_mode ) ) {};
37  virtual ~umask_resource(){ umask( _old_mode ); }
38 };
39 
40 };
41 
42 #endif // ROSTLAB_UMASK_RESOURCE
43 // vim:et:ts=2:ai:
rostlab::umask_resource::umask_resource
umask_resource(mode_t __new_mode)
Definition: umask_resource.h:36
rostlab::umask_resource::~umask_resource
virtual ~umask_resource()
Definition: umask_resource.h:37
rostlab::umask_resource
Definition: umask_resource.h:27
rostlab
Definition: aux_functions.h:27