Debian Codegraph @

thirdparty/boost/test/ThirdpartyBoostCompile_test.cpp

raw
1 // Copyright 2019 Proyectos y Sistemas de Mantenimiento SL (eProsima).
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #include <boostconfig.hpp>
16 #include <boost/interprocess/managed_shared_memory.hpp>
17 #include <boost/interprocess/sync/interprocess_condition.hpp>
18 #include <boost/interprocess/sync/named_mutex.hpp>
19 #include <boost/interprocess/sync/interprocess_semaphore.hpp>
20 #include <boost/interprocess/offset_ptr.hpp>
21 #include <boost/thread/thread_time.hpp>
22
23 /**
24 * This is a temporary class intented to check the correct compilation of the
25 * third party boost classes that will be used in the shared-memory transport
26 * implementation
27 */
28 class ThirdpartyBoostCompileTest
29 {
30 public:
31
32 ThirdpartyBoostCompileTest()
33 {
34 boost::interprocess::named_mutex::remove("foo");
35 boost::interprocess::interprocess_semaphore sem {0};
36
37 try
38 {
39 boost::interprocess::managed_shared_memory foo(boost::interprocess::open_only, "foo");
40 }
41 catch (const std::exception&)
42 {
43 }
44
45 try
46 {
47 boost::interprocess::interprocess_mutex mutex;
48 boost::interprocess::interprocess_condition cv;
49 boost::get_system_time();
50 }
51 catch (const std::exception&)
52 {
53 }
54 }
55
56 };
57
58 int main()
59 {
60 try
61 {
62 ThirdpartyBoostCompileTest compile_test;
63 }
64 catch (const std::exception&)
65 {
66 return -1;
67 }
68
69 return 0;
70 }