Decoupled.cpp
Go to the documentation of this file.
1#include "Decoupled.h"
2
5
6namespace 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
Baseclass for all ArmarX applications.
static void setInstance(ApplicationPtr const &inst)
#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...
::IceInternal::Handle<::Ice::Properties > PropertiesPtr
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceUtil::Handle< ManagedIceObjectRegistryInterface > ManagedIceObjectRegistryInterfacePtr
Definition Application.h:83
int DecoupledMain(int argc, char *argv[])
Definition Decoupled.cpp:48
armarx::ComponentPtr CreateComponentFunction(Ice::PropertiesPtr properties, std::string const &configName, std::string const &configDomain)
Definition Decoupled.h:12
void setup(const armarx::ManagedIceObjectRegistryInterfacePtr &registry, Ice::PropertiesPtr properties) override
Setup method to be implemented by user applications.
Definition Decoupled.cpp:27
static bool setCreateComponentFunction(CreateComponentFunction *function, std::string const &name)
Definition Decoupled.cpp:13
#define ARMARX_TRACE
Definition trace.h:77