nidas v1.2.3
FsMount.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2009, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#ifndef NIDAS_CORE_FSMOUNT_H
28#define NIDAS_CORE_FSMOUNT_H
29
30#include <nidas/util/Thread.h>
31#include <nidas/util/Process.h>
33
34#include "DOMable.h"
35
36#include <sys/mount.h>
37
38#include <string>
39#include <iostream>
40
41namespace nidas { namespace core {
42
43using namespace nidas::core;
44
45class FileSet;
47
51class FsMount : public DOMable {
52
53public:
54
55 FsMount();
56
60 FsMount(const FsMount& x);
61
63
67 FsMount& operator=(const FsMount& rhs);
68
73 void setDir(const std::string& val);
74
75 const std::string& getDir() const { return _dir; }
76
80 const std::string& getDirExpanded() const { return _dirExpanded; }
81
82 void setDevice(const std::string& val);
83
84 const std::string& getDevice() const { return _device; }
85
86 const std::string& getDeviceExpanded() const { return _deviceExpanded; }
87
88 void setType(const std::string& val)
89 {
90 _type = val;
91 }
92
93 const std::string& getType() const { return _type; }
94
95 void setOptions(const std::string& val)
96 {
97 _options = val;
98 }
99
100 const std::string& getOptions() const { return _options; }
101
105 bool isMounted();
106
112 void mount();
113
121 void autoMount();
122
130 void mount(FileSet*);
131
135 void unmount();
136
137 void cancel();
138
139 void finished();
140
144 void fromDOMElement(const xercesc::DOMElement* node);
145
146protected:
147
148 std::string _dir;
149
150 std::string _dirExpanded;
151
152 std::string _dirMsg;
153
154 std::string _device;
155
156 std::string _deviceExpanded;
157
158 std::string _deviceMsg;
159
160 std::string _type;
161
162 std::string _options;
163
165
167
169
171
173
174};
175
201
202}} // namespace nidas namespace core
203
204#endif
Interface of an object that can be instantiated from a DOM element, via the fromDOMElement method,...
Definition DOMable.h:51
Implementation of an IOChannel using an nidas::util::FileSet.
Definition FileSet.h:42
Filesystem mounter/unmounter.
Definition FsMount.h:180
FsMountWorkerThread(const FsMountWorkerThread &)
No copy.
FsMountWorkerThread & operator=(const FsMountWorkerThread &)
No assignment.
int run()
Definition FsMount.cc:327
FsMount * fsmount
Definition FsMount.h:189
FsMountWorkerThread(FsMount *fsm)
Definition FsMount.cc:321
Filesystem mounter/unmounter.
Definition FsMount.h:51
void setDir(const std::string &val)
Set the mount point directory.
Definition FsMount.cc:81
const std::string & getDir() const
Definition FsMount.h:75
void cancel()
Definition FsMount.cc:193
void setType(const std::string &val)
Definition FsMount.h:88
FsMount()
Definition FsMount.cc:41
std::string _dirExpanded
Definition FsMount.h:150
void unmount()
Definition FsMount.cc:260
void finished()
Definition FsMount.cc:250
void autoMount()
Just issue a "mount /dir" command.
Definition FsMount.cc:138
FsMountWorkerThread * _worker
Definition FsMount.h:166
void fromDOMElement(const xercesc::DOMElement *node)
Definition FsMount.cc:299
std::string _deviceMsg
Definition FsMount.h:158
FileSet * _fileset
Definition FsMount.h:164
const std::string & getDeviceExpanded() const
Definition FsMount.h:86
std::string _type
Definition FsMount.h:160
nidas::util::Mutex _workerLock
Definition FsMount.h:168
void mount()
Synchronous mount request (on return the file system is mounted).
Definition FsMount.cc:89
bool isMounted()
Reads /proc/mount to see if getDir() is mounted.
Definition FsMount.cc:285
const std::string & getType() const
Definition FsMount.h:93
const std::string & getOptions() const
Definition FsMount.h:100
std::string _options
Definition FsMount.h:162
std::string _device
Definition FsMount.h:154
void setDevice(const std::string &val)
Definition FsMount.cc:72
void setOptions(const std::string &val)
Definition FsMount.h:95
const std::string & getDevice() const
Definition FsMount.h:84
std::string _dir
Definition FsMount.h:148
FsMount & operator=(const FsMount &rhs)
Assignment.
Definition FsMount.cc:58
std::string _dirMsg
Definition FsMount.h:152
std::string _deviceExpanded
Definition FsMount.h:156
const std::string & getDirExpanded() const
Get the mount point directory, with environment variables expanded.
Definition FsMount.h:80
nidas::util::Process _mountProcess
Definition FsMount.h:170
~FsMount()
Definition FsMount.h:62
nidas::util::Process _umountProcess
Definition FsMount.h:172
A C++ wrapper for a POSIX mutex.
Definition ThreadSupport.h:161
Process provides an encapsulation of a spawned process, allowing the parent process to perform I/O wi...
Definition Process.h:58
Definition Thread.h:83
The essential core classes of nidas.
Definition A2DConverter.h:31
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31