diff options
author | ClausKlein <claus.klein@arcormail.de> | 2021-06-01 21:52:40 +0200 |
---|---|---|
committer | ClausKlein <claus.klein@arcormail.de> | 2021-06-01 21:52:40 +0200 |
commit | 07fa228d53c104d14b136d6dd6cdb514b4b995f1 (patch) | |
tree | d657b59b18b61cd359288e0fcf5e9d478c71bd7f /TAO/tests | |
parent | 9a26624a2fdad8541d01afaf0dbafb64a8852f69 (diff) | |
download | ATCD-07fa228d53c104d14b136d6dd6cdb514b4b995f1.tar.gz |
add clang-format config file to format code
respect code review comments
Diffstat (limited to 'TAO/tests')
-rw-r--r-- | TAO/tests/Bug_3251_Regression/DllOrb.h | 19 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/Client_Task.h | 13 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/ORB_Task.h | 18 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/Server.h | 12 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/Server_Task.h | 34 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/Test_i.h | 10 | ||||
-rw-r--r-- | TAO/tests/Oneway_Send_Timeouts/main.cpp | 84 |
7 files changed, 96 insertions, 94 deletions
diff --git a/TAO/tests/Bug_3251_Regression/DllOrb.h b/TAO/tests/Bug_3251_Regression/DllOrb.h index 084f78a12ea..0587b92c20b 100644 --- a/TAO/tests/Bug_3251_Regression/DllOrb.h +++ b/TAO/tests/Bug_3251_Regression/DllOrb.h @@ -5,30 +5,33 @@ #include "ace/Task.h" #include "tao/ORB.h" -#include "tao/PortableServer/PortableServer.h" #include "bug_3251_export.h" +#include "tao/PortableServer/PortableServer.h" #include <memory> -class bug_3251_Export DllOrb: public ACE_Task_Base +class bug_3251_Export DllOrb : public ACE_Task_Base { public: DllOrb (void); virtual ~DllOrb (void); - CORBA::ORB_ptr orb () const { return CORBA::ORB::_duplicate(mv_orb_.in()); } + CORBA::ORB_ptr orb () const + { + return CORBA::ORB::_duplicate (mv_orb_.in ()); + } - virtual int init (int argc, ACE_TCHAR *argv[]); + virtual int init (int argc, ACE_TCHAR* argv[]); virtual int fini (); virtual int svc (); private: - std::unique_ptr < ACE_Thread_Barrier > ma_barrier_; - CORBA::ORB_var mv_orb_; - PortableServer::POA_var mv_rootPOA_; - PortableServer::POAManager_var mv_poaManager_; + std::unique_ptr<ACE_Thread_Barrier> ma_barrier_; + CORBA::ORB_var mv_orb_; + PortableServer::POA_var mv_rootPOA_; + PortableServer::POAManager_var mv_poaManager_; }; ACE_FACTORY_DECLARE (bug_3251, DllOrb) diff --git a/TAO/tests/Oneway_Send_Timeouts/Client_Task.h b/TAO/tests/Oneway_Send_Timeouts/Client_Task.h index b40ae16d536..68b610b5df2 100644 --- a/TAO/tests/Oneway_Send_Timeouts/Client_Task.h +++ b/TAO/tests/Oneway_Send_Timeouts/Client_Task.h @@ -7,26 +7,25 @@ class Client_Task : public ACE_Task_Base { - public: - +public: Client_Task (const std::string& args) : args_ (args) - { } + {} virtual int svc () { - ACE_ARGV my_args (args_.c_str()); + ACE_ARGV my_args (args_.c_str ()); { - Client client (my_args.argc(), my_args.argv()); - client.run(); + Client client (my_args.argc (), my_args.argv ()); + client.run (); } ACE_DEBUG ((LM_DEBUG, "(%P|%t) Client_Task::svc>\n")); return 0; } - private: +private: std::string args_; }; diff --git a/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h b/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h index 60b870e3799..42642e95dc4 100644 --- a/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h +++ b/TAO/tests/Oneway_Send_Timeouts/ORB_Task.h @@ -7,22 +7,22 @@ class ORB_Task : public ACE_Task_Base { - private: +private: CORBA::ORB_var orb_; - public: +public: ORB_Task (CORBA::ORB_ptr orb) : orb_ (CORBA::ORB::_duplicate (orb)) - { - if (CORBA::is_nil (orb_.in()) == 1) { - ACE_ERROR ((LM_ERROR, "ORB_Task> Ctr> Orb is NULL\n")); - } - }; + { + if (CORBA::is_nil (orb_.in ()) == 1) { + ACE_ERROR ((LM_ERROR, "ORB_Task> Ctr> Orb is NULL\n")); + } + }; virtual int svc () { - if (CORBA::is_nil (orb_.in()) == 0) { - orb_->run(); + if (CORBA::is_nil (orb_.in ()) == 0) { + orb_->run (); } return -1; diff --git a/TAO/tests/Oneway_Send_Timeouts/Server.h b/TAO/tests/Oneway_Send_Timeouts/Server.h index 968378e09db..d748192e772 100644 --- a/TAO/tests/Oneway_Send_Timeouts/Server.h +++ b/TAO/tests/Oneway_Send_Timeouts/Server.h @@ -13,7 +13,7 @@ class Server { - public: +public: Server (int argc, ACE_TCHAR* argv[]); ~Server (); @@ -22,13 +22,13 @@ class Server bool init_; - private: +private: bool parse_args (int argc, ACE_TCHAR* argv[]); - CORBA::ORB_var orb_; - CORBA::ORB_var management_orb_; - bool shutdown_; - TAO_SYNCH_MUTEX mutex_; + CORBA::ORB_var orb_; + CORBA::ORB_var management_orb_; + bool shutdown_; + TAO_SYNCH_MUTEX mutex_; std::unique_ptr<Test_i> test_i_; }; diff --git a/TAO/tests/Oneway_Send_Timeouts/Server_Task.h b/TAO/tests/Oneway_Send_Timeouts/Server_Task.h index 89e05bda8a5..97450635ffd 100644 --- a/TAO/tests/Oneway_Send_Timeouts/Server_Task.h +++ b/TAO/tests/Oneway_Send_Timeouts/Server_Task.h @@ -3,34 +3,32 @@ #include "Server.h" -#include "ace/Task.h" #include "ace/ARGV.h" +#include "ace/Task.h" #include <string> class Server_Task : public ACE_Task_Base { - public: +public: Server_Task (const std::string& args) : args_ (args) - { } - ~Server_Task () - { - this->force_shutdown (); - } + {} + ~Server_Task () { this->force_shutdown (); } virtual int svc () { bool initializer = false; { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, -1); - if (server_.get() == 0) { - ACE_ARGV my_args (args_.c_str()); + if (server_.get () == 0) { + ACE_ARGV my_args (args_.c_str ()); - // Initialize Server ORB in new thread - server_ = std::make_unique<Server>(my_args.argc(), my_args.argv()); - ACE_ASSERT (server_.get() != 0); - initializer = true; + // Initialize Server ORB in new thread + // server_ = std::make_unique<Server>(my_args.argc(), my_args.argv()); + server_.reset (new Server(my_args.argc (), my_args.argv ()); + ACE_ASSERT (server_.get () != 0); + initializer = true; } } @@ -47,7 +45,7 @@ class Server_Task : public ACE_Task_Base bool ready () { - if (server_.get() != 0) { + if (server_.get () != 0) { return server_->init_; } @@ -56,15 +54,15 @@ class Server_Task : public ACE_Task_Base void force_shutdown () { - if (server_.get() != 0) { + if (server_.get () != 0) { server_->shutdown (); } } - private: - std::string args_; +private: + std::string args_; std::unique_ptr<Server> server_; - TAO_SYNCH_MUTEX mutex_; + TAO_SYNCH_MUTEX mutex_; }; #endif //_SERVER_TASK_ diff --git a/TAO/tests/Oneway_Send_Timeouts/Test_i.h b/TAO/tests/Oneway_Send_Timeouts/Test_i.h index 974a8401bba..4cba20a9c91 100644 --- a/TAO/tests/Oneway_Send_Timeouts/Test_i.h +++ b/TAO/tests/Oneway_Send_Timeouts/Test_i.h @@ -5,7 +5,7 @@ class Test_i : public virtual POA_Test { - public: +public: Test_i (CORBA::ORB_ptr orb); virtual ~Test_i (); @@ -19,10 +19,10 @@ class Test_i : public virtual POA_Test virtual void shutdown (); - private: - volatile bool sleep_; - volatile bool unsleep_; - volatile bool shutdown_; +private: + volatile bool sleep_; + volatile bool unsleep_; + volatile bool shutdown_; CORBA::ORB_var orb_; }; diff --git a/TAO/tests/Oneway_Send_Timeouts/main.cpp b/TAO/tests/Oneway_Send_Timeouts/main.cpp index fc91a97eaab..c866a66cd1e 100644 --- a/TAO/tests/Oneway_Send_Timeouts/main.cpp +++ b/TAO/tests/Oneway_Send_Timeouts/main.cpp @@ -1,10 +1,10 @@ -#include "Server_Task.h" #include "Client_Task.h" +#include "Server_Task.h" +#include "ace/High_Res_Timer.h" #include "ace/Log_Msg.h" #include "ace/OS_NS_string.h" #include "ace/OS_NS_strings.h" -#include "ace/High_Res_Timer.h" #include <memory> @@ -30,28 +30,28 @@ private: void MyMain::print_usage () -{ -} +{} bool MyMain::init_server (const ACE_TCHAR* args) { - std::string my_args (ACE_TEXT_ALWAYS_CHAR(args)); + std::string my_args (ACE_TEXT_ALWAYS_CHAR (args)); // main thread and extra thread for backdoor operations int thread_pool = 2; - server_ = std::make_unique<Server>(my_args); - ACE_ASSERT (server_task_.get() != 0); + // TODO: server_ = std::make_unique<Server> (my_args); + server_.reset (new Server (my_args); + ACE_ASSERT (server_task_.get () != 0); - server_task_->activate (THR_NEW_LWP | THR_JOINABLE |THR_INHERIT_SCHED - , thread_pool); + server_task_->activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, + thread_pool); - int duration = 4; //wait 3 seconds for initialization + int duration = 4; // wait 3 seconds for initialization ACE_Time_Value current = ACE_High_Res_Timer::gettimeofday_hr (); - ACE_Time_Value timeout = current + ACE_Time_Value(duration); + ACE_Time_Value timeout = current + ACE_Time_Value (duration); while (current < timeout) { - if (server_task_->ready()) { + if (server_task_->ready ()) { break; } ACE_Time_Value sleep_time; @@ -60,10 +60,10 @@ MyMain::init_server (const ACE_TCHAR* args) current += sleep_time; } - if (!server_task_->ready()) { + if (!server_task_->ready ()) { server_task_->force_shutdown (); server_task_->wait (); - server_task_.reset(); + server_task_.reset (); return false; } @@ -73,52 +73,53 @@ MyMain::init_server (const ACE_TCHAR* args) bool MyMain::init_client (const ACE_TCHAR* args) { - std::string my_args (ACE_TEXT_ALWAYS_CHAR(args)); - int thread_pool = 1; + std::string my_args (ACE_TEXT_ALWAYS_CHAR (args)); + int thread_pool = 1; - client_task_ = std::make_unique<Client_Task>(my_args); - ACE_ASSERT (client_task_.get() != 0); + // TODO: client_task_ = std::make_unique<Client_Task> (my_args); + client_task_.reset (new Client_Task (my_args); + ACE_ASSERT (client_task_.get () != 0); - client_task_->activate (THR_NEW_LWP | THR_JOINABLE |THR_INHERIT_SCHED - , thread_pool); + client_task_->activate (THR_NEW_LWP | THR_JOINABLE | THR_INHERIT_SCHED, + thread_pool); return true; } MyMain::MyMain (int argc, ACE_TCHAR* argv[]) - : s_init_ (false), shutdown_ (false) + : s_init_ (false) + , shutdown_ (false) { argc--; - for (int p = 1; p <= argc; p++) - { - if (ACE_OS::strcmp (argv[p], ACE_TEXT("-?")) == 0) { - print_usage (); - return; - } + for (int p = 1; p <= argc; p++) { + if (ACE_OS::strcmp (argv[p], ACE_TEXT ("-?")) == 0) { + print_usage (); + return; + } - if (ACE_OS::strcasecmp (argv[p], ACE_TEXT("-s")) == 0) { - const ACE_TCHAR* s_args = (((p+1) <= argc) ? argv[p+1] : 0); - s_init_ = this->init_server (s_args); - p++; - } - else if (ACE_OS::strcasecmp (argv[p], ACE_TEXT("-c")) == 0) { - const ACE_TCHAR* s_args = (((p+1) <= argc) ? argv[p+1] : 0); - if (s_init_) { - this->init_client (s_args); - } - p++; + if (ACE_OS::strcasecmp (argv[p], ACE_TEXT ("-s")) == 0) { + const ACE_TCHAR* s_args = (((p + 1) <= argc) ? argv[p + 1] : 0); + s_init_ = this->init_server (s_args); + p++; + } + else if (ACE_OS::strcasecmp (argv[p], ACE_TEXT ("-c")) == 0) { + const ACE_TCHAR* s_args = (((p + 1) <= argc) ? argv[p + 1] : 0); + if (s_init_) { + this->init_client (s_args); } + p++; } + } } void MyMain::run () { - if (server_task_.get() != 0) { + if (server_task_.get () != 0) { server_task_->wait (); } - if (client_task_.get() != 0) { + if (client_task_.get () != 0) { client_task_->wait (); } @@ -132,7 +133,8 @@ MyMain::~MyMain () } } -int ACE_TMAIN (int argc, ACE_TCHAR* argv[]) +int +ACE_TMAIN (int argc, ACE_TCHAR* argv[]) { MyMain my_main (argc, argv); |