command-arguments.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_TOOLS_NFDC_COMMAND_ARGUMENTS_HPP
27 #define NFD_TOOLS_NFDC_COMMAND_ARGUMENTS_HPP
28 
29 #include "core/common.hpp"
30 #include <boost/any.hpp>
31 
32 namespace nfd {
33 namespace tools {
34 namespace nfdc {
35 
38 class CommandArguments : public std::map<std::string, boost::any>
39 {
40 public:
43  template<typename T>
44  T
45  get(const std::string& key, const T& defaultValue = T()) const
46  {
47  auto i = find(key);
48  return i == end() ? defaultValue : boost::any_cast<T>(i->second);
49  }
50 };
51 
52 } // namespace nfdc
53 } // namespace tools
54 } // namespace nfd
55 
56 #endif // NFD_TOOLS_NFDC_COMMAND_ARGUMENTS_HPP
Copyright (c) 2014-2015, Regents of the University of California, Arizona Board of Regents...
Definition: algorithm.hpp:32
contains named command arguments