-
Notifications
You must be signed in to change notification settings - Fork 30
Added LineFileTagCombiner #1512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
5b7f092
Added LineFileTagCombiner
gberg617 46654d1
simplified unit test logic to remove duplication
gberg617 a08fc84
added documentation and default constructed values for test struct
gberg617 8a9e35c
formatting fix
gberg617 754c3b7
Merge branch 'develop' into feature/bergel1/line_file_tag_combiner
gberg617 d1d1e36
updated release notes
gberg617 6428c13
Merge branch 'feature/bergel1/line_file_tag_combiner' of https://gith…
gberg617 c4efcae
Merge branch 'develop' into feature/bergel1/line_file_tag_combiner
gberg617 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
// Copyright (c) 2017-2025, Lawrence Livermore National Security, LLC and | ||
// other Axom Project Developers. See the top-level LICENSE file for details. | ||
// | ||
// SPDX-License-Identifier: (BSD-3-Clause) | ||
|
||
/*! | ||
******************************************************************************* | ||
* \file LineFileTagCombiner.hpp | ||
* | ||
* \brief This file contains the class implementation of the | ||
* LineFileTagCombiner. | ||
******************************************************************************* | ||
*/ | ||
|
||
#ifndef LINEFILETAGCOMBINER_HPP | ||
#define LINEFILETAGCOMBINER_HPP | ||
|
||
#include "axom/lumberjack/Combiner.hpp" | ||
#include "axom/lumberjack/Message.hpp" | ||
|
||
#include <string> | ||
|
||
namespace axom | ||
{ | ||
namespace lumberjack | ||
{ | ||
/*! | ||
******************************************************************************* | ||
* \class LineFileTagCombiner | ||
* | ||
* \brief Combines Message classes if their Message::fileName, | ||
* Message::lineNumer, and Message::tag are equal. | ||
* | ||
******************************************************************************* | ||
*/ | ||
class LineFileTagCombiner : public axom::lumberjack::Combiner | ||
{ | ||
public: | ||
LineFileTagCombiner() { } | ||
|
||
/*! | ||
***************************************************************************** | ||
* \brief Returns the unique string identifier for this combiner. Used by | ||
* Lumberjack to differentiate between other combiners. | ||
***************************************************************************** | ||
*/ | ||
const std::string id() { return m_id; } | ||
|
||
/*! | ||
***************************************************************************** | ||
* \brief Function used by Lumberjack to indicate whether two messages should | ||
* be combined. | ||
* | ||
* They are not actually combined by this function. Message classes are | ||
* triggered for combination if Message::fileName, Message::lineNumer, | ||
* and Message::tag are equal. | ||
* | ||
* \param [in] leftMessage One of the Messages to be compared. | ||
* \param [in] rightMessage One of the Messages to be compared. | ||
***************************************************************************** | ||
*/ | ||
bool shouldMessagesBeCombined(const axom::lumberjack::Message& leftMessage, | ||
const axom::lumberjack::Message& rightMessage) | ||
{ | ||
return ((leftMessage.lineNumber() == rightMessage.lineNumber()) && | ||
leftMessage.fileName().compare(rightMessage.fileName()) == 0 && | ||
leftMessage.tag().compare(rightMessage.tag()) == 0); | ||
} | ||
|
||
/*! | ||
***************************************************************************** | ||
* \brief Combines the combinee into the combined Message. | ||
* | ||
* The only thing truly combined in this Combiner is the ranks from combinee | ||
* to combined. The text will not be combined, even if it is not equal. | ||
* Only text from the first message will be saved. | ||
* | ||
* \param [in,out] combined the Message that will be modified. | ||
* \param [in] combinee the Message that is combined into the other. | ||
* \param [in] ranksLimit The limit on how many individual ranks are tracked | ||
* in the combined Message. Message::rankCount is always incremented. | ||
* | ||
* \pre shouldMessagesBeCombined(combined, combinee) must be true | ||
***************************************************************************** | ||
*/ | ||
void combine(axom::lumberjack::Message& combined, | ||
const axom::lumberjack::Message& combinee, | ||
const int ranksLimit) | ||
{ | ||
combined.addRanks(combinee.ranks(), combinee.count(), ranksLimit); | ||
} | ||
|
||
private: | ||
const std::string m_id = "LineFileTagCombiner"; | ||
}; | ||
|
||
} // end namespace lumberjack | ||
} // end namespace axom | ||
|
||
#endif |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class is nearly identical to the TextTagCombiner, with the exception of the criteria used to determine whether the message should be combined.