fprime/Svc/AssertFatalAdapter/AssertFatalAdapterComponentImpl.hpp
Joshua Anderson 3cccd731d9
Refactor FW_OBJECT_NAMES switches and fix building without object names
Instead of adding the name argument to a constructor when FW_OBJECT_NAMES
is enabled, always supply a name argument.

Add a marco that conditionally sets the name to "" if FW_OBJECT_NAMES is not set.
This cleans up a lot of the conditional compilation switches that weren't being tested
and would silently break, while still stripping the strings from the binary.
2020-10-07 17:19:05 -07:00

92 lines
2.5 KiB
C++

// ======================================================================
// \title AssertFatalAdapterImpl.hpp
// \author tcanham
// \brief hpp file for AssertFatalAdapter component implementation class
//
// \copyright
// Copyright 2009-2015, by the California Institute of Technology.
// ALL RIGHTS RESERVED. United States Government Sponsorship
// acknowledged.
//
// ======================================================================
#ifndef AssertFatalAdapter_HPP
#define AssertFatalAdapter_HPP
#include "Svc/AssertFatalAdapter/AssertFatalAdapterComponentAc.hpp"
namespace Svc {
class AssertFatalAdapterComponentImpl :
public AssertFatalAdapterComponentBase
{
public:
// ----------------------------------------------------------------------
// Construction, initialization, and destruction
// ----------------------------------------------------------------------
//! Construct object AssertFatalAdapter
//!
AssertFatalAdapterComponentImpl(
const char *const compName /*!< The component name*/
);
//! Initialize object AssertFatalAdapter
//!
void init(
const NATIVE_INT_TYPE instance = 0 /*!< The instance number*/
);
//! Destroy object AssertFatalAdapter
//!
~AssertFatalAdapterComponentImpl(void);
//! Report the assert as a FATAL
void reportAssert(
FILE_NAME_ARG file,
NATIVE_UINT_TYPE lineNo,
NATIVE_UINT_TYPE numArgs,
AssertArg arg1,
AssertArg arg2,
AssertArg arg3,
AssertArg arg4,
AssertArg arg5,
AssertArg arg6
);
private:
class AssertFatalAdapter : public Fw::AssertHook {
public:
AssertFatalAdapter();
~AssertFatalAdapter();
void regAssertReporter(AssertFatalAdapterComponentImpl* compPtr);
private:
void reportAssert(
FILE_NAME_ARG file,
NATIVE_UINT_TYPE lineNo,
NATIVE_UINT_TYPE numArgs,
AssertArg arg1,
AssertArg arg2,
AssertArg arg3,
AssertArg arg4,
AssertArg arg5,
AssertArg arg6
);
// Prevent actual assert since FATAL handler will deal with it
void doAssert(void);
AssertFatalAdapterComponentImpl* m_compPtr;
};
AssertFatalAdapter m_adapter;
};
} // end namespace Svc
#endif