[DEV] add an init needed for enet
This commit is contained in:
parent
7a0e0ab117
commit
c6a592592a
@ -35,6 +35,7 @@ def configure(target, my_module):
|
||||
])
|
||||
my_module.add_path(".")
|
||||
my_module.add_src_file([
|
||||
'zeus/zeus.cpp',
|
||||
'zeus/AbstractFunction.cpp',
|
||||
'zeus/FutureBase.cpp',
|
||||
'zeus/Future.cpp',
|
||||
@ -57,6 +58,7 @@ def configure(target, my_module):
|
||||
'zeus/mineType.cpp',
|
||||
])
|
||||
my_module.add_header_file([
|
||||
'zeus/zeus.hpp',
|
||||
'zeus/AbstractFunction.hpp',
|
||||
'zeus/AbstractFunctionTypeDirect.hpp',
|
||||
'zeus/AbstractFunctionTypeClass.hpp',
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <zeus/ServiceRemote.hpp>
|
||||
#include <zeus/mineType.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <etk/os/FSNode.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
@ -16,6 +17,7 @@
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
zeus::init(_argc, _argv);
|
||||
zeus::Client client1;
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <appl/debug.hpp>
|
||||
#include <zeus/Service.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
@ -70,6 +71,7 @@ namespace appl {
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
zeus::init(_argc, _argv);
|
||||
ememory::SharedPtr<appl::UserManager> userMng = ememory::makeShared<appl::UserManager>();
|
||||
zeus::ServiceType<appl::Calculator, appl::UserManager> serviceInterface(userMng);
|
||||
serviceInterface.setDescription("Calculator interface");
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <zeus/Service.hpp>
|
||||
#include <zeus/File.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <unistd.h>
|
||||
#include <mutex>
|
||||
#include <ejson/ejson.hpp>
|
||||
@ -373,6 +374,7 @@ namespace appl {
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
zeus::init(_argc, _argv);
|
||||
std::string ip;
|
||||
uint16_t port = 0;
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
|
@ -7,12 +7,14 @@
|
||||
#include <appl/debug.hpp>
|
||||
#include <appl/GateWay.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <etk/stdTools.hpp>
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
zeus::init(_argc, _argv);
|
||||
appl::GateWay basicGateway;
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
std::string data = _argv[iii];
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <appl/debug.hpp>
|
||||
#include <zeus/Service.hpp>
|
||||
#include <etk/etk.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
#include <unistd.h>
|
||||
#include <mutex>
|
||||
#include <ejson/ejson.hpp>
|
||||
@ -177,6 +178,7 @@ namespace appl {
|
||||
|
||||
int main(int _argc, const char *_argv[]) {
|
||||
etk::init(_argc, _argv);
|
||||
zeus::init(_argc, _argv);
|
||||
std::string ip;
|
||||
uint16_t port = 0;
|
||||
for (int32_t iii=0; iii<_argc ; ++iii) {
|
||||
|
41
zeus/zeus.cpp
Normal file
41
zeus/zeus.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#include <enet/enet.hpp>
|
||||
#include <zeus/debug.hpp>
|
||||
#include <zeus/zeus.hpp>
|
||||
|
||||
static bool& getInitSatatus() {
|
||||
static bool isInit = false;
|
||||
return isInit;
|
||||
}
|
||||
|
||||
void zeus::init(int _argc, const char** _argv) {
|
||||
for (int32_t iii=0; iii<_argc; ++iii) {
|
||||
std::string value = _argv[iii];
|
||||
if (etk::start_with(value, "--zeus") == true) {
|
||||
ZEUS_ERROR("Unknow parameter type: '" << value << "'");
|
||||
}
|
||||
}
|
||||
if (getInitSatatus() == false) {
|
||||
enet::init(_argc, _argv);
|
||||
getInitSatatus() = true;
|
||||
}
|
||||
}
|
||||
|
||||
void zeus::unInit() {
|
||||
if (getInitSatatus() == false) {
|
||||
ZEUS_ERROR("Request UnInit of enent already done ...");
|
||||
} else {
|
||||
enet::unInit();
|
||||
}
|
||||
getInitSatatus() = false;
|
||||
}
|
||||
|
||||
|
||||
bool zeus::isInit() {
|
||||
return getInitSatatus();
|
||||
}
|
||||
|
24
zeus/zeus.hpp
Normal file
24
zeus/zeus.hpp
Normal file
@ -0,0 +1,24 @@
|
||||
/** @file
|
||||
* @author Edouard DUPIN
|
||||
* @copyright 2016, Edouard DUPIN, all right reserved
|
||||
* @license APACHE v2.0 (see license file)
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
namespace zeus {
|
||||
/**
|
||||
* @brief Initialize zeus
|
||||
* @param[in] _argc Number of argument list
|
||||
* @param[in] _argv List of arguments
|
||||
*/
|
||||
void init(int _argc, const char** _argv);
|
||||
/**
|
||||
* @brief un-Initialize zeus
|
||||
*/
|
||||
void unInit();
|
||||
/**
|
||||
* @brief Check if the library zeus is initialized
|
||||
* @return bool value to chek if initialize ot not
|
||||
*/
|
||||
bool isInit();
|
||||
}
|
Loading…
Reference in New Issue
Block a user