Savarese Software Research Corporation
ServiceMainOptions.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2006-2009 Savarese Software Research Corporation
00003  *
00004  * Licensed under the Apache License, Version 2.0 (the "License");
00005  * you may not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  *     https://www.savarese.com/software/ApacheLicense-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an "AS IS" BASIS,
00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 
00022 #ifndef __SSRC_WSPR_UTILITY_SERVICE_MAIN_OPTIONS_H
00023 #define __SSRC_WSPR_UTILITY_SERVICE_MAIN_OPTIONS_H
00024 
00025 #include <ssrc/wispers-packages.h>
00026 #include <ssrc/wisp/utility/ServiceMainOptions.h>
00027 
00028 __BEGIN_NS_SSRC_WSPR_UTILITY
00029 
00030 class ServiceMainOptions : public NS_SSRC_WISP_UTILITY::ServiceMainOptions {
00031   typedef NS_SSRC_WISP_UTILITY::ServiceMainOptions super;
00032   boost::program_options::options_description _wspr_description;
00033 
00034 protected:
00035 
00036   ServiceMainOptions() :
00037     super(), _wspr_description("Wispers Service"),
00038     kill(false), wspr_version(false)
00039   {
00040     using namespace boost::program_options;
00041 
00042     _wspr_description.add_options()
00043       ("kill,k", value<std::string>(&name),
00044        "Send MessageStop to the specified service and exit.")
00045       ("wispers-version",
00046        "Print Wispers version with which the service was compiled.");
00047 
00048     description.add(_wspr_description);
00049   }
00050 
00051   virtual void notify(boost::program_options::variables_map & vm) {
00052     super::notify(vm);
00053     kill = (vm.count("kill") > 0);
00054     wspr_version = (vm.count("wispers-version") > 0);
00055   }
00056 
00057 public:
00058   bool kill;
00059   bool wspr_version;
00060 
00061   virtual ~ServiceMainOptions() { }
00062 };
00063 
00064 __END_NS_SSRC_WSPR_UTILITY
00065 
00066 #endif

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