![]() |
F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
|
Implementation of malloc based allocator. More...
Namespaces | |
| BasicTypes | |
| DpCfg | |
| MemoryAllocation | |
| StringUtils | |
Enumerations | |
| enum | FormatStatus { FormatStatus::SUCCESS, FormatStatus::OVERFLOWED, FormatStatus::INVALID_FORMAT_STRING, FormatStatus::SIZE_OVERFLOW, FormatStatus::OTHER_ERROR } |
| status of string format calls More... | |
| enum | ScanStatus { ScanStatus::SUCCESS, ScanStatus::INVALID_FORMAT_STRING, ScanStatus::SIZE_OVERFLOW, ScanStatus::UNTERMINATED_SOURCE_STRING, ScanStatus::OTHER_ERROR } |
| status of string scan calls More... | |
| enum | SerializeStatus { FW_SERIALIZE_OK, FW_SERIALIZE_FORMAT_ERROR, FW_SERIALIZE_NO_ROOM_LEFT, FW_DESERIALIZE_BUFFER_EMPTY, FW_DESERIALIZE_FORMAT_ERROR, FW_DESERIALIZE_SIZE_MISMATCH, FW_DESERIALIZE_TYPE_MISMATCH, FW_DESERIALIZE_IMMUTABLE, FW_DESERIALIZE_INVALID_DATA, FW_SERIALIZE_DISCARDED_EXISTING } |
| forward declaration for string More... | |
| enum | Endianness { Endianness::BIG, Endianness::LITTLE } |
Functions | |
| template<typename T > | |
| T * | arrayPlacementNew (Fw::ByteArray array, FwSizeType arraySize) |
| placement new for arrays More... | |
| template<typename T > | |
| void | arrayPlacementDestruct (T *arrayPointer, FwSizeType arraySize) |
| placement delete for arrays More... | |
| FW_ASSERT_NORETURN void | defaultSwAssert (FILE_NAME_ARG file, FwSizeType lineNo, FwSizeType numArgs, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwAssertArgType arg4, FwAssertArgType arg5, FwAssertArgType arg6) |
| void | SwAssert (FILE_NAME_ARG file, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with no arguments. More... | |
| void | SwAssert (FILE_NAME_ARG file, FwAssertArgType arg1, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with one argument. More... | |
| void | SwAssert (FILE_NAME_ARG file, FwAssertArgType arg1, FwAssertArgType arg2, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with two arguments. More... | |
| void | SwAssert (FILE_NAME_ARG file, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with three arguments. More... | |
| void | SwAssert (FILE_NAME_ARG file, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwAssertArgType arg4, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with four arguments. More... | |
| void | SwAssert (FILE_NAME_ARG file, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwAssertArgType arg4, FwAssertArgType arg5, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with five arguments. More... | |
| void | SwAssert (FILE_NAME_ARG file, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwAssertArgType arg4, FwAssertArgType arg5, FwAssertArgType arg6, FwSizeType lineNo) NOINLINE FW_ASSERT_NORETURN |
| Assert with six arguments. More... | |
| void | formatAssertMessage (FILE_NAME_ARG file, FwSizeType lineNo, FwSizeType numArgs, FwAssertArgType arg1, FwAssertArgType arg2, FwAssertArgType arg3, FwAssertArgType arg4, FwAssertArgType arg5, FwAssertArgType arg6, CHAR *destBuffer, FwSizeType buffSize) |
| format an assert message More... | |
| void | printAssertMessage (const CHAR *msg) |
| print an assert message More... | |
| void | terminateOnAssert () |
| terminate after a failed assertion More... | |
| FormatStatus | stringFormat (char *destination, const FwSizeType maximumSize, const char *formatString,...) |
| format a c-string More... | |
| FormatStatus | stringFormat (char *destination, const FwSizeType maximumSize, const char *formatString, va_list args) |
| format a c-string More... | |
| ScanStatus | stringScan (FwSizeType &count, const char *source, FwSizeType maximumSize, const char *formatString,...) |
| scan a c-string More... | |
| ScanStatus | stringScan (FwSizeType &count, const char *source, FwSizeType maximumSize, const char *formatString, va_list args) |
| scan a c-string using a variable argument list More... | |
Variables | |
| const Time | ZERO_TIME = Time() |
| constexpr None_t | NONE = None_t() |
| Global constant representing an absent/empty optional value. More... | |
Implementation of malloc based allocator.
File: Logger.cpp Description: Framework logging implementation Author: mstarch
This file adds in support to the core 'Fw' package, to separate it from Os and other loggers, and allow the architect of the system to select which core framework logging should be used.
C-string helper utilities. Note: wherever possible, use Fw::StringBase and derived classes instead of raw C-strings. Each function below documents the standard C string call it is a bounded, safe replacement for.
| using Fw::CmdArgBuffer = typedef LinearBufferTemplate<FW_CMD_ARG_BUFFER_MAX_SIZE> |
Definition at line 14 of file CmdArgBuffer.hpp.
| using Fw::CmdStringArg = typedef StringTemplate<FW_CMD_STRING_MAX_SIZE> |
Definition at line 14 of file CmdString.hpp.
| using Fw::ComBuffer = typedef LinearBufferTemplate<FW_COM_BUFFER_MAX_SIZE> |
Definition at line 14 of file ComBuffer.hpp.
| using Fw::ComPacketType = typedef ComCfg::Apid::T |
Definition at line 20 of file ComPacket.hpp.
| using Fw::FileNameString = typedef StringTemplate<FileNameStringSize> |
Definition at line 15 of file FileNameString.hpp.
Definition at line 15 of file InternalInterfaceString.hpp.
| using Fw::LogBuffer = typedef LinearBufferTemplate<FW_LOG_BUFFER_MAX_SIZE> |
Definition at line 14 of file LogBuffer.hpp.
| using Fw::LogStringArg = typedef StringTemplate<FW_LOG_STRING_MAX_SIZE> |
Definition at line 14 of file LogString.hpp.
| using Fw::ObjectName = typedef StringTemplate<FW_OBJ_NAME_BUFFER_SIZE> |
Definition at line 14 of file ObjectName.hpp.
| using Fw::ParamBuffer = typedef LinearBufferTemplate<FW_PARAM_BUFFER_MAX_SIZE> |
Definition at line 18 of file PrmBuffer.hpp.
| using Fw::ParamString = typedef StringTemplate<FW_PARAM_STRING_MAX_SIZE> |
Definition at line 14 of file PrmString.hpp.
| using Fw::SmSignalBuffer = typedef LinearBufferTemplate<FW_SM_SIGNAL_BUFFER_MAX_SIZE> |
Definition at line 14 of file SmSignalBuffer.hpp.
| using Fw::String = typedef StringTemplate<FW_FIXED_LENGTH_STRING_SIZE> |
Definition at line 14 of file String.hpp.
| using Fw::TextLogString = typedef StringTemplate<FW_LOG_TEXT_BUFFER_SIZE> |
Definition at line 14 of file TextLogString.hpp.
| using Fw::TlmBuffer = typedef LinearBufferTemplate<FW_TLM_BUFFER_MAX_SIZE> |
Definition at line 14 of file TlmBuffer.hpp.
| using Fw::TlmString = typedef StringTemplate<FW_TLM_STRING_MAX_SIZE> |
Definition at line 14 of file TlmString.hpp.
|
strong |
| Enumerator | |
|---|---|
| BIG | Big endian serialization. |
| LITTLE | Little endian serialization. |
Definition at line 37 of file Serializable.hpp.
|
strong |
status of string format calls
Definition at line 18 of file format.hpp.
|
strong |
status of string scan calls
| enum Fw::SerializeStatus |
forward declaration for string
| Enumerator | |
|---|---|
| FW_SERIALIZE_OK | Serialization/Deserialization operation was successful. |
| FW_SERIALIZE_FORMAT_ERROR | Data was the wrong format (e.g. wrong packet type) |
| FW_SERIALIZE_NO_ROOM_LEFT | No room left in the buffer to serialize data. |
| FW_DESERIALIZE_BUFFER_EMPTY | Deserialization buffer was empty when trying to read more data. |
| FW_DESERIALIZE_FORMAT_ERROR | Deserialization data had incorrect values (unexpected data types) |
| FW_DESERIALIZE_SIZE_MISMATCH | Data was left in the buffer, but not enough to deserialize. |
| FW_DESERIALIZE_TYPE_MISMATCH | Deserialized type ID didn't match. |
| FW_DESERIALIZE_IMMUTABLE | Attempted to deserialize into an immutable buffer. |
| FW_DESERIALIZE_INVALID_DATA | Data failed validation. |
| FW_SERIALIZE_DISCARDED_EXISTING | Serialization succeeded, but deleted old data. |
Definition at line 14 of file Serializable.hpp.
| void Fw::arrayPlacementDestruct | ( | T * | arrayPointer, |
| FwSizeType | arraySize | ||
| ) |
placement delete for arrays
This is the partner of tha above function that performs the destructor operation on every element of type T in the array. This assumes that all elements have been constructed.
| T | the type of the array elements |
| arrayPointer | pointer to an array of type T |
| arraySize | the number of elements in the array |
Definition at line 62 of file LanguageHelpers.hpp.
| T* Fw::arrayPlacementNew | ( | Fw::ByteArray | array, |
| FwSizeType | arraySize | ||
| ) |
placement new for arrays
C++ as a language does not guaranteed that placement new for a C++ array of length N will fit within a memory region of size N *sizeof(T). Moreover, there are some compilers whose implementation of placement new for arrays do not guarantee this property.
This function provides a helper for placement new for arrays that guarantees that the array will fit within the provided memory region. It checks that the provided memory region is large enough to hold the array (N * sizeof(T) and that the alignment of the provided memory region is sufficient for the type T. It also checks that the provided memory region is non-null.
| T | the type of the array elements |
| array | the byte array to use for placement new (pair of bytes pointer and size) |
| arraySize | the number of elements in the array |
Definition at line 36 of file LanguageHelpers.hpp.
| FW_ASSERT_NORETURN void Fw::defaultSwAssert | ( | FILE_NAME_ARG | file, |
| FwSizeType | lineNo, | ||
| FwSizeType | numArgs, | ||
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwAssertArgType | arg3, | ||
| FwAssertArgType | arg4, | ||
| FwAssertArgType | arg5, | ||
| FwAssertArgType | arg6 | ||
| ) |
Definition at line 50 of file Assert.cpp.
| void Fw::formatAssertMessage | ( | FILE_NAME_ARG | file, |
| FwSizeType | lineNo, | ||
| FwSizeType | numArgs, | ||
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwAssertArgType | arg3, | ||
| FwAssertArgType | arg4, | ||
| FwAssertArgType | arg5, | ||
| FwAssertArgType | arg6, | ||
| CHAR * | destBuffer, | ||
| FwSizeType | buffSize | ||
| ) |
format an assert message
Formats the location of a failed assertion and its arguments into destBuffer. Called by the framework when no Fw::AssertHook is registered, by the default Fw::AssertHook::reportAssert, and by Svc::AssertFatalAdapter. Implementations must leave destBuffer null-terminated whenever buffSize is greater than zero; an empty string is acceptable.
| file | file name or file ID (depending on FW_ASSERT_LEVEL) |
| lineNo | line number where the assert occurred |
| numArgs | number of additional arguments (0-6) |
| arg1 | assert argument 1 (used when numArgs >= 1) |
| arg2 | assert argument 2 (used when numArgs >= 2) |
| arg3 | assert argument 3 (used when numArgs >= 3) |
| arg4 | assert argument 4 (used when numArgs >= 4) |
| arg5 | assert argument 5 (used when numArgs >= 5) |
| arg6 | assert argument 6 (used when numArgs >= 6) |
| destBuffer | buffer to write the formatted message to |
| buffSize | size of destBuffer |
Definition at line 27 of file fputs_assert_hook.cpp.
| void Fw::printAssertMessage | ( | const CHAR * | msg | ) |
print an assert message
Outputs a message formatted by formatAssertMessage. Called by the framework when no Fw::AssertHook is registered and by the default Fw::AssertHook::printAssert.
| msg | null-terminated string containing the formatted assert message |
Definition at line 21 of file fputs_assert_hook.cpp.
| Fw::FormatStatus Fw::stringFormat | ( | char * | destination, |
| const FwSizeType | maximumSize, | ||
| const char * | formatString, | ||
| ... | |||
| ) |
format a c-string
Format a string using printf family formatting semantics. Destination will be filled with the formatted string up to maximumSize - 1. This function will always terminate the string with a \0.
This function can return several error codes: OVERFLOWED: the complete string did not fit in the buffer with an appended null-terminator INVALID_FORMAT_STRING: the format string was null OTHER_ERROR: another error occurred in an underlying function call Otherwise SUCCESS is returned. destination may be modified even in the case of an error.
| destination | destination to fill with the formatted string |
| maximumSize | size of the buffer represented by destination |
| formatString | format string to fill |
| ... | variable arguments inputs |
Definition at line 10 of file snprintf_format.cpp.
| Fw::FormatStatus Fw::stringFormat | ( | char * | destination, |
| const FwSizeType | maximumSize, | ||
| const char * | formatString, | ||
| va_list | args | ||
| ) |
format a c-string
Format a string using printf family formatting semantics. Destination will be filled with the formatted string up to maximumSize - 1. This function will always terminate the string with a \0.
This function can return several error codes: OVERFLOWED: the complete string did not fit in the buffer with an appended null-terminator INVALID_FORMAT_STRING: the format string was null OTHER_ERROR: another error occurred in an underlying function call Otherwise SUCCESS is returned. destination may be modified even in the case of an error.
This version takes a variable argument list
| destination | destination to fill with the formatted string |
| maximumSize | size of the buffer represented by destination |
| formatString | format string to fill |
| args | variable arguments list |
Definition at line 18 of file snprintf_format.cpp.
| Fw::ScanStatus Fw::stringScan | ( | FwSizeType & | count, |
| const char * | source, | ||
| FwSizeType | maximumSize, | ||
| const char * | formatString, | ||
| ... | |||
| ) |
scan a c-string
Scan a string using sscanf family formatting semantics. Source will be read according to the format string. The number of filled fields will be returned in count. Read characters will not exceed maximumSize.
This function can return several error codes: INVALID_FORMAT_STRING: the format string was null SIZE_OVERFLOW: FwSizeType overflowed the range of size_t OTHER_ERROR: another error occurred in an underlying function call Otherwise SUCCESS is returned.
| count | [output] number of filled fields |
| source | source string to scan |
| maximumSize | size of the buffer represented by source |
| formatString | format string to fill |
| ... | variable arguments inputs |
Definition at line 11 of file sscanf_scan.cpp.
| Fw::ScanStatus Fw::stringScan | ( | FwSizeType & | count, |
| const char * | source, | ||
| FwSizeType | maximumSize, | ||
| const char * | formatString, | ||
| va_list | args | ||
| ) |
scan a c-string using a variable argument list
Scan a string using sscanf family formatting semantics. Source will be read according to the format string. The number of filled fields will be returned in count. Read characters will not exceed maximumSize.
This function can return several error codes: INVALID_FORMAT_STRING: the format string was null SIZE_OVERFLOW: FwSizeType overflowed the range of size_t OTHER_ERROR: another error occurred in an underlying function call Otherwise SUCCESS is returned.
This version takes a variable argument list
| count | [output] number of filled fields |
| source | source string to scan |
| maximumSize | size of the buffer represented by source |
| formatString | format string to fill |
| args | variable arguments list |
Definition at line 23 of file sscanf_scan.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwSizeType | lineNo | ||
| ) |
Assert with no arguments.
Definition at line 75 of file Assert.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwAssertArgType | arg1, | ||
| FwSizeType | lineNo | ||
| ) |
Assert with one argument.
Definition at line 79 of file Assert.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwSizeType | lineNo | ||
| ) |
Assert with two arguments.
Definition at line 83 of file Assert.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwAssertArgType | arg3, | ||
| FwSizeType | lineNo | ||
| ) |
Assert with three arguments.
Definition at line 87 of file Assert.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwAssertArgType | arg3, | ||
| FwAssertArgType | arg4, | ||
| FwSizeType | lineNo | ||
| ) |
Assert with four arguments.
Definition at line 91 of file Assert.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwAssertArgType | arg3, | ||
| FwAssertArgType | arg4, | ||
| FwAssertArgType | arg5, | ||
| FwSizeType | lineNo | ||
| ) |
Assert with five arguments.
Definition at line 100 of file Assert.cpp.
| void Fw::SwAssert | ( | FILE_NAME_ARG | file, |
| FwAssertArgType | arg1, | ||
| FwAssertArgType | arg2, | ||
| FwAssertArgType | arg3, | ||
| FwAssertArgType | arg4, | ||
| FwAssertArgType | arg5, | ||
| FwAssertArgType | arg6, | ||
| FwSizeType | lineNo | ||
| ) |
Assert with six arguments.
Definition at line 110 of file Assert.cpp.
| void Fw::terminateOnAssert | ( | ) |
terminate after a failed assertion
Called by the framework after printAssertMessage when no Fw::AssertHook is registered, and by the default Fw::AssertHook::doAssert. Implementations typically call assert(false), which is compiled out when NDEBUG is defined; FW_ASSERTIONS_ALWAYS_ABORT then decides whether execution may continue.
Definition at line 17 of file fputs_assert_hook.cpp.
Global constant representing an absent/empty optional value.
Definition at line 31 of file Optional.hpp.