12#include "sparta/log/NotificationSource.hpp"
13#include "sparta/log/Message.hpp"
14#include "sparta/log/Tap.hpp"
15#include "sparta/log/Events.hpp"
16#include "sparta/log/categories/CategoryManager.hpp"
17#include "sparta/utils/StringManager.hpp"
18#include "sparta/utils/Utils.hpp"
19#include "sparta/log/MessageInfo.hpp"
48 const std::string& category,
49 const std::string& desc) :
55 const std::string* category_id,
56 const std::string& desc) :
71 uint64_t getNumEmitted()
const {
75 const std::string* getCategoryID()
const {
79 const std::string& getCategoryName()
const {
83 operator bool() const noexcept {
142 std::ostringstream s_;
193 src_->emit_(s_.str());
226 LogObject operator<<(
const T& t)
const {
227 return LogObject(*
this, t);
230 LogObject operator<<(std::ostream& (*f)(std::ostream&))
const {
231 return LogObject(*
this, f);
234 LogObject emit(
const std::string& msg)
const {
235 return LogObject(*
this, msg);
238 LogObject emit(std::string&& msg)
const {
239 return LogObject(*
this, msg);
247 virtual std::string
stringize(
bool pretty=
false)
const override {
249 std::stringstream ss;
251 << getCategoryName() <<
"\" observed:" << std::boolalpha <<
observed()
252 <<
" msgs:" << getNumEmitted() <<
'>';
265 void emit_(
const std::string& content)
const;
Basic Node framework in sparta device tree composite pattern.
const std::string & getNotificationName() const
Returns the notification name string for slow string comparison or printing.
bool observed() const noexcept
Is this NotificationSourceBase being observed at this node or an ancestor of any distance.
uint64_t getNumPosts() const
Returns the number of notifications posted by this node.
const std::string * getNotificationID() const
Returns notification ID (string pointer from Notification ID interned in sparta::StringManager)
A TreeNode that generates a specific type of notification which propagates up a tree of TreeNodes (us...
Manages string internment for SPARTA. This allows strings to be compared by pointer once interned.
Node in a composite tree representing a sparta Tree item.
std::string getLocation() const override final
group_idx_type getGroupIndexMax(const std::string &group)
Gets the largest index of a node in the given group.
virtual TreeNode * getParent()
Gets immediate parent of this node if one exists.
Temporary object for constructing a log message with a ostream-like interface. Emits a message to the...
LogObject(LogObject &&rhp)
Move constructor.
LogObject(const MessageSource &src)
Construct with message source.
LogObject()=delete
Not default-constructable.
LogObject & operator<<(std::ostream &(*f)(std::ostream &))
Handler for stream modifiers (e.g. endl)
LogObject(const MessageSource &src, const T &init)
Construct with an initial value.
LogObject(const MessageSource &src, std::ostream &(*f)(std::ostream &))
Construct with a function operating on ostreams (e.g. std::setw)
LogObject(const LogObject &rhp)=delete
Not Copy-constructable.
LogObject & operator<<(const T &t)
Insertion operator on this LogObject.
void cancel()
Cancel the LogObject by.
Message source object associated with a sparta TreeNode through which messages can be sent.
static MessageSource & getGlobalDebug()
Gets the global warning logger. These are global-level debugging messages from the SPARTA framework.
static MessageSource & getGlobalWarn()
Gets the global warning logger. These messages can be picked up by placing a Tap on the sparta::TreeN...
static const constexpr char * GROUP_NAME_MSG_SOURCE
Group name of logging message sources.
virtual std::string stringize(bool pretty=false) const override
Create a string representation of this node.
static MessageSource & getGlobalParameterTraceSource()
Gets the global parameters/configuration logger. These are global-level configuration messages from t...
int64_t seq_num_type
Sequence number of a message within a thread ID. Signed so that initial state can be -1.
Macros for handling exponential backoff.
T * notNull(T *p)
Ensures that a pointer is not null.