Loading...
Searching...
No Matches
trc_component.h
Go to the documentation of this file.
/*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its contributors
* may be used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ARM_TRC_COMPONENT_H_INCLUDED
#define ARM_TRC_COMPONENT_H_INCLUDED
#include <string>
#include "comp_attach_pt_t.h"
#include "interfaces/trc_error_log_i.h"
#include "ocsd_error.h"
class errLogAttachMonitor;
class TraceComponent
{
public:
TraceComponent(const std::string &name);
TraceComponent(const std::string &name, int instIDNum);
virtual ~TraceComponent();
const std::string &getComponentName() const { return m_name; };
void setComponentName(const std::string &name) { m_name = name; };
componentAttachPt<ITraceErrorLog> *getErrorLogAttachPt() { return &m_error_logger; };
ocsd_err_t setComponentOpMode(uint32_t op_flags);
const uint32_t getComponentOpMode() const { return m_op_flags; };
const uint32_t getSupportedOpModes() const { return m_supported_op_flags; };
void setAssocComponent(TraceComponent *assocComp) { m_assocComp = assocComp; };
TraceComponent *getAssocComponent() { return m_assocComp; };
void LogDefMessage(const std::string &msg)
{
LogMessage(m_errVerbosity, msg);
}
protected:
friend class errLogAttachMonitor;
void LogError(const ocsdError &Error);
void LogMessage(const ocsd_err_severity_t filter_level, const std::string &msg);
const ocsd_err_severity_t getErrorLogLevel() const { return m_errVerbosity; };
const bool isLoggingErrorLevel(const ocsd_err_severity_t level) const { return level <= m_errVerbosity; };
void updateErrorLogLevel();
void do_attach_notify(const int num_attached);
void Init(const std::string &name);
uint32_t m_op_flags;
uint32_t m_supported_op_flags;
private:
componentAttachPt<ITraceErrorLog> m_error_logger;
ocsd_hndl_err_log_t m_errLogHandle;
ocsd_err_severity_t m_errVerbosity;
errLogAttachMonitor *m_pErrAttachMon;
std::string m_name;
TraceComponent *m_assocComp;
};
#endif // ARM_TRC_COMPONENT_H_INCLUDED
/* End of File trc_component.h */
TraceComponent::getErrorLogAttachPt
componentAttachPt< ITraceErrorLog > * getErrorLogAttachPt()
Definition trc_component.h:67
TraceComponent::getComponentOpMode
const uint32_t getComponentOpMode() const
Definition trc_component.h:86
TraceComponent::~TraceComponent
virtual ~TraceComponent()
TraceComponent::m_supported_op_flags
uint32_t m_supported_op_flags
supported component operational mode flags - derived class to intialise.
Definition trc_component.h:134
TraceComponent::m_op_flags
uint32_t m_op_flags
current component operational mode flags.
Definition trc_component.h:133
TraceComponent::setComponentName
void setComponentName(const std::string &name)
Definition trc_component.h:64
TraceComponent::setComponentOpMode
ocsd_err_t setComponentOpMode(uint32_t op_flags)
TraceComponent::getErrorLogLevel
const ocsd_err_severity_t getErrorLogLevel() const
Definition trc_component.h:126
TraceComponent::getComponentName
const std::string & getComponentName() const
Definition trc_component.h:63
TraceComponent::updateErrorLogLevel
void updateErrorLogLevel()
TraceComponent::isLoggingErrorLevel
const bool isLoggingErrorLevel(const ocsd_err_severity_t level) const
Definition trc_component.h:127
TraceComponent::TraceComponent
TraceComponent(const std::string &name)
TraceComponent::setAssocComponent
void setAssocComponent(TraceComponent *assocComp)
Definition trc_component.h:103
TraceComponent::Init
void Init(const std::string &name)
TraceComponent::LogMessage
void LogMessage(const ocsd_err_severity_t filter_level, const std::string &msg)
TraceComponent::LogError
void LogError(const ocsdError &Error)
TraceComponent::do_attach_notify
void do_attach_notify(const int num_attached)
TraceComponent::getSupportedOpModes
const uint32_t getSupportedOpModes() const
Definition trc_component.h:95
TraceComponent::TraceComponent
TraceComponent(const std::string &name, int instIDNum)
TraceComponent::getAssocComponent
TraceComponent * getAssocComponent()
Definition trc_component.h:111
TraceComponent::LogDefMessage
void LogDefMessage(const std::string &msg)
Definition trc_component.h:116
TraceComponent::errLogAttachMonitor
friend class errLogAttachMonitor
Definition trc_component.h:122
componentAttachPt
Single component interface pointer attachment point.
Definition comp_attach_pt_t.h:61
ocsdError
Definition ocsd_error.h:58
comp_attach_pt_t.h
OpenCSD : Component attachment point interface class.
ocsd_hndl_err_log_t
unsigned int ocsd_hndl_err_log_t
Definition ocsd_if_types.h:145
ocsd_err_severity_t
enum _ocsd_err_severity_t ocsd_err_severity_t
ocsd_err_t
enum _ocsd_err_t ocsd_err_t
ocsd_error.h
OpenCSD : Library Error class.
trc_error_log_i.h
OpenCSD :