Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Cameo
cameo
Commits
7c3b75de
Commit
7c3b75de
authored
Jul 01, 2016
by
legoc
Browse files
added missing files
parent
75d6ed62
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/cameo/InvalidArgumentException.cpp
0 → 100644
View file @
7c3b75de
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include
"InvalidArgumentException.h"
namespace
cameo
{
InvalidArgumentException
::
InvalidArgumentException
(
const
std
::
string
&
message
)
:
RemoteException
(
message
)
{
}
}
src/cameo/InvalidArgumentException.h
0 → 100644
View file @
7c3b75de
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef CAMEO_INVALIDARGUMENTEXCEPTION_H_
#define CAMEO_INVALIDARGUMENTEXCEPTION_H_
#include
"RemoteException.h"
namespace
cameo
{
class
InvalidArgumentException
:
public
RemoteException
{
public:
InvalidArgumentException
(
const
std
::
string
&
message
);
};
}
#endif
src/cameo/SocketException.cpp
0 → 100644
View file @
7c3b75de
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include
"SocketException.h"
namespace
cameo
{
SocketException
::
SocketException
(
const
std
::
string
&
message
)
:
RemoteException
(
message
)
{
}
}
src/cameo/SocketException.h
0 → 100644
View file @
7c3b75de
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef CAMEO_SOCKETEXCEPTION_H_
#define CAMEO_SOCKETEXCEPTION_H_
#include
"RemoteException.h"
namespace
cameo
{
class
SocketException
:
public
RemoteException
{
public:
SocketException
(
const
std
::
string
&
message
);
};
}
#endif
src/test/TestBadEndpoint.cpp
0 → 100644
View file @
7c3b75de
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include
<iostream>
#include
<string>
#include
<vector>
#include
<sstream>
#include
"../cameo/cameo.h"
using
namespace
std
;
using
namespace
cameo
;
int
main
(
int
argc
,
char
*
argv
[])
{
try
{
Server
server
(
"tcp://bad:7000"
);
server
.
isAvailable
(
1000
);
}
catch
(
SocketException
const
&
e
)
{
cout
<<
"Socket exception: "
<<
e
.
what
()
<<
endl
;
}
catch
(
exception
const
&
e
)
{
cout
<<
"The server has bad endpoint"
<<
endl
;
}
try
{
Server
server
(
"tcp//bad:7000"
);
server
.
isAvailable
(
1000
);
}
catch
(
exception
const
&
)
{
cout
<<
"The server has bad endpoint"
<<
endl
;
}
return
0
;
}
src/test/TestConnectionCheckerApplication.cpp
0 → 100644
View file @
7c3b75de
/*
* Copyright 2015 Institut Laue-Langevin
*
* Licensed under the EUPL, Version 1.1 only (the "License");
* You may not use this work except in compliance with the Licence.
* You may obtain a copy of the Licence at:
*
* http://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#include
<iostream>
#include
<string>
#include
<vector>
#include
<sstream>
#include
"../cameo/cameo.h"
#include
<boost/shared_ptr.hpp>
using
namespace
std
;
using
namespace
boost
;
using
namespace
cameo
;
struct
StopData
{
bool
stop
;
StopData
()
:
stop
(
false
)
{}
};
struct
Handler
{
shared_ptr
<
StopData
>
data
;
Handler
(
shared_ptr
<
StopData
>
sharedData
)
:
data
(
sharedData
)
{}
void
operator
()(
bool
available
)
{
if
(
available
)
{
cout
<<
"server is available"
<<
endl
;
}
else
{
cout
<<
"server is not available"
<<
endl
;
data
->
stop
=
true
;
}
}
};
int
main
(
int
argc
,
char
*
argv
[])
{
application
::
This
::
init
(
argc
,
argv
);
// The start function must be called into a block to ensure the destructor of Instance is called before This::terminate()
{
Server
server
(
"tcp://localhost:9000"
);
server
.
setTimeout
(
1000
);
shared_ptr
<
StopData
>
data
(
new
StopData
());
auto_ptr
<
ConnectionChecker
>
ConnectionChecker
=
server
.
createConnectionChecker
(
Handler
(
data
),
1000
);
while
(
!
data
->
stop
)
{
sleep
(
1
);
}
}
application
::
This
::
terminate
();
return
0
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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