Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
9ef053dd
Commit
9ef053dd
authored
Nov 02, 2020
by
legoc
Browse files
(split) Added This init with name and endpoint to facilitate unmanaged applications
parent
6238bc83
Changes
2
Show whitespace changes
Inline
Side-by-side
include/Application.h
View file @
9ef053dd
...
...
@@ -128,6 +128,7 @@ public:
~
This
();
static
void
init
(
int
argc
,
char
*
argv
[]);
static
void
init
(
const
std
::
string
&
name
,
const
std
::
string
&
endpoint
);
/**
* The terminate call is not necessary unless the static instance of This is not destroyed automatically.
...
...
@@ -171,6 +172,7 @@ public:
private:
void
initApplication
(
int
argc
,
char
*
argv
[]);
void
initApplication
(
const
std
::
string
&
name
,
const
std
::
string
&
endpoint
);
static
State
parseState
(
const
std
::
string
&
value
);
State
getState
(
int
id
)
const
;
...
...
src/Application.cpp
View file @
9ef053dd
...
...
@@ -115,6 +115,12 @@ void This::init(int argc, char *argv[]) {
}
}
void
This
::
init
(
const
std
::
string
&
name
,
const
std
::
string
&
endpoint
)
{
if
(
m_instance
.
m_impl
==
nullptr
)
{
m_instance
.
initApplication
(
name
,
endpoint
);
}
}
void
This
::
terminate
()
{
// Test if termination is already done.
...
...
@@ -206,6 +212,47 @@ void This::initApplication(int argc, char *argv[]) {
setName
(
m_name
);
m_server
->
registerEventListener
(
this
);
// Init com.
m_com
=
unique_ptr
<
Com
>
(
new
Com
(
m_server
.
get
(),
m_id
));
}
void
This
::
initApplication
(
const
std
::
string
&
name
,
const
std
::
string
&
endpoint
)
{
Services
::
init
();
// Get the server endpoint.
m_serverEndpoint
=
Endpoint
::
parse
(
endpoint
);
// Create the request socket. The server endpoint has been defined.
Services
::
initRequestSocket
();
// Retrieve the server version.
Services
::
retrieveServerVersion
();
// Get the name.
m_name
=
name
;
// The application is de-facto unmanaged.
m_managed
=
false
;
int
id
=
initUnmanagedApplication
();
if
(
id
==
-
1
)
{
throw
UnmanagedApplicationException
(
string
(
"Maximum number of applications "
)
+
m_name
+
" reached"
);
}
m_id
=
id
;
// Must be here because the server endpoint is required.
initStatus
();
// Create the local server.
m_server
=
unique_ptr
<
Server
>
(
new
Server
(
m_serverEndpoint
));
// Create the waiting set.
m_waitingSet
=
unique_ptr
<
WaitingImplSet
>
(
new
WaitingImplSet
());
// Init listener.
setName
(
m_name
);
m_server
->
registerEventListener
(
this
);
// Init com.
m_com
=
unique_ptr
<
Com
>
(
new
Com
(
m_server
.
get
(),
m_id
));
...
...
Shervin Nourbakhsh
@nourbakhsh
mentioned in commit
46e44691
·
Apr 23, 2021
mentioned in commit
46e44691
mentioned in commit 46e44691a03808a23a464818487b0dd014a9c57e
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment