Skip to content

Commit

Permalink
Merge pull request #328 from jwillemsen/jwi-constexpr-makereference
Browse files Browse the repository at this point in the history
Make make_reference a constexpr function
  • Loading branch information
jwillemsen authored Oct 6, 2023
2 parents 0a617ef + 5d24ac3 commit bfc4249
Show file tree
Hide file tree
Showing 36 changed files with 89 additions and 146 deletions.
12 changes: 4 additions & 8 deletions ridlbe/c++11/templates/cli/hdr/ami/attribute.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
// generated from <%= ridl_template_path %>
/// @copydoc <%= doc_scoped_name %>
//@{
void
get_<%= name %> (<%= scoped_cxx_in_type %> ami_return_val);
void get_<%= name %> (<%= scoped_cxx_in_type %> ami_return_val);

void
get_<%= name %>_excep (IDL::traits<TAOX11_NAMESPACE::Messaging::ExceptionHolder>::ref_type excep_holder);
void get_<%= name %>_excep (IDL::traits<TAOX11_NAMESPACE::Messaging::ExceptionHolder>::ref_type excep_holder);
% unless is_readonly?

void
set_<%= name %> ();
void set_<%= name %> ();

void
set_<%= name %>_excep (IDL::traits<TAOX11_NAMESPACE::Messaging::ExceptionHolder>::ref_type excep_holder);
void set_<%= name %>_excep (IDL::traits<TAOX11_NAMESPACE::Messaging::ExceptionHolder>::ref_type excep_holder);
% end
//@}
12 changes: 5 additions & 7 deletions ridlbe/c++11/templates/cli/hdr/ami/attribute_amic.erb
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@

// generated from <%= ridl_template_path %>
void
<%= sendc_prefix_get %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler);
void <%= sendc_prefix_get %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler);
% unless is_readonly?

void
<%= sendc_prefix_set %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler,
<%= cxx_in_type %> _x11_<%= cxxname %>);
void <%= sendc_prefix_set %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler,
<%= cxx_in_type %> _x11_<%= cxxname %>);
% end
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/ami/interface_amic_post.erb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ protected:
using _shared_ptr_type = std::shared_ptr<<%= cxxname %>>;

template <typename _Tp1, typename, typename ...Args>
friend TAOX11_CORBA::object_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);
friend constexpr TAOX11_CORBA::object_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);

explicit <%= amic_cxxname %> (<%= proxy_cxxname %>_ptr p, bool inherited = false);
<%= amic_cxxname %> () = default;
Expand Down
3 changes: 1 addition & 2 deletions ridlbe/c++11/templates/cli/hdr/ami/operation.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ void
<%= _arg.direction == :out ? _arg.scoped_cxx_in_type : _arg.scoped_cxx_inout_type%> <%= _arg.cxxname %><%= _args.empty? ? ');' : ',' %>
% end

void
<%= name %>_excep (IDL::traits<TAOX11_NAMESPACE::Messaging::ExceptionHolder>::ref_type excep_holder);
void <%= name %>_excep (IDL::traits<TAOX11_NAMESPACE::Messaging::ExceptionHolder>::ref_type excep_holder);
7 changes: 3 additions & 4 deletions ridlbe/c++11/templates/cli/hdr/ami/operation_amic.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// generated from <%= ridl_template_path %>
% _args = in_arguments.dup
void
<%= sendc_prefix %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler<%= _args.empty? ? ');' : ',' %>
void <%= sendc_prefix %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler<%= _args.empty? ? ');' : ',' %>
% while !_args.empty?
% _arg = _args.shift
<%= _arg.stub_arg_type %> <%= _arg.cxxname %><%= _args.empty? ? ');' : ',' %>
<%= _arg.stub_arg_type %> <%= _arg.cxxname %><%= _args.empty? ? ');' : ',' %>
% end
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/interface_post.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ protected:
using _shared_ptr_type = std::shared_ptr<<%= cxxname %>>;

template <typename _Tp1, typename, typename ...Args>
friend TAOX11_CORBA::object_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);
friend constexpr TAOX11_CORBA::object_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);

explicit <%= cxxname %> (<%= proxy_cxxname %>_ptr p, bool inherited = false);
/// Default constructor
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/valuebox_def.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public:

protected:
template <typename _Tp1, typename, typename ...Args>
friend TAOX11_CORBA::valuetype_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);
friend constexpr TAOX11_CORBA::valuetype_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);

static const std::string __<%= cxxname.downcase %>_repository_id;

Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/valuebox_traits.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace TAOX11_NAMESPACE
static ref_type narrow (valuetype_reference<ValueBase>);

template <typename ...Args>
inline static ref_type make_reference(Args&& ...args)
inline static constexpr ref_type make_reference(Args&& ...args)
{
return TAOX11_CORBA::make_reference<<%= scoped_cxxtype %>> (std::forward<Args> (args)...);
}
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/valuetype_init.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public:
template <typename T> friend struct TAOX11_CORBA::object_traits;
% if is_concrete?
template <typename _Tp1, typename, typename ...Args>
friend TAOX11_CORBA::object_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);
friend constexpr TAOX11_CORBA::object_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);

TAOX11_IDL::traits<TAOX11_CORBA::ValueBase>::ref_type
create_for_unmarshal () override;
Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/valuetype_obv.erb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ namespace obv
public:
% if is_concrete?
template <typename _Tp1, typename, typename ...Args>
friend TAOX11_CORBA::valuetype_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);
friend constexpr TAOX11_CORBA::valuetype_reference<_Tp1> TAOX11_CORBA::make_reference(Args&& ...args);

TAOX11_IDL::traits<TAOX11_CORBA::ValueBase>::ref_type _copy_value () const override;

Expand Down
2 changes: 1 addition & 1 deletion ridlbe/c++11/templates/cli/hdr/valuetype_traits.erb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace TAOX11_NAMESPACE
typename = typename
std::enable_if<std::is_base_of<<%= scoped_cxxtype %>, TInst>::value>::type,
typename ...Args>
inline static ref_type make_reference(Args&& ...args)
inline static constexpr ref_type make_reference(Args&& ...args)
{
return TAOX11_CORBA::make_reference<TInst> (std::forward<Args> (args)...);
}
Expand Down
12 changes: 6 additions & 6 deletions ridlbe/c++11/templates/cli/prx/ami/attribute.erb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

// generated from <%= ridl_template_path %>
static void get_<%= name %>_reply_stub (
TAO_InputCDR &_tao_reply_cdr,
TAO_MESSAGING::ReplyHandler_ptr _tao_reply_handler,
TAO_CORBA::ULong reply_status);
TAO_InputCDR &_tao_reply_cdr,
TAO_MESSAGING::ReplyHandler_ptr _tao_reply_handler,
TAO_CORBA::ULong reply_status);
% unless is_readonly?

static void set_<%= name %>_reply_stub (
TAO_InputCDR &_tao_reply_cdr,
TAO_MESSAGING::ReplyHandler_ptr _reply_handler,
TAO_CORBA::ULong reply_status);
TAO_InputCDR &_tao_reply_cdr,
TAO_MESSAGING::ReplyHandler_ptr _reply_handler,
TAO_CORBA::ULong reply_status);

% end
6 changes: 3 additions & 3 deletions ridlbe/c++11/templates/cli/prx/ami/operation.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// generated from <%= ridl_template_path %>
static void <%= name %>_reply_stub (
TAO_InputCDR &_tao_reply_cdr,
TAO_MESSAGING::ReplyHandler_ptr _tao_reply_handler,
TAO_CORBA::ULong reply_status);
TAO_InputCDR &_tao_reply_cdr,
TAO_MESSAGING::ReplyHandler_ptr _tao_reply_handler,
TAO_CORBA::ULong reply_status);
12 changes: 5 additions & 7 deletions ridlbe/c++11/templates/cli/src/ami/attribute_amic.erb
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
% unless interface.is_local?

// generated from <%= ridl_template_path %>
void
<%= interface.amic_scoped_cxxname %>::<%= sendc_prefix_get %><%= name %>(
<%= interface.handler_scoped_cxx_in_type %> ami_handler)
void <%= interface.amic_scoped_cxxname %>::<%= sendc_prefix_get %><%= name %>(
<%= interface.handler_scoped_cxx_in_type %> ami_handler)
{
% if interface.is_abstract?
if (!this->_is_object ())
Expand Down Expand Up @@ -58,10 +57,9 @@ void
}

% unless is_readonly?
void
<%= interface.amic_scoped_cxxname %>::<%= sendc_prefix_set %><%= name %>(
<%= interface.handler_scoped_cxx_in_type %> ami_handler,
<%= cxx_in_type %> _x11_<%= cxxname %>)
void <%= interface.amic_scoped_cxxname %>::<%= sendc_prefix_set %><%= name %>(
<%= interface.handler_scoped_cxx_in_type %> ami_handler,
<%= cxx_in_type %> _x11_<%= cxxname %>)
{
% if interface.is_abstract?
if (!this->_is_object ())
Expand Down
7 changes: 3 additions & 4 deletions ridlbe/c++11/templates/cli/src/ami/operation_amic.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

// generated from <%= ridl_template_path %>
% _args = in_arguments.dup
void
<%= interface.amic_scoped_cxxname %>::<%= sendc_prefix %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler<%= _args.empty? ? ')' : ',' %>
void <%= interface.amic_scoped_cxxname %>::<%= sendc_prefix %><%= name %> (
<%= interface.handler_scoped_cxx_in_type %> ami_handler<%= _args.empty? ? ')' : ',' %>
% while !_args.empty?
% _arg = _args.shift
<%= _arg.stub_arg_type %> <%= _arg.cxxname %><%= _args.empty? ? ')' : ',' %>
<%= _arg.stub_arg_type %> <%= _arg.cxxname %><%= _args.empty? ? ')' : ',' %>
% end
{
% if interface.is_abstract?
Expand Down
3 changes: 1 addition & 2 deletions ridlbe/c++11/templates/impl/hdr/attribute.erb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
<%= cxxname %> () override;
% unless is_readonly?

void
<%= cxxname %> (<%= implementation_in_type %> _v) override;
void <%= cxxname %> (<%= implementation_in_type %> _v) override;
% end
11 changes: 3 additions & 8 deletions ridlbe/c++11/templates/impl/hdr/interface_pre.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,12 @@ namespace _impl
: public CORBA::servant_traits<<%= scoped_cxxtype %>>::base_type
% nest { write_regen_section("#{scoped_cxxname}"+'[Base List]', default_content: '// your base classes') }
{
protected:
public:
% nest(2) { write_regen_section("#{scoped_cxxname}"+'[Constructors]', default_content: ['/// Constructor(s)', "#{skel_cxxname} ();"]) }

/// Destructor
~<%= skel_cxxname %> () override;

template <typename T> friend class CORBA::servant_reference;

template <typename _Tp1, typename, typename ...Args>
friend CORBA::servant_reference<_Tp1> CORBA::make_reference(Args&& ...args);

% nest(2) { write_regen_section("#{scoped_cxxname}"+'[User Protected]', default_content: '// your protected definitions') }
public:
% if has_abstract_base?
% unless abstractbase_operations.empty?

Expand All @@ -39,4 +32,6 @@ namespace _impl
//@}
% end
% end
% nest(2) { write_regen_section("#{scoped_cxxname}"+'[User Protected]', default_content: '// your protected definitions') }

% inc_nest
36 changes: 18 additions & 18 deletions ridlbe/c++11/templates/srv/prx/ami/interface_post.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,34 @@
%all_operations.each do |_op|
% unless _op.is_inherited?
static void <%= _op.name %>_skel (
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
static void <%= _op.name %>_excep_skel (
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
% end
%end
%all_attributes.each do |_att|
% unless _att.is_inherited?
static void get_<%= _att.name %>_skel (
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
static void get_<%= _att.name %>_excep_skel (
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
% unless _att.is_readonly?
static void set_<%= _att.name %>_skel (
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
static void set_<%= _att.name %>_excep_skel (
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
TAO_ServerRequest & server_request,
TAO_TAO::Portable_Server::Servant_Upcall * servant_upcall,
skel_type& servant);
% end
% end
%end
Expand Down
2 changes: 1 addition & 1 deletion tao/x11/PolicyC.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ namespace TAOX11_NAMESPACE

protected:
template <typename _Tp1, typename, typename ...Args>
friend object_reference<_Tp1> make_reference(Args&& ...args);
friend constexpr object_reference<_Tp1> make_reference(Args&& ...args);

Policy ();
explicit Policy (TAOX11_NAMESPACE::Object_proxy_ptr op);
Expand Down
2 changes: 1 addition & 1 deletion tao/x11/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ namespace TAOX11_NAMESPACE

template <typename T> friend struct object_traits;
template <typename _Tp1, typename, typename ...Args>
friend object_reference<_Tp1> make_reference(Args&& ...args);
friend constexpr object_reference<_Tp1> make_reference(Args&& ...args);

explicit Object (Object_proxy_ptr op = nullptr);
Object(const Object&) = delete;
Expand Down
8 changes: 4 additions & 4 deletions tao/x11/object_traits_t.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace TAOX11_NAMESPACE

template <typename T, typename = typename
std::enable_if<std::is_base_of<CORBA::Object, T>::value>::type, typename ...Args>
object_reference<T> make_reference(Args&& ...args);
constexpr object_reference<T> make_reference(Args&& ...args);

template <typename T>
class weak_object_reference;
Expand All @@ -56,7 +56,7 @@ namespace TAOX11_NAMESPACE
typename = typename
std::enable_if<std::is_base_of<T, TInst>::value>::type,
typename ...Args>
static inline object_reference<T> make_reference(Args&& ...args)
static inline constexpr object_reference<T> make_reference(Args&& ...args)
{
return TAOX11_CORBA::make_reference<TInst>(std::forward<Args> (args)...);
}
Expand Down Expand Up @@ -131,7 +131,7 @@ namespace TAOX11_NAMESPACE
template <typename _Tp1> friend class abstractbase_reference;
template <typename _Tp1> friend class weak_abstractbase_reference;
template <typename _Tp1, typename, typename ...Args>
friend object_reference<_Tp1> make_reference(Args&& ...args);
friend constexpr object_reference<_Tp1> make_reference(Args&& ...args);
friend class Object;

template<typename _Tp1, typename = typename
Expand Down Expand Up @@ -239,7 +239,7 @@ namespace TAOX11_NAMESPACE
}

template <typename T, typename, typename ...Args>
inline object_reference<T> make_reference(Args&& ...args)
inline constexpr object_reference<T> make_reference(Args&& ...args)
{
return object_reference<T> (new T (std::forward<Args> (args)...));
}
Expand Down
2 changes: 1 addition & 1 deletion tao/x11/orb.h
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ namespace TAOX11_NAMESPACE
friend ORB_Registry;

template <typename _Tp1, typename, typename ...Args>
friend object_reference<_Tp1> make_reference(Args&& ...args);
friend constexpr object_reference<_Tp1> make_reference(Args&& ...args);

explicit ORB (ORB_Proxy_ptr op);

Expand Down
2 changes: 1 addition & 1 deletion tao/x11/portable_server/poa_policies_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace TAOX11_NAMESPACE {
\
protected: \
template <typename _Tp1, typename, typename ...Args> \
friend CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args); \
friend constexpr CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args); \
\
explicit name ## _impl (TAO_PORTABLE_SERVER::name ## _ptr _pol); \
~name ## _impl () = default; \
Expand Down
8 changes: 4 additions & 4 deletions tao/x11/portable_server/portableserver_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace TAOX11_NAMESPACE {

private:
template <typename _Tp1, typename, typename ...Args>
friend CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);
friend constexpr CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);

explicit POA_impl (POA_proxy_ptr op);

Expand Down Expand Up @@ -213,7 +213,7 @@ namespace TAOX11_NAMESPACE {

private:
template <typename _Tp1, typename, typename ...Args>
friend CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);
friend constexpr CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);

explicit POAManager_impl (POAManager_proxy_ptr op);

Expand Down Expand Up @@ -254,7 +254,7 @@ namespace TAOX11_NAMESPACE {

private:
template <typename _Tp1, typename, typename ...Args>
friend CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);
friend constexpr CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);

explicit POAManagerFactory_impl (POAManagerFactory_proxy_ptr op);

Expand Down Expand Up @@ -293,7 +293,7 @@ namespace TAOX11_NAMESPACE {

private:
template <typename _Tp1, typename, typename ...Args>
friend CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);
friend constexpr CORBA::object_reference<_Tp1> CORBA::make_reference(Args&& ...args);

explicit POA_Current_impl (POA_Current_proxy_ptr op);

Expand Down
Loading

0 comments on commit bfc4249

Please sign in to comment.