From 0ac0fb452f47bf32beb4965bf7569034c415be93 Mon Sep 17 00:00:00 2001 From: "E. Scott Daniels" Date: Fri, 26 Jun 2020 09:01:52 -0400 Subject: [PATCH] Add const qualifier to constructor port parameter The port parameter defined by constructors should have a const qualifier in order to allow a static string to be passed. This change adds that qualifier Issue-ID: RIC-534 Signed-off-by: E. Scott Daniels Change-Id: Ib5a20825c3ff897cea31a3fbaac58b33dc7633f4 --- CHANGES | 6 ++++++ CMakeLists.txt | 2 +- doc/src/Makefile | 1 + doc/src/rtd/Makefile | 4 ++-- doc/src/rtd/rel-notes.rst | 40 +++++++++++++++++++++++++++++----------- doc/src/rtd/rel-notes.xfm | 8 ++++++++ doc/src/rtd/setup.im | 26 +++----------------------- docs/rel-notes.rst | 40 +++++++++++++++++++++++++++++----------- src/messaging/messenger.cpp | 18 ++++++++++-------- src/messaging/messenger.hpp | 2 +- src/xapp/xapp.cpp | 2 +- src/xapp/xapp.hpp | 2 +- 12 files changed, 92 insertions(+), 59 deletions(-) diff --git a/CHANGES b/CHANGES index 3833dbd..74ab3b7 100644 --- a/CHANGES +++ b/CHANGES @@ -1,5 +1,11 @@ # This file contains a brief summary of each version bump. +2020 June 26; version 1.1.0 + Change the port type in constructors to indicate "const" + + Version bump to 1.1.0 to allow patches to bronze code to + continue to be done on the 1.0.* level. + 2020 April 28; version 1.0.0 Bump version to force package build (old CI version added incorrect install prefix). Bump to 1.0.0 for release. diff --git a/CMakeLists.txt b/CMakeLists.txt index 391070d..eaeef37 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,7 +29,7 @@ project( ricxfcpp ) cmake_minimum_required( VERSION 3.5 ) set( major_version "1" ) # should be automatically populated from git tag later, but until CI process sets a tag we use this -set( minor_version "0" ) +set( minor_version "1" ) set( patch_level "0" ) set( install_root "${CMAKE_INSTALL_PREFIX}" ) diff --git a/doc/src/Makefile b/doc/src/Makefile index f36ffd1..14e3320 100644 --- a/doc/src/Makefile +++ b/doc/src/Makefile @@ -16,3 +16,4 @@ publish: (cd user; make publish) + (cd rtd; make publish) diff --git a/doc/src/rtd/Makefile b/doc/src/rtd/Makefile index 5a767df..eda0613 100644 --- a/doc/src/rtd/Makefile +++ b/doc/src/rtd/Makefile @@ -37,7 +37,7 @@ desired_out = rst %.rst: %.xfm OUTPUT_TYPE=rst XFM_PASS=1 tfm $< /dev/null - GEN_TITLE=1 OUTPUT_TYPE=rst XFM_PASS=2 tfm $< | sed 's/^ //' >$@ + GEN_TITLE=1 OUTPUT_TYPE=rst XFM_PASS=2 tfm $< | sed 's/ $$//; s/^ //' >$@ %.txt: %.xfm OUTPUT_TYPE=txt XFM_PASS=1 tfm $< /dev/null @@ -60,7 +60,7 @@ rel-notes.rst: rel-notes.xfm $(imbed_src) # $(docs:%=%.rst): always -publish: user_guide.rst +publish: rel-notes.rst cp *.rst ../../../docs/ # intermeidate junk that might straggle diff --git a/doc/src/rtd/rel-notes.rst b/doc/src/rtd/rel-notes.rst index d622981..7c5615b 100644 --- a/doc/src/rtd/rel-notes.rst +++ b/doc/src/rtd/rel-notes.rst @@ -1,13 +1,31 @@ -============================================================================================ -Release Notes -============================================================================================ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. +.. CAUTION: this document is generated from source in doc/src/* +.. To make changes edit the source and recompile the document. +.. Do NOT make changes directly to .rst or .md files. + + +============================================================================================ +Release Notes +============================================================================================ C++ Framework Release Notes =========================== -The following is a list of release highlights for the C++ -xAPP Framework. +The following is a list of release highlights for the C++ +xAPP Framework. + + +2020 June 26; version 1.1.0 +--------------------------- + +Change the port type in constructors to indicate "const" + +Version bump to 1.1.0 to allow patches to bronze code to +continue to be done on the 1.0.* level. + Bronze Release @@ -18,14 +36,14 @@ Bronze Release 2020 April 28; version 1.0.0 ---------------------------- -Bump version to force package build (old CI version added -incorrect install prefix). Bump to 1.0.0 for release. - +Bump version to force package build (old CI version added +incorrect install prefix). Bump to 1.0.0 for release. + 2020 March 27; version 0.1.2 ---------------------------- -Changes identified by sonar (missing copy/move builders) -rmr_dump example programme Improvements to code for better -test coverage +Changes identified by sonar (missing copy/move builders) +rmr_dump example programme Improvements to code for better +test coverage diff --git a/doc/src/rtd/rel-notes.xfm b/doc/src/rtd/rel-notes.xfm index bdc1521..8049fb6 100644 --- a/doc/src/rtd/rel-notes.xfm +++ b/doc/src/rtd/rel-notes.xfm @@ -13,6 +13,14 @@ &h1(C++ Framework Release Notes) The following is a list of release highlights for the C++ xAPP Framework. +&h2(2020 June 26; version 1.1.0) + Change the port type in constructors to indicate "const" +&space + + Version bump to 1.1.0 to allow patches to bronze code to + continue to be done on the 1.0.* level. +&space + &h1(Bronze Release) &h2(2020 April 28; version 1.0.0) Bump version to force package build (old CI version added diff --git a/doc/src/rtd/setup.im b/doc/src/rtd/setup.im index b05e487..86f3be8 100644 --- a/doc/src/rtd/setup.im +++ b/doc/src/rtd/setup.im @@ -28,6 +28,7 @@ .fi .if ! _setup_im +.dv _setup_im 1 .** allow environment LIB to override .gv e LIB lib @@ -63,7 +64,7 @@ .** if we can set a license into the output, do it early .cd 1 11i &line_len(10i) -.im license.im +.im &{lib}/license.im .cd 1 6.5i m=0 i=0 &line_len( 6i) @@ -75,29 +76,8 @@ .fi .if doc_title - .im &{lib}/library/front_junk.im -.fi - -.dv _setup_im 1 + .im &{lib}/front_junk.im .fi -.if "&ot" "rst" = - .** copyright into .rst because it supports internal comments - .im license.im - - &many_equals .br - &doc_title - &many_equals .br - .if doc_subtitle - &many_dashes .br - &doc_subtitle .br - &many_dashes .br - .fi -.ei - ¢er_start - &doc_title .br - .if doc_subtitle - &doc_subtitle .br - .fi .fi diff --git a/docs/rel-notes.rst b/docs/rel-notes.rst index d622981..7c5615b 100644 --- a/docs/rel-notes.rst +++ b/docs/rel-notes.rst @@ -1,13 +1,31 @@ -============================================================================================ -Release Notes -============================================================================================ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. +.. SPDX-License-Identifier: CC-BY-4.0 +.. +.. CAUTION: this document is generated from source in doc/src/* +.. To make changes edit the source and recompile the document. +.. Do NOT make changes directly to .rst or .md files. + + +============================================================================================ +Release Notes +============================================================================================ C++ Framework Release Notes =========================== -The following is a list of release highlights for the C++ -xAPP Framework. +The following is a list of release highlights for the C++ +xAPP Framework. + + +2020 June 26; version 1.1.0 +--------------------------- + +Change the port type in constructors to indicate "const" + +Version bump to 1.1.0 to allow patches to bronze code to +continue to be done on the 1.0.* level. + Bronze Release @@ -18,14 +36,14 @@ Bronze Release 2020 April 28; version 1.0.0 ---------------------------- -Bump version to force package build (old CI version added -incorrect install prefix). Bump to 1.0.0 for release. - +Bump version to force package build (old CI version added +incorrect install prefix). Bump to 1.0.0 for release. + 2020 March 27; version 0.1.2 ---------------------------- -Changes identified by sonar (missing copy/move builders) -rmr_dump example programme Improvements to code for better -test coverage +Changes identified by sonar (missing copy/move builders) +rmr_dump example programme Improvements to code for better +test coverage diff --git a/src/messaging/messenger.cpp b/src/messaging/messenger.cpp index 24fe164..4e5a278 100644 --- a/src/messaging/messenger.cpp +++ b/src/messaging/messenger.cpp @@ -60,13 +60,15 @@ const int Messenger::DEFAULT_CALLBACK = -1; If port is nil, then the default port is used (4560). */ -Messenger::Messenger( char* port, bool wait4table ) { - if( port == NULL ) { - port = (char *) "4560"; +Messenger::Messenger( const char* uport, bool wait4table ) { + + if( uport == NULL ) { + listen_port = strdup( "4560" ); + } else { + listen_port = strdup( uport ); } gate = new std::mutex(); - listen_port = strdup( port ); mrc = rmr_init( listen_port, Messenger::MAX_PAYLOAD, 0 ); if( wait4table ) { @@ -79,9 +81,9 @@ Messenger::Messenger( char* port, bool wait4table ) { } /* - Move support. We DO allow the instance to be moved as only one copy + Move support. We DO allow the instance to be moved as only one copy remains following the move. - Given a source object instance (soi) we move the information to + Given a source object instance (soi) we move the information to the new object, and then DELETE what was moved so that when the user frees the soi, it doesn't destroy what we snarfed. */ @@ -91,7 +93,7 @@ Messenger::Messenger( Messenger&& soi ) { ok_2_run = soi.ok_2_run; gate = soi.gate; cb_hash = soi.cb_hash; // this seems dodgy - + soi.gate = NULL; soi.listen_port = NULL; soi.mrc = NULL; @@ -115,7 +117,7 @@ Messenger& Messenger::operator=( Messenger&& soi ) { ok_2_run = soi.ok_2_run; gate = soi.gate; cb_hash = soi.cb_hash; // this seems dodgy - + soi.gate = NULL; soi.listen_port = NULL; soi.mrc = NULL; diff --git a/src/messaging/messenger.hpp b/src/messaging/messenger.hpp index 0810aeb..b6e46b6 100644 --- a/src/messaging/messenger.hpp +++ b/src/messaging/messenger.hpp @@ -65,7 +65,7 @@ class Messenger { static const int MAX_PAYLOAD; // max message size we'll handle static const int DEFAULT_CALLBACK; // parm for add callback to set default - Messenger( char* port, bool wait4table ); // builder + Messenger( const char* port, bool wait4table ); // builder Messenger( Messenger&& soi ); // move construction Messenger& operator=( Messenger&& soi ); // move operator ~Messenger(); // destroyer diff --git a/src/xapp/xapp.cpp b/src/xapp/xapp.cpp index 8feb52e..cb14f2e 100644 --- a/src/xapp/xapp.cpp +++ b/src/xapp/xapp.cpp @@ -54,7 +54,7 @@ If port is nil, then the default port is used (4560). */ -Xapp::Xapp( char* port, bool wait4table ) : Messenger( port, wait4table ) { +Xapp::Xapp( const char* port, bool wait4table ) : Messenger( port, wait4table ) { // nothing to do; all handled in Messenger constructor } diff --git a/src/xapp/xapp.hpp b/src/xapp/xapp.hpp index 83540ec..5ba47ec 100644 --- a/src/xapp/xapp.hpp +++ b/src/xapp/xapp.hpp @@ -52,7 +52,7 @@ class Xapp : public Messenger { Xapp& operator=( const Xapp& soi ); public: - Xapp( char* listen_port, bool wait4rt ); // builder + Xapp( const char* listen_port, bool wait4rt ); // builder Xapp( ); ~Xapp(); // destroyer -- 2.16.6