Skip to content
Snippets Groups Projects
Commit a11e5606 authored by Auke Klazema's avatar Auke Klazema
Browse files

Task #10253: Placed construction in constructors

parent 9482779b
Branches
Tags
No related merge requests found
......@@ -29,7 +29,7 @@ namespace LOFAR {
using namespace std;
void Program::init()
Program::Program()
{
try
{
......@@ -42,24 +42,26 @@ void Program::init()
HotLinkWaitForAnswerFactoryImpl factory(*toBus, dataPointNameResolver);
winCCWrapper.reset(new WinCCWrapperImpl(factory));
winCCWrapper->init();
winCCWrapper->connect_datapoints(publisherResources.getDataPoints());
}
catch (std::exception &e)
{
std::cerr << e.what() << std::endl;
Manager::exit(0);
throw;
}
}
void Program::run()
Program::~Program()
{
winCCWrapper->run();
Manager::exit(0);
}
void Program::exit()
void Program::run()
{
Manager::exit(0);
winCCWrapper->run();
}
} // namespace WINCCSERVICES
......
......@@ -33,9 +33,10 @@ namespace LOFAR {
class Program
{
public:
void init();
Program();
~Program();
void run();
void exit();
private:
ConfigReaderImpl configReader;
DataPointNameResolverImpl dataPointNameResolver;
......
......@@ -25,9 +25,7 @@ int main()
{
Program program;
program.init();
program.run();
program.exit();
return 0;
}
\ No newline at end of file
......@@ -31,7 +31,6 @@ namespace LOFAR {
class WinCCWrapper
{
public:
virtual void init() = 0;
virtual bool connect_datapoints(const std::vector<std::string> &datapoints) = 0;
virtual void run() = 0;
};
......
......@@ -26,12 +26,13 @@ namespace LOFAR {
using namespace std;
PVSSboolean WinCCWrapperImpl::doExit = PVSS_FALSE;
bool WinCCWrapperImpl::doExit = false;
WinCCWrapperImpl::WinCCWrapperImpl(HotLinkWaitForAnswerFactory &factory) :
Manager(ManagerIdentifier(API_MAN, Resources::getManNum())),
factory(factory)
{
init();
}
void WinCCWrapperImpl::init()
......@@ -113,7 +114,7 @@ void WinCCWrapperImpl::signalHandler(int sig)
{
if ((sig == SIGINT) || (sig == SIGTERM))
{
WinCCWrapperImpl::doExit = PVSS_TRUE;
WinCCWrapperImpl::doExit = true;
}
else
{
......
......@@ -36,13 +36,14 @@ class WinCCWrapperImpl : public WinCCWrapper, public Manager
{
public:
WinCCWrapperImpl(HotLinkWaitForAnswerFactory &factory);
void init();
bool connect_datapoints(const std::vector<std::string> &dataPoints);
void run();
virtual void signalHandler(int sig);
private:
static PVSSboolean doExit;
void init();
static bool doExit;
const HotLinkWaitForAnswerFactory& factory;
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment