Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ env:
jobs:
create-github-prerelease:
runs-on: ubuntu-latest
if: github.event_name == 'push' && contains(github.ref_name, "rc")
if: github.event_name == 'push' && contains(github.ref_name, 'rc')
permissions:
contents: write

Expand All @@ -32,7 +32,7 @@ jobs:

create-github-release:
runs-on: ubuntu-latest
if: github.event_name == 'push' && !contains(github.ref_name, "rc")
if: github.event_name == 'push' && !contains(github.ref_name, 'rc')
permissions:
contents: write

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,15 +246,15 @@ void HumanReadableCslPrinter::printSummaryResult(
d_ostream << '\n'
<< recordCount.d_updateCount
<< " update record(s) found, including:" << '\n';
bsl::vector<const char*> fields(d_allocator_p);
bsl::vector<bsl::string> fields(d_allocator_p);
bmqp_ctrlmsg::ClusterMessageChoice clusterMessageChoice(
d_allocator_p);
for (CslUpdateChoiceMap::const_iterator it =
updateChoiceMap.begin();
it != updateChoiceMap.end();
++it) {
clusterMessageChoice.makeSelection(it->first);
fields.push_back(clusterMessageChoice.selectionName());
fields.emplace_back(clusterMessageChoice.selectionName());
}
bmqu::AlignedPrinter printer(d_ostream, &fields);
for (CslUpdateChoiceMap::const_iterator it =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ template <typename PRINTER_TYPE>
class CslRecordPrinter {
private:
bsl::ostream& d_ostream;
bsl::vector<const char*> d_fields;
bsl::vector<bsl::string> d_fields;
bslma::ManagedPtr<PRINTER_TYPE> d_printer_mp;
bslma::Allocator* d_allocator_p;

Expand Down
70 changes: 35 additions & 35 deletions src/applications/bmqstoragetool/m_bmqstoragetool_printer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void printDataFileMeta(bsl::ostream& ostream,
{
BSLS_ASSERT_SAFE(dataFile_p && dataFile_p->isValid());

const bsl::vector<const char*> fields = {"BlazingMQ File Header",
const bsl::vector<bsl::string> fields = {"BlazingMQ File Header",
"Data File Header"};

PRINTER_TYPE1 printer(ostream, &fields);
Expand Down Expand Up @@ -121,7 +121,7 @@ void printJournalFileMeta(bsl::ostream& ostream,
{
BSLS_ASSERT_SAFE(journalFile_p && journalFile_p->isValid());

const bsl::vector<const char*> fields = {"BlazingMQ File Header",
const bsl::vector<bsl::string> fields = {"BlazingMQ File Header",
"Journal File Header",
"Journal SyncPoint"};

Expand Down Expand Up @@ -150,20 +150,20 @@ void printJournalFileMeta(bsl::ostream& ostream,
s << '\n';
{
// Print journal-specific fields
bsl::vector<const char*> fieldsSyncPoint(allocator);
bsl::vector<bsl::string> fieldsSyncPoint(allocator);
fieldsSyncPoint.reserve(12);
fieldsSyncPoint.push_back("Last Valid Record Offset");
fieldsSyncPoint.push_back("Record Type");
fieldsSyncPoint.push_back("Record Timestamp");
fieldsSyncPoint.push_back("Record Epoch");
fieldsSyncPoint.push_back("Last Valid SyncPoint Offset");
fieldsSyncPoint.push_back("SyncPoint Timestamp");
fieldsSyncPoint.push_back("SyncPoint Epoch");
fieldsSyncPoint.push_back("SyncPoint SeqNum");
fieldsSyncPoint.push_back("SyncPoint Primary NodeId");
fieldsSyncPoint.push_back("SyncPoint Primary LeaseId");
fieldsSyncPoint.push_back("SyncPoint DataFileOffset (DWORDS)");
fieldsSyncPoint.push_back("SyncPoint QlistFileOffset (WORDS)");
fieldsSyncPoint.emplace_back("Last Valid Record Offset");
fieldsSyncPoint.emplace_back("Record Type");
fieldsSyncPoint.emplace_back("Record Timestamp");
fieldsSyncPoint.emplace_back("Record Epoch");
fieldsSyncPoint.emplace_back("Last Valid SyncPoint Offset");
fieldsSyncPoint.emplace_back("SyncPoint Timestamp");
fieldsSyncPoint.emplace_back("SyncPoint Epoch");
fieldsSyncPoint.emplace_back("SyncPoint SeqNum");
fieldsSyncPoint.emplace_back("SyncPoint Primary NodeId");
fieldsSyncPoint.emplace_back("SyncPoint Primary LeaseId");
fieldsSyncPoint.emplace_back("SyncPoint DataFileOffset (DWORDS)");
fieldsSyncPoint.emplace_back("SyncPoint QlistFileOffset (WORDS)");

PRINTER_TYPE2 p(s, &fieldsSyncPoint);
bsls::Types::Uint64 lastRecPos =
Expand Down Expand Up @@ -251,20 +251,20 @@ void printQueueDetails(bsl::ostream& ostream,
const bsl::size_t appKeysCount = details.d_appDetailsMap.size();

// Setup fields to be displayed
bsl::vector<const char*> fields(allocator);
bsl::vector<bsl::string> fields(allocator);
fields.reserve(8);
fields.push_back("Queue Key");
fields.emplace_back("Queue Key");
if (!details.d_queueUri.empty()) {
fields.push_back("Queue URI");
fields.emplace_back("Queue URI");
}
fields.push_back("Total Records");
fields.push_back("Num Queue Op Records");
fields.push_back("Num Message Records");
fields.push_back("Num Confirm Records");
fields.emplace_back("Total Records");
fields.emplace_back("Num Queue Op Records");
fields.emplace_back("Num Message Records");
fields.emplace_back("Num Confirm Records");
if (appKeysCount > 1U) {
fields.push_back("Num Records Per App");
fields.emplace_back("Num Records Per App");
}
fields.push_back("Num Delete Records");
fields.emplace_back("Num Delete Records");

{
PRINTER_TYPE printer(ostream, &fields);
Expand Down Expand Up @@ -572,12 +572,12 @@ void HumanReadablePrinter::printQueueOpSummary(
d_ostream << "\nTotal number of queueOp records: "
<< queueOpRecordsCount << '\n';

bsl::vector<const char*> fields(d_allocator_p);
bsl::vector<bsl::string> fields(d_allocator_p);
fields.reserve(4);
fields.push_back("Number of 'purge' operations");
fields.push_back("Number of 'creation' operations");
fields.push_back("Number of 'deletion' operations");
fields.push_back("Number of 'addition' operations");
fields.emplace_back("Number of 'purge' operations");
fields.emplace_back("Number of 'creation' operations");
fields.emplace_back("Number of 'deletion' operations");
fields.emplace_back("Number of 'addition' operations");
bmqu::AlignedPrinter printer(d_ostream, &fields);
printer << queueOpCountsVec[mqbs::QueueOpType::e_PURGE]
<< queueOpCountsVec[mqbs::QueueOpType::e_CREATION]
Expand Down Expand Up @@ -887,13 +887,13 @@ void JsonPrinter::printQueueOpSummary(
{
BSLS_ASSERT_SAFE(queueOpCountsVec.size() > mqbs::QueueOpType::e_ADDITION);
closeBraceIfOpen();
bsl::vector<const char*> fields(d_allocator_p);
bsl::vector<bsl::string> fields(d_allocator_p);
fields.reserve(5);
fields.push_back("TotalQueueOperationsNumber");
fields.push_back("PurgeOperationsNumber");
fields.push_back("CreationOperationsNumber");
fields.push_back("DeletionOperationsNumber");
fields.push_back("AdditionOperationsNumber");
fields.emplace_back("TotalQueueOperationsNumber");
fields.emplace_back("PurgeOperationsNumber");
fields.emplace_back("CreationOperationsNumber");
fields.emplace_back("DeletionOperationsNumber");
fields.emplace_back("AdditionOperationsNumber");

bmqu::JsonPrinter<true, false, 0, 2> printer(d_ostream, &fields);
printer << queueOpRecordsCount
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ template <typename PRINTER_TYPE>
class RecordDetailsPrinter {
private:
bsl::ostream& d_ostream;
bsl::vector<const char*> d_fields;
bsl::vector<bsl::string> d_fields;
bslma::ManagedPtr<PRINTER_TYPE> d_printer_mp;
bslma::Allocator* d_allocator_p;

Expand Down
40 changes: 20 additions & 20 deletions src/applications/bmqtool/m_bmqtool_storageinspector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,19 +465,19 @@ void StorageInspector::processCommand(

// Print journal-specific fields
BALL_LOG_OUTPUT_STREAM << "Journal SyncPoint:\n";
bsl::vector<const char*> fields;
fields.push_back("Last Valid Record Offset");
fields.push_back("Record Type");
fields.push_back("Record Timestamp");
fields.push_back("Record Epoch");
fields.push_back("Last Valid SyncPoint Offset");
fields.push_back("SyncPoint Timestamp");
fields.push_back("SyncPoint Epoch");
fields.push_back("SyncPoint SeqNum");
fields.push_back("SyncPoint Primary NodeId");
fields.push_back("SyncPoint Primary LeaseId");
fields.push_back("SyncPoint DataFileOffset (DWORDS)");
fields.push_back("SyncPoint QlistFileOffset (WORDS)");
bsl::vector<bsl::string> fields;
fields.emplace_back("Last Valid Record Offset");
fields.emplace_back("Record Type");
fields.emplace_back("Record Timestamp");
fields.emplace_back("Record Epoch");
fields.emplace_back("Last Valid SyncPoint Offset");
fields.emplace_back("SyncPoint Timestamp");
fields.emplace_back("SyncPoint Epoch");
fields.emplace_back("SyncPoint SeqNum");
fields.emplace_back("SyncPoint Primary NodeId");
fields.emplace_back("SyncPoint Primary LeaseId");
fields.emplace_back("SyncPoint DataFileOffset (DWORDS)");
fields.emplace_back("SyncPoint QlistFileOffset (WORDS)");

bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields);
bsls::Types::Uint64 lastRecPos =
Expand Down Expand Up @@ -578,10 +578,10 @@ void StorageInspector::processCommand(
BALL_LOG_OUTPUT_STREAM << "Queue #" << qnum << "\n";
const QueueRecord& qr = cit->second;

bsl::vector<const char*> fields;
fields.push_back("Queue URI");
fields.push_back("QueueKey");
fields.push_back("Number of AppIds");
bsl::vector<bsl::string> fields;
fields.emplace_back("Queue URI");
fields.emplace_back("QueueKey");
fields.emplace_back("Number of AppIds");

bmqu::AlignedPrinter printer(BALL_LOG_OUTPUT_STREAM, &fields);
printer << cit->first << qr.d_queueKey << qr.d_appIds.size();
Expand All @@ -592,9 +592,9 @@ void StorageInspector::processCommand(
for (unsigned int i = 0; i < appRecs.size(); ++i) {
const AppIdRecord& ar = appRecs[i];
BALL_LOG_OUTPUT_STREAM << " AppId #" << i + 1 << "\n";
bsl::vector<const char*> f;
f.push_back("AppId");
f.push_back("AppKey");
bsl::vector<bsl::string> f;
f.emplace_back("AppId");
f.emplace_back("AppKey");

const int indent = 8;
bmqu::AlignedPrinter p(BALL_LOG_OUTPUT_STREAM, &f, indent);
Expand Down
22 changes: 11 additions & 11 deletions src/groups/bmq/bmqu/bmqu_alignedprinter.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
///-----
// First, specify field names for printer:
//..
// bsl::vector<const char*> fields;
// fields.push_back("Queue URI");
// fields.push_back("QueueKey");
// fields.push_back("Number of AppIds");
// bsl::vector<bsl::string> fields;
// fields.emplace_back("Queue URI");
// fields.emplace_back("QueueKey");
// fields.emplace_back("Number of AppIds");
//..
//
// Next, create an instance of bmqu::AlignedPrinter:
Expand Down Expand Up @@ -71,7 +71,7 @@ class AlignedPrinter {
private:
// DATA
bsl::ostream& d_ostream;
const bsl::vector<const char*>* d_fields_p;
const bsl::vector<bsl::string>* d_fields_p;
int d_indent;
int d_width;
unsigned int d_counter;
Expand All @@ -89,7 +89,7 @@ class AlignedPrinter {
/// is undefined unless `indent` >= 0 and at least one field is present
/// in the `fields`.
AlignedPrinter(bsl::ostream& stream,
const bsl::vector<const char*>* fields,
const bsl::vector<bsl::string>* fields,
int indent = 4);

// MANIPULATORS
Expand All @@ -110,7 +110,7 @@ class AlignedPrinter {
// --------------

inline AlignedPrinter::AlignedPrinter(bsl::ostream& stream,
const bsl::vector<const char*>* fields,
const bsl::vector<bsl::string>* fields,
int indent)
: d_ostream(stream)
, d_fields_p(fields)
Expand All @@ -121,9 +121,9 @@ inline AlignedPrinter::AlignedPrinter(bsl::ostream& stream,
BSLS_ASSERT_SAFE(0 <= d_indent);
BSLS_ASSERT_SAFE(0 < d_fields_p->size());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
BSLS_ASSERT_SAFE(0 < d_fields_p->size());
BSLS_ASSERT_SAFE(d_fields_p);
BSLS_ASSERT_SAFE(0 < d_fields_p->size());

There is a small overlook here, we should probably check that the provided fields arg is not NULL before dereferencing it


int maxLen = static_cast<int>(bsl::strlen((*d_fields_p)[0]));
int maxLen = static_cast<int>((*d_fields_p)[0].length());
for (unsigned int i = 1; i < d_fields_p->size(); ++i) {
int len = static_cast<int>(bsl::strlen((*d_fields_p)[i]));
int len = static_cast<int>((*d_fields_p)[i].length());
if (maxLen < len) {
maxLen = len;
}
Expand All @@ -138,8 +138,8 @@ inline AlignedPrinter& AlignedPrinter::operator<<(const TYPE& value)
BSLS_ASSERT_SAFE(d_counter < d_fields_p->size());

d_ostream << bsl::setw(d_indent) << ' ' << (*d_fields_p)[d_counter]
<< bsl::setw(static_cast<int>(
d_width - bsl::strlen((*d_fields_p)[d_counter])))
<< bsl::setw(static_cast<int>(d_width -
(*d_fields_p)[d_counter].length()))
<< ": " << value << '\n';

++d_counter;
Expand Down
Loading
Loading