PageRenderTime 14ms CodeModel.GetById 9ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/src/main.cpp

https://github.com/deltaforge/nebu-app-framework-cpp
C++ | 58 lines | 42 code | 15 blank | 1 comment | 1 complexity | 0af254440badfcd2216f4d3c6527d1ed MD5 | raw file
 1
 2#include "nebu-app-framework/application.h"
 3#include "nebu-app-framework/applicationHooks.h"
 4#include "nebu-app-framework/configuration.h"
 5
 6#include <string>
 7#include <vector>
 8
 9// Using declarations - standard library
10using std::make_shared;
11using std::shared_ptr;
12using std::string;
13using std::vector;
14
15namespace nebu
16{
17	namespace app
18	{
19		namespace framework
20		{
21
22			int main(int argc, char *argv[])
23			{
24				shared_ptr<ApplicationHooks> applicationHooks = initApplication();
25				applicationHooks->registerConfigurationOptions();
26
27				vector<string> arguments;
28				for (int i = 1; i < argc; i++) {
29					arguments.push_back(argv[i]);
30				}
31				Configuration::fromArguments(arguments);
32
33				applicationHooks->prepareLogging();
34
35				applicationHooks->initialise(argv[0], arguments);
36
37				shared_ptr<Application> application = make_shared<Application>(
38						applicationHooks->getDaemonManager(),
39						applicationHooks->getTopologyManager(),
40						applicationHooks->getVMManager());
41
42				application->setApplicationHooks(applicationHooks);
43				applicationHooks->setApplication(application);
44
45				application->mainLoop();
46
47				return 0;
48			}
49
50		}
51	}
52}
53
54
55int main(int argc, char *argv[])
56{
57	return nebu::app::framework::main(argc, argv);
58}