Savarese Software Research Corporation
ServiceOptions.h
Go to the documentation of this file.
1 /* Copyright 2006-2013 Savarese Software Research Corporation.
2  *
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  * http://www.savarese.com/software/ApacheLicense-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
21 #ifndef __SSRC_WISP_UTILITY_SERVICE_OPTIONS_H
22 #define __SSRC_WISP_UTILITY_SERVICE_OPTIONS_H
23 
24 #include <ssrc/wisp-packages.h>
25 
26 #include <stdexcept>
27 
29 
30 template<typename CustomOptions>
31 struct ServiceOptions : public CustomOptions {
32  typedef CustomOptions super;
33 
34  bool arg_error;
35  std::string arg_error_msg;
36 
37  ServiceOptions(int argc, char *argv[]) :
38  super(), arg_error(false), arg_error_msg()
39  {
40  try {
41  this->store(argc, argv);
42  } catch(const std::invalid_argument & invalid_arg) {
43  arg_error = true;
44  arg_error_msg = invalid_arg.what();
45  }
46  }
47 
48  virtual ~ServiceOptions() = default;
49 };
50 
52 
53 #endif

Savarese Software Research Corporation
Copyright © 2006-2012 Savarese Software Research Corporation. All rights reserved.