mirror of
https://github.com/nasa/fprime.git
synced 2025-12-10 17:47:10 -06:00
* Add new Fw::StringBase type StaticString for strings backed my immutable literals * Spellcheck fix * Add disclaimer comment about use of StaticString * Refactor the StringBase interface into an immutable ConstStringBase abstract base class and the now mutable StringBase class * Rename StaticString to ConstExternalString and inherit from ConstStringBase * Fix typo * Change references from StringBase to ConstStringBase where applicable * Updates following review meeting: add missing deserialize function and add new error status, move length function implementation into ConstStringBase so it is not pure virtual * Clang format fix * Additional clang-format fixes * Fix the copy-assignment operator for StringBase not being correctly evaluated * Clang format fix * Explicitly delete the Serializable assignment operator and provide a skeleton implementation for RawTimeInterface to appease the compiler * Revert "Explicitly delete the Serializable assignment operator and provide a skeleton implementation for RawTimeInterface to appease the compiler" This reverts commit 086d7bcd3ca9c4f6e553d7fc34d0d126a69a165b. * Move ConstStringBase to separate hpp/cpp files, plus other pull request feedback * Clang format fix * Update length implementation for ConstStringBase and ConstExternalString * Improved asserts in ConstExternalString constructor Co-authored-by: Rob Bocchino <bocchino@icloud.com> * Fixed ConstStringBase length implementation Co-authored-by: Rob Bocchino <bocchino@icloud.com> * Clang format fix * Add some UTs for ConstExternalString, fix non-overridden interfaces, and fix ConstStringBase::maxLength asserting for zero capacity strings * Spell-check fix for ConstExternalString UTs * Revise length implementation in ConstStringBase If the capacity is zero, return zero * Format --------- Co-authored-by: Ian Brault <ian.r.brault@jpl.nasa.gov> Co-authored-by: Rob Bocchino <bocchino@icloud.com> Co-authored-by: Rob Bocchino <bocchino@jpl.nasa.gov> Co-authored-by: M Starch <LeStarch@googlemail.com>
91 lines
3.5 KiB
C++
91 lines
3.5 KiB
C++
// ======================================================================
|
|
// \title SeqDispatcher.hpp
|
|
// \author zimri.leisher
|
|
// \brief hpp file for SeqDispatcher component implementation class
|
|
// ======================================================================
|
|
|
|
#ifndef SeqDispatcher_HPP
|
|
#define SeqDispatcher_HPP
|
|
|
|
#include "Fw/Types/StringBase.hpp"
|
|
#include "Fw/Types/WaitEnumAc.hpp"
|
|
#include "Svc/SeqDispatcher/SeqDispatcherComponentAc.hpp"
|
|
#include "Svc/SeqDispatcher/SeqDispatcher_CmdSequencerStateEnumAc.hpp"
|
|
#include "config/FppConstantsAc.hpp"
|
|
|
|
namespace Svc {
|
|
|
|
class SeqDispatcher final : public SeqDispatcherComponentBase {
|
|
public:
|
|
// ----------------------------------------------------------------------
|
|
// Construction, initialization, and destruction
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Construct object SeqDispatcher
|
|
//!
|
|
SeqDispatcher(const char* const compName /*!< The component name*/
|
|
);
|
|
|
|
//! Destroy object SeqDispatcher
|
|
//!
|
|
~SeqDispatcher();
|
|
|
|
protected:
|
|
//! Handler for input port seqDoneIn
|
|
void seqDoneIn_handler(FwIndexType portNum, //!< The port number
|
|
FwOpcodeType opCode, //!< Command Op Code
|
|
U32 cmdSeq, //!< Command Sequence
|
|
const Fw::CmdResponse& response //!< The command response argument
|
|
);
|
|
|
|
//! Handler for input port seqStartIn
|
|
void seqStartIn_handler(FwIndexType portNum, //!< The port number
|
|
const Fw::StringBase& fileName //!< The sequence file
|
|
);
|
|
|
|
//! Handler for input port seqRunIn
|
|
void seqRunIn_handler(FwIndexType portNum, //!< The port number
|
|
const Fw::StringBase& fileName //!< The sequence file
|
|
);
|
|
|
|
private:
|
|
// number of sequences dispatched (successful or otherwise)
|
|
U32 m_dispatchedCount = 0;
|
|
// number of errors from dispatched sequences (CmdResponse::EXECUTION_ERROR)
|
|
U32 m_errorCount = 0;
|
|
// number of sequencers in state AVAILABLE
|
|
U32 m_sequencersAvailable = SeqDispatcherSequencerPorts;
|
|
|
|
struct DispatchEntry {
|
|
FwOpcodeType opCode; //!< opcode of entry
|
|
U32 cmdSeq;
|
|
// store the state of each sequencer
|
|
SeqDispatcher_CmdSequencerState state;
|
|
// store the sequence currently running for each sequencer
|
|
Fw::String sequenceRunning = "<no seq>";
|
|
} m_entryTable[SeqDispatcherSequencerPorts]; //!< table of dispatch
|
|
//!< entries
|
|
|
|
FwIndexType getNextAvailableSequencerIdx();
|
|
|
|
void runSequence(FwIndexType sequencerIdx, const Fw::ConstStringBase& fileName, Fw::Wait block);
|
|
|
|
// ----------------------------------------------------------------------
|
|
// Command handler implementations
|
|
// ----------------------------------------------------------------------
|
|
|
|
//! Implementation for RUN command handler
|
|
//!
|
|
void RUN_cmdHandler(const FwOpcodeType opCode, /*!< The opcode*/
|
|
const U32 cmdSeq, /*!< The command sequence number*/
|
|
const Fw::CmdStringArg& fileName, /*!< The name of the sequence file*/
|
|
Fw::Wait block);
|
|
|
|
void LOG_STATUS_cmdHandler(const FwOpcodeType opCode, /*!< The opcode*/
|
|
const U32 cmdSeq); /*!< The command sequence number*/
|
|
};
|
|
|
|
} // namespace Svc
|
|
|
|
#endif
|