DismountCmdLine.hpp 3.15 KB
Newer Older
1
2
3
/*
 * The CERN Tape Archive(CTA) project
 * Copyright(C) 2015  CERN
4
 *
5
6
7
8
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 *(at your option) any later version.
9
10
11
12
13
14
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
15
16
17
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37

#pragma once

#include "mediachanger/CmdLine.hpp"
#include "mediachanger/LibrarySlot.hpp"

#include <string>

namespace cta {
namespace mediachanger {

/**
 * Data type used to store the results of parsing the command-line.
 */
class DismountCmdLine: public CmdLine {
public:

  /**
   * Constructor.
   */
38
  DismountCmdLine();
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59

  /**
   * Constructor.
   *
   * Parses the specified command-line arguments.
   *
   * @param argc Argument count from the executable's entry function: main().
   * @param argv Argument vector from the executable's entry function: main().
   */
  DismountCmdLine(const int argc, char *const *const argv);

  /**
   * Copy constructor.
   *
   * @param obj The object to be copied.
   */
  DismountCmdLine(const DismountCmdLine &obj);

  /**
   * Destructor.
   */
60
  ~DismountCmdLine();
61
62
63
64
65
66
67
68
69
70
71
72
73

  /**
   * Assignment oprator.
   *
   * @param rhs The right-hand side of the operator.
   */
  DismountCmdLine &operator=(const DismountCmdLine &rhs);

  /**
   * Gets the usage message that describes the command line.
   *
   * @return The usage message.
   */ 
74
  static std::string getUsage();
75
76
77
78
79
80

  /**
   * Gets the value of the debug option.
   *
   * @return True if the debug option has been set.
   */
81
  bool getDebug() const;
82
83
84
85
86
87

  /**
   * Gets the value of the help option.
   *
   * @return True if the help option has been set.
   */
88
  bool getHelp() const;
89
90
91
92
93
94

  /**
   * Gets the volume identifier of the tape to be mounted.
   *
   * @return The volume identifier of the tape to be mounted.
   */
95
  const std::string &getVid() const;
96
97
98
99
100
101
102
103

  /**
   * Gets the slot in the tape library where the drive is located.
   *
   * @return The slot in the tape library where the drive is located.
   */
  const LibrarySlot &getDriveLibrarySlot() const;

104
105
106
107
108
109
110
  /**
   * Return sthe program name.
   *
   * @return sthe program name.
   */
  static std::string getProgramName();

111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
private:

  /**
   * True if the debug option has been set.
   */
  bool m_debug;

  /**
   * True if the help option has been set.
   */
  bool m_help;

  /**
   * The volume identifier of the tape to be mounted.
   */
  std::string m_vid;

  /**
   * The slot in the tape library where the drive is located.
   */
  LibrarySlot *m_driveLibrarySlot;

  /**
   * Processes the specified option that was returned by getopt_long().
   *
   * @param opt The option that was returned by getopt_long().
   */
  void processOption(const int opt);

}; // class DismountCmdLine

} // namespace mediachanger
} // namespace cta