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 
13  std::string const& name)
14  {
15  global_createComponent = function;
16  global_name = name;
17  return global_createComponent != nullptr;
18  }
19 
21  {
22  std::string appConfigName;
23  std::string appConfigDomain;
24 
26  Ice::PropertiesPtr properties) override
27  {
29 
30  ARMARX_CHECK_NOT_NULL(registry);
31  ARMARX_CHECK_NOT_NULL(global_createComponent)
32  << "Component not registered! "
33  << "Make sure that the macro "
34  << "`ARMARX_REGISTER_COMPONENT_EXECUTABLE(YourComponentName, YourComponentName::GetDefaultName());` "
35  << "is present in the component source file! "
36  << "(If necessary, add the static function `GetDefaultName()` to your component class.)";
37 
38 
39  registry->addObject(global_createComponent(properties, "", appConfigDomain));
40  }
41  };
42 
43  int DecoupledMain(int argc, char* argv[])
44  {
45  std::string configName = "";
46  std::string configDomain = "ArmarX";
47  bool enableLibLoading = false;
48 
51 
52  app->appConfigDomain = configDomain;
53  app->appConfigName = configName;
54  app->enableLibLoading(enableLibLoading);
55  app->setName(global_name);
56  app->storeCommandLineArguments(argc, argv);
57  return app->main(argc, argv);
58  }
59 
60 }
armarx::Decoupled::setCreateComponentFunction
static bool setCreateComponentFunction(CreateComponentFunction *function, std::string const &name)
Definition: Decoupled.cpp:12
armarx::DecoupledSingleComponentApp::setup
void setup(const armarx::ManagedIceObjectRegistryInterfacePtr &registry, Ice::PropertiesPtr properties) override
Setup method to be implemented by user applications.
Definition: Decoupled.cpp:25
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:23
IceInternal::Handle< ::Ice::Properties >
armarx::DecoupledSingleComponentApp::appConfigName
std::string appConfigName
Definition: Decoupled.cpp:22
ARMARX_TRACE
#define ARMARX_TRACE
Definition: trace.h:69
armarx::Application::setInstance
static void setInstance(ApplicationPtr const &inst)
Definition: Application.cpp:297
armarx::Application
Baseclass for all ArmarX applications.
Definition: Application.h:193
Decoupled.h
IceUtil::Handle< ManagedIceObjectRegistryInterface >
armarx::DecoupledSingleComponentApp
Definition: Decoupled.cpp:20
armarx::DecoupledMain
int DecoupledMain(int argc, char *argv[])
Definition: Decoupled.cpp:43
ManagedIceObjectRegistryInterface.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
Application.h