YARP
Yet Another Robot Platform
singleapploader.cpp
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * All rights reserved.
4  *
5  * This software may be modified and distributed under the terms of the
6  * BSD-3-Clause license. See the accompanying LICENSE file for details.
7  */
8 
10 #include <yarp/manager/utility.h>
11 
12 
13 using namespace std;
14 using namespace yarp::manager;
15 
16 
17 SingleAppLoader::SingleAppLoader(const char* szModule, const char* szHost)
18 {
19  if(szModule) strModule = szModule;
20  if(szHost) strHost = szHost;
21 }
22 
23 
24 SingleAppLoader::~SingleAppLoader() = default;
25 
26 
27 bool SingleAppLoader::init()
28 {
29  ErrorLogger* logger = ErrorLogger::Instance();
30  app.clear();
31  if(strModule.empty())
32  {
33  logger->addError("Empty module name.");
34  return false;
35  }
36 
37  app.setName(strModule.c_str());
38  ModuleInterface module(strModule.c_str());
39  module.setHost(strHost.c_str());
40  app.addImodule(module);
41  return true;
42 }
43 
44 
45 void SingleAppLoader::fini()
46 {
47  app.clear();
48 }
49 
50 
51 Application* SingleAppLoader::getNextApplication()
52 {
53  return &app;
54 }
yarp::manager::Application
Class Application.
Definition: application.h:292
yarp::manager
Definition: application.h:24
yarp::manager::ErrorLogger
Singleton class ErrorLogger.
Definition: utility.h:60
singleapploader.h
utility.h
yarp::manager::ModuleInterface
Class ModuleInterface.
Definition: application.h:164
yarp::manager::ErrorLogger::addError
void addError(const char *szError)
Definition: utility.cpp:121
module
static RFModule * module
Definition: RFModule.cpp:234