WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
LogEvent.h
/******************************************************************************
* Copyright (c) ATTX INC 2025. All Rights Reserved. 
*
* This software and associated documentation (the "Software") are the 
* proprietary and confidential information of ATTX INC. The Software is 
* furnished under a license agreement between ATTX and the user organization 
* and may be used or copied only in accordance with the terms of the agreement.
* Refer to 'license/attx_license.adoc' for standard license terms.
*
* EXPORT CONTROL NOTICE: THIS SOFTWARE MAY INCLUDE CONTENT CONTROLLED UNDER THE
* INTERNATIONAL TRAFFIC IN ARMS REGULATIONS (ITAR) OR THE EXPORT ADMINISTRATION 
* REGULATIONS (EAR99). No part of the Software may be used, reproduced, or 
* transmitted in any form or by any means, for any purpose, without the express 
* written permission of ATTX INC.
******************************************************************************/
/*
Log Event header file

Author: Alex Reynolds
*/
/*
Metadata for MS GUI:
imdata = {"exclude" : True}
*/

#ifndef EVENTS_LOG_EVENT_H
#define EVENTS_LOG_EVENT_H

#include "core/clockwerkerrors.h"
#include "logging/SimLogger.h"
#include "simulation/SimulationSteps.h"
#include "simulation/Model.h"

namespace warptwin {

    /// @brief   Class to execute logging
    /// 
    /// This event executes logging in the specified logger whenever
    /// triggered. The triggering events will be determined by the
    /// selected monitor.
    MODEL(LogEvent)
    public:
        START_PARAMS
        END_PARAMS

        START_INPUTS
            ///  Our trigger -- this is the flag set and unset by the monitor as
            ///  its ultimate output, and should be used downstream by events, etc.
            SIGNAL(trigger,         bool,               false)
        END_INPUTS

        START_OUTPUTS
        END_OUTPUTS

        /// @brief Set the sim logger run by this event
        /// @param logger The sim logger to tie to this event
        void setSimLogger(clockwerk::SimLogger* logger);

    protected:
        /// @brief   Function to set up and start our logger
        int16 start() override;

        /// @brief   Function to check monitor input conditions and set trigger
        ///          flag accordingly. Should be implemented in derived class
        /// @return  Error code corresponding to success/failure
        /// @note    Will NOT run if trigger and persistence are true
        int16 execute() override;

        /// Handle to our logger object
        clockwerk::SimLogger* _logger = nullptr;
    };

}

#endif