/*
 * SPDX-FileCopyrightText: 2011 Copyright contributors to the cppTango project
 *
 * SPDX-License-Identifier: LGPL-3.0-or-later
 */
// NOLINTBEGIN(*)

#include "DServerImpl.h"

#include <tango/server/DServerClass.h>
#include <tango/tango.h>

int main(int argc, char *argv[])
{
    Tango::Util *tg = nullptr;
    try
    {
        tg = Tango::Util::init(argc, argv);

        tg->register_dserver_constructor(&DevTest_ns::constructor);

        tg->server_init();

        tg->server_run();
    }
    catch(std::bad_alloc &)
    {
        std::cout << "Can't allocate memory to store device object !!!" << std::endl;
        std::cout << "Exiting" << std::endl;
    }
    catch(Tango::DevFailed &e)
    {
        Tango::Except::print_exception(e);
    }
    catch(CORBA::Exception &e)
    {
        Tango::Except::print_exception(e);

        std::cout << "Received a CORBA_Exception" << std::endl;
        std::cout << "Exiting" << std::endl;
    }

    // Destroy the ORB (and properly release its resources)
    if(tg)
    {
        tg->server_cleanup();
    }

    return (0);
}

// NOLINTEND(*)
