Go to the documentation of this file.
12 #ifndef RTCTK_COMPONENTFRAMEWORK_DETAIL_RTCCOMPONENT_HPP
13 #define RTCTK_COMPONENTFRAMEWORK_DETAIL_RTCCOMPONENT_HPP
16 #include <boost/core/demangle.hpp>
17 #include <boost/program_options.hpp>
18 #include <mal/Cii.hpp>
34 "' not set, use -h for help") {
40 Args(
int argc,
char** argv) : m_argc(argc), m_argv(argv) {
45 return vm[
"cid"].as<std::string>();
49 return vm[
"sde"].as<elt::mal::Uri>();
53 if (vm.count(
"lpf")) {
54 return {vm[
"lpf"].as<elt::mal::Uri>()};
61 if (vm.count(
"emf")) {
62 return {vm[
"emf"].as<elt::mal::Uri>()};
70 namespace bpo = boost::program_options;
71 using ::elt::mal::Uri;
73 bpo::positional_options_description pos_opts_desc;
74 pos_opts_desc.add(
"cid", 1);
75 pos_opts_desc.add(
"sde", 1);
77 bpo::options_description opts_desc(
"Options");
78 opts_desc.add_options()
79 (
"help,h",
"print help messages")
80 (
"cid,i", bpo::value<std::string>(),
"component identity")
81 (
"sde,s", bpo::value<Uri>(),
"service discovery endpoint (URI)")
82 (
"lpf,l", bpo::value<Uri>(),
"log4cplus properties file (URI)")
83 (
"emf,e", bpo::value<Uri>(),
"export state machine model to file (URI)");
85 bpo::store(bpo::command_line_parser(m_argc, m_argv)
87 .positional(pos_opts_desc)
93 if (vm.count(
"help")) {
95 ss << opts_desc << std::endl;
99 if (!vm.count(
"cid")) {
100 CII_THROW(ArgNotSet,
"component identity");
103 if (!vm.count(
"sde")) {
104 CII_THROW(ArgNotSet,
"service discovery endpoint");
111 boost::program_options::variables_map vm;
115 return boost::core::demangle(tid.name());
120 #endif // RTCTK_COMPONENTFRAMEWORK_DETAIL_RTCCOMPONENT_HPP
std::string GetTypeName(const std::type_info &tid)
Definition: rtcComponent.hpp:114
Definition: rtcComponent.hpp:24
Provides macros and utilities for exception handling.
Definition: rtcComponent.hpp:30
Definition: rtcComponent.hpp:22
Definition: rtcComponent.hpp:38
The RtctkException class is the base class for all Rtctk exceptions.
Definition: exceptions.hpp:207
ArgNotSet(const std::string &arg_name)
Definition: rtcComponent.hpp:32
std::string GetComponentName() const
Definition: rtcComponent.hpp:44
HelpOnly(const std::string &help_text)
Definition: rtcComponent.hpp:26
elt::mal::Uri GetServiceDiscEndpoint() const
Definition: rtcComponent.hpp:48
std::optional< elt::mal::Uri > GetModelExportFile() const
Definition: rtcComponent.hpp:60
Args(int argc, char **argv)
Definition: rtcComponent.hpp:40
Definition: agnostictopicifPubSubTypes.cpp:31
std::optional< elt::mal::Uri > GetLogPropsFile() const
Definition: rtcComponent.hpp:52