Skip to content

Commit 2adb981

Browse files
authored
Merge pull request #2422 from jwillemsen/jwi-imrorbrunner
Put ImR_Activator_ORB_Runner into its own file, use make_unique, fix C++23 warnings
2 parents 95f02d2 + a89e148 commit 2adb981

9 files changed

Lines changed: 73 additions & 58 deletions

File tree

ACE/tests/Mem_Map_Test.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,19 @@
2121
#include "ace/OS_NS_fcntl.h"
2222
#include "ace/OS_Memory.h"
2323

24-
2524
#if !defined (ACE_LACKS_MMAP)
2625

2726
static const char ACE_ALPHABET[] = "abcdefghijklmnopqrstuvwxyz";
28-
static const int LINE_LENGTH = 10;
29-
static const int NUM_LINES = 15;
27+
static constexpr int LINE_LENGTH = 10;
28+
static constexpr int NUM_LINES = 15;
3029

3130
static void
3231
reverse_file (ACE_HANDLE file_handle,
3332
char *array,
3433
size_t size)
3534
{
3635
int count = 0;
37-
// LynxOS 3.0.0/PowerPC needs the volatile qualifier, with -O2
38-
// optimization enabled and without ACE_HAS_INLINE.
39-
volatile size_t i = size;
36+
size_t i = size;
4037
--i;
4138

4239
if (array[i] == '\0')

TAO/orbsvcs/ImplRepo_Service/Activator_Loader.cpp

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,9 @@
11
#include "orbsvcs/Log_Macros.h"
22
#include "Activator_Loader.h"
3+
#include "Activator_ORB_Runner.h"
34
#include "ace/Dynamic_Service.h"
4-
#include "ace/Task.h"
55

6-
class ImR_Activator_ORB_Runner : public ACE_Task_Base
7-
{
8-
ImR_Activator_Loader& service_;
9-
public:
10-
ImR_Activator_ORB_Runner (ImR_Activator_Loader& service)
11-
: service_ (service)
12-
{
13-
}
14-
virtual int svc ()
15-
{
16-
// Block until service_.fini() calls orb->destroy()
17-
this->service_.run ();
18-
return 0;
19-
}
20-
};
21-
22-
ImR_Activator_Loader::ImR_Activator_Loader ()
6+
ImR_Activator_Loader::~ImR_Activator_Loader ()
237
{
248
}
259

@@ -45,7 +29,7 @@ ImR_Activator_Loader::init (int argc, ACE_TCHAR *argv[])
4529

4630
// Create a thread in which to run the service
4731
ACE_ASSERT (this->runner_.get () == 0);
48-
this->runner_.reset (new ImR_Activator_ORB_Runner (*this));
32+
this->runner_= std::make_unique<ImR_Activator_ORB_Runner> (*this);
4933
this->runner_->activate ();
5034
}
5135
catch (const CORBA::Exception&)
@@ -64,7 +48,7 @@ ImR_Activator_Loader::fini ()
6448
int ret = this->service_.fini ();
6549

6650
this->runner_->wait ();
67-
this->runner_.reset (0);
51+
this->runner_.reset (nullptr);
6852
return ret;
6953
}
7054
catch (const CORBA::Exception&)
@@ -75,8 +59,8 @@ ImR_Activator_Loader::fini ()
7559

7660
CORBA::Object_ptr
7761
ImR_Activator_Loader::create_object (CORBA::ORB_ptr,
78-
int,
79-
ACE_TCHAR **)
62+
int,
63+
ACE_TCHAR **)
8064
{
8165
throw CORBA::NO_IMPLEMENT ();
8266
}

TAO/orbsvcs/ImplRepo_Service/Activator_Loader.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,16 @@ class ImR_Activator_ORB_Runner;
1818
class Activator_Export ImR_Activator_Loader : public TAO_Object_Loader
1919
{
2020
public:
21-
ImR_Activator_Loader();
21+
ImR_Activator_Loader () = default;
22+
~ImR_Activator_Loader ();
2223

23-
virtual int init (int argc, ACE_TCHAR *argv[]);
24+
int init (int argc, ACE_TCHAR *argv[]) override;
2425

25-
virtual int fini ();
26+
int fini () override;
2627

27-
virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
28-
int argc,
29-
ACE_TCHAR *argv[]);
28+
CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
29+
int argc,
30+
ACE_TCHAR *argv[]) override;
3031

3132
// Unlike other service objects, we have our own orb.
3233
int run();
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#include "Activator_ORB_Runner.h"
2+
#include "Activator_Loader.h"
3+
4+
ImR_Activator_ORB_Runner::ImR_Activator_ORB_Runner (ImR_Activator_Loader& service)
5+
: service_ (service)
6+
{
7+
}
8+
9+
int
10+
ImR_Activator_ORB_Runner::svc ()
11+
{
12+
// Block until service_.fini() calls orb->destroy()
13+
this->service_.run ();
14+
return 0;
15+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// -*- C++ -*-
2+
#ifndef TAO_IMR_ACTIVATOR_ORB_RUNNER_H
3+
#define TAO_IMR_ACTIVATOR_ORB_RUNNER_H
4+
5+
#include "ace/Task.h"
6+
7+
#if !defined (ACE_LACKS_PRAGMA_ONCE)
8+
# pragma once
9+
#endif /* ACE_LACKS_PRAGMA_ONCE */
10+
11+
class ImR_Activator_Loader;
12+
13+
class ImR_Activator_ORB_Runner : public ACE_Task_Base
14+
{
15+
public:
16+
ImR_Activator_ORB_Runner (ImR_Activator_Loader& service);
17+
~ImR_Activator_ORB_Runner () = default;
18+
19+
int svc () override;
20+
private:
21+
ImR_Activator_Loader& service_;
22+
};
23+
24+
#endif

TAO/orbsvcs/ImplRepo_Service/ImplRepo_Service.mpc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ project(ImR_Activator) : orbsvcslib, orbsvcs_output, install_lib, acexml, avoids
8989
ImR_Activator_i.cpp
9090
Activator_Options.cpp
9191
Activator_Loader.cpp
92+
Activator_ORB_Runner.cpp
9293
}
9394
header_files {
9495
activator_export.h

TAO/orbsvcs/examples/ImR/Combined_Service/dynserver.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,6 @@
99
using namespace CORBA;
1010
using namespace PortableServer;
1111

12-
DynServer::DynServer()
13-
: n_(0)
14-
{
15-
}
16-
17-
DynServer::~DynServer() {
18-
}
19-
2012
Long DynServer::get()
2113
{
2214
ACE_DEBUG((LM_DEBUG, "dynserver: get() %d\n", ++n_));
@@ -59,7 +51,7 @@ class DynServer_ORB_Runner : public ACE_Task_Base
5951
}
6052
};
6153

62-
DynServer_Loader::DynServer_Loader()
54+
DynServer_Loader::~DynServer_Loader ()
6355
{
6456
}
6557

TAO/orbsvcs/examples/ImR/Combined_Service/dynserver.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
#include <memory>
1111

1212
// Trivial test corba object
13-
class DynServer_Export DynServer
14-
: public POA_test
13+
class DynServer_Export DynServer : public POA_test
1514
{
16-
int n_;
1715
public:
18-
DynServer();
19-
virtual ~DynServer();
20-
virtual CORBA::Long get();
16+
DynServer () = default;
17+
~DynServer() override = default;
18+
CORBA::Long get() override;
19+
private:
20+
int n_ {};
2121
};
2222

2323
class DynServer_ORB_Runner;
@@ -26,19 +26,20 @@ class DynServer_ORB_Runner;
2626
class DynServer_Export DynServer_Loader : public TAO_Object_Loader
2727
{
2828
public:
29-
DynServer_Loader();
29+
DynServer_Loader() = default;
30+
~DynServer_Loader ();
3031

3132
// spawns a thread to run an internal orb which has activated
3233
// a single DynServer servant.
33-
virtual int init (int argc, ACE_TCHAR *argv[]);
34+
int init (int argc, ACE_TCHAR *argv[]) override;
3435

3536
// Allows the service configurator to shutdown the orb
36-
virtual int fini ();
37+
int fini () override;
3738

3839
// Not supported
39-
virtual CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
40-
int argc,
41-
ACE_TCHAR *argv[]);
40+
CORBA::Object_ptr create_object (CORBA::ORB_ptr orb,
41+
int argc,
42+
ACE_TCHAR *argv[]) override;
4243

4344
private:
4445
CORBA::ORB_var orb_;

TAO/tests/MT_NoUpcall_Client_Leader/chatter.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ class Chatter : public Worker
1010
{
1111
public:
1212
Chatter (CORBA::ORB_ptr orb, const ACE_TCHAR *ior, ACE_Condition<ACE_Mutex>& cond);
13-
virtual int svc ();
13+
int svc () override;
1414
int farewell ();
1515
long nrequests ();
1616
long nreplies ();
1717
public:
18-
volatile long nrequests_;
19-
volatile long nreplies_;
18+
long nrequests_;
19+
long nreplies_;
2020
private:
2121
const ACE_TCHAR* ior_;
2222
ACE_Condition<ACE_Mutex>& cond_;

0 commit comments

Comments
 (0)