Cambridge SMT System
main.hifst-client.init_param_options.hpp
Go to the documentation of this file.
1 // Licensed under the Apache License, Version 2.0 (the "License");
2 // you may not use these files except in compliance with the License.
3 // You may obtain a copy of the License at
4 //
5 // http://www.apache.org/licenses/LICENSE-2.0
6 //
7 // Unless required by applicable law or agreed to in writing, software
8 // distributed under the License is distributed on an "AS IS" BASIS,
9 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 // See the License for the specific language governing permissions and
11 // limitations under the License.
12 
13 // Copyright 2012 - Gonzalo Iglesias, AdriĆ  de Gispert, William Byrne
14 
21 namespace ucam {
22 namespace util {
23 
24 namespace po = boost::program_options;
25 
39 inline void init_param_options ( int argc, const char* argv[],
40  po::variables_map *vm ) {
41  try {
42  po::options_description desc ( "Command-line/configuration file options" );
43  desc.add_options()
44  ( HifstConstants::kRangeExtended.c_str(), po::value<std::string>(),
45  "Indices of sentences to translate" )
46  // ( HifstConstants::kNThreads.c_str(), po::value<uint>(), "Number of threads (trimmed to number of cpus in the machine) " )
47  ( HifstConstants::kHifstHost.c_str(), po::value<std::string>(),
48  "Server Host machine " )
49  ( HifstConstants::kHifstPort.c_str(), po::value<std::string>(), "Server Port" )
50  ( HifstConstants::kSourceLoad.c_str(), po::value<std::string>(),
51  "Source text file " )
52  ( HifstConstants::kTargetStore.c_str(), po::value<std::string>(),
53  "Target text file " )
54  ;
55  parseOptionsGeneric (desc, vm, argc, argv);
56  } catch ( std::exception& e ) {
57  cerr << "error: " << e.what() << "\n";
58  exit ( EXIT_FAILURE );
59  } catch ( ... ) {
60  cerr << "Exception of unknown type!\n";
61  exit ( EXIT_FAILURE );
62  }
63  LINFO ( "Configuration loaded" );
64 };
65 
66 }
67 } // end namespaces
void parseOptionsGeneric(bpo::options_description &desc, bpo::variables_map *vm, int argc, const char *argv[])
Definition: registrypo.hpp:58
void init_param_options(int argc, const char *argv[], po::variables_map *vm)
Function to initialize boost program_options module with command-line and config file options...
#define LINFO(msg)
const std::string kHifstHost
const std::string kTargetStore
const std::string kHifstPort
std::string const kRangeExtended
List of constants to be used both across program options and class runners.
const std::string kSourceLoad
Definition: bleu.hpp:14