Decoupled.cpp
Go to the documentation of this file.
1 #include "Decoupled.h"
2 
5 
6 namespace armarx
7 {
8 
9  static CreateComponentFunction* global_createComponent;
10  static std::string global_name;
11 
12  bool
14  std::string const& name)
15  {
16  global_createComponent = function;
17  global_name = name;
18  return global_createComponent != nullptr;
19  }
20 
22  {
23  std::string appConfigName;
24  std::string appConfigDomain;
25 
26  void
28  Ice::PropertiesPtr properties) override
29  {
31 
32  ARMARX_CHECK_NOT_NULL(registry);
33  ARMARX_CHECK_NOT_NULL(global_createComponent)
34  << "Component not registered! "
35  << "Make sure that the macro "
36  << "`ARMARX_REGISTER_COMPONENT_EXECUTABLE(YourComponentName, "
37  "YourComponentName::GetDefaultName());` "
38  << "is present in the component source file! "
39  << "(If necessary, add the static function `GetDefaultName()` to your component "
40  "class.)";
41 
42 
43  registry->addObject(global_createComponent(properties, "", appConfigDomain));
44  }
45  };
46 
47  int
48  DecoupledMain(int argc, char* argv[])
49  {
50  std::string configName = "";
51  std::string configDomain = "ArmarX";
52  bool enableLibLoading = false;
53 
56 
57  app->appConfigDomain = configDomain;
58  app->appConfigName = configName;
59  app->enableLibLoading(enableLibLoading);
60  app->setName(global_name);
61  app->storeCommandLineArguments(argc, argv);
62  return app->main(argc, argv);
63  }
64 
65 } // namespace armarx
armarx::Decoupled::setCreateComponentFunction
static bool setCreateComponentFunction(CreateComponentFunction *function, std::string const &name)
Definition: Decoupled.cpp:13
armarx::DecoupledSingleComponentApp::setup
void setup(const armarx::ManagedIceObjectRegistryInterfacePtr &registry, Ice::PropertiesPtr properties) override
Setup method to be implemented by user applications.
Definition: Decoupled.cpp:27
ARMARX_CHECK_NOT_NULL
#define ARMARX_CHECK_NOT_NULL(ptr)
This macro evaluates whether ptr is not null and if it turns out to be false it will throw an Express...
Definition: ExpressionException.h:206
armarx::CreateComponentFunction
armarx::ComponentPtr CreateComponentFunction(Ice::PropertiesPtr properties, std::string const &configName, std::string const &configDomain)
Definition: Decoupled.h:12
armarx::DecoupledSingleComponentApp::appConfigDomain
std::string appConfigDomain
Definition: Decoupled.cpp:24
IceInternal::Handle<::Ice::Properties >
armarx::DecoupledSingleComponentApp::appConfigName
std::string appConfigName
Definition: Decoupled.cpp:23
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:77
armarx::Application::setInstance
static void setInstance(ApplicationPtr const &inst)
Definition: Application.cpp:323
armarx::Application
Baseclass for all ArmarX applications.
Definition: Application.h:193
Decoupled.h
IceUtil::Handle< ManagedIceObjectRegistryInterface >
armarx::DecoupledSingleComponentApp
Definition: Decoupled.cpp:21
armarx::DecoupledMain
int DecoupledMain(int argc, char *argv[])
Definition: Decoupled.cpp:48
ManagedIceObjectRegistryInterface.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:27
Application.h