ChimeraTK-DeviceAccess-TangoBackend 00.01.02
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
1/*----- PROTECTED REGION ID(TangoTestServer::main.cpp) ENABLED START -----*/
2/* clang-format on */
3//=============================================================================
4//
5// file : main.cpp
6//
7// description : C++ source for the TangoTestServer device server main.
8// The main rule is to initialise (and create) the Tango
9// system and to create the DServerClass singleton.
10// The main should be the same for every Tango device server.
11//
12// project : TangoTestServer
13//
14// This file is part of Tango device class.
15//
16// Tango is free software: you can redistribute it and/or modify
17// it under the terms of the GNU Lesser General Public License as published by
18// the Free Software Foundation, either version 3 of the License, or
19// (at your option) any later version.
20//
21// Tango is distributed in the hope that it will be useful,
22// but WITHOUT ANY WARRANTY; without even the implied warranty of
23// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24// GNU Lesser General Public License for more details.
25//
26// You should have received a copy of the GNU Lesser General Public License
27// along with Tango. If not, see <http://www.gnu.org/licenses/>.
28//
29//
30//
31//=============================================================================
32// This file is generated by POGO
33// (Program Obviously used to Generate tango Object)
34//=============================================================================
35#include <tango/tango.h>
36
37// Check if crash reporting is used.
38#if defined(ENABLE_CRASH_REPORT)
39# include <crashreporting/crash_report.h>
40#else
41# define DECLARE_CRASH_HANDLER
42# define INSTALL_CRASH_HANDLER
43#endif
44
46
47int main(int argc, char* argv[]) {
49 Tango::Util* tg;
50 try {
51 // Initialise the device server
52 /*----------------------------------------------------------------------------------------------------------------*/
53 tg = Tango::Util::init(argc, argv);
54
55 // Create the device server singleton
56 // which will create everything
57 /*----------------------------------------------------------------------------------------------------------------*/
58 tg->server_init(false);
59
60 // Run the endless loop
61 /*----------------------------------------------------------------------------------------------------------------*/
62 std::cout << "Ready to accept request" << std::endl;
63 tg->server_run();
64 }
65 catch(std::bad_alloc&) {
66 std::cout << "Can't allocate memory to store device object !!!" << std::endl;
67 std::cout << "Exiting" << std::endl;
68 }
69 catch(CORBA::Exception& e) {
70 Tango::Except::print_exception(e);
71
72 std::cout << "Received a CORBA_Exception" << std::endl;
73 std::cout << "Exiting" << std::endl;
74 }
75
76 if(tg) {
77 tg->server_cleanup();
78 }
79 return (0);
80}
81
82/* clang-format off */
83/*----- PROTECTED REGION END -----*/ // TangoTestServer::main.cpp
DECLARE_CRASH_HANDLER int main(int argc, char *argv[])
Definition main.cpp:47
#define DECLARE_CRASH_HANDLER
Definition main.cpp:41
#define INSTALL_CRASH_HANDLER
Definition main.cpp:42