WarpTwin
Documentation for WarpTwin models and classes.
Loading...
Searching...
No Matches
warptwin::WarpTwinPyConfigWriter Class Reference

Write out WarpTwin Python file from node information. More...

#include <WarpTwinPyConfigWriter.h>

Inheritance diagram for warptwin::WarpTwinPyConfigWriter:

Public Member Functions

 WarpTwinPyConfigWriter ()
virtual ~WarpTwinPyConfigWriter ()
std::future< int > build ()
 Write the Python file and run with a zero step to show updates.
std::future< int > run ()
 Write the Python file and run as configured.
std::vector< int > stop (std::vector< std::string > &pids)
 Stop the PIDs related to execution of the Python file.
int post ()
 Call the dallin tool to post process data.
void resetRunStatus ()
 Reset the run status boolean.
Public Member Functions inherited from warptwin::ConfigurationWriter
 ConfigurationWriter ()
virtual ~ConfigurationWriter ()
void file (const std::string &filename)
 Set the file for write and redirect output to that file.
std::string file ()
void eventLogger (EventLogger *logger_ptr)
 Set the event logger instance for error logging.
void watchNode (ImNode *target)
 Add a node to the ConfigurationWriter for tracking.
void unwatchNode (ImNode *target)
 Remove a node from the ConfigurationWriter for tracking.
virtual void write ()
 Write watched node data to file.
std::future< int > run ()
 Write, build, and run the resulting file.
int post ()
 Run post-processing as applicable.

Protected Member Functions

int _runPythonSim (const std::string &cmd)
 Function wrapper of system() call for async purposes.
std::vector< std::string > _getPythonScriptPIDs ()
 Retrieves the list of PIDs generated by running the Python file.
std::vector< std::string > _getStreamlitPIDs ()
 Retrieves the list of PIDs generated by running the Streamlit app.
void _killStreamlitPIDs ()
 Kill the PIDs generated by running the Streamlit app.
virtual void _setNodeConnectionSequence () override
 Set the sequence of nodes for creation and write paired connections.
virtual void _decomposeNodeInformation () override
 Decompose all relevant strings from the provided node and connection information.
virtual void _writeOutputStart () override
 Write the start of the file.
virtual void _writeDataValue (ImNode *node) override
 Write the creation of a single node, given by node.
virtual void _writeDataConnection (Connection *upstream, Connection *downstream) override
 Write the connection of one "Connection" to another.
virtual void _writeLogData () override
 Write all logged data to file.
virtual void _writeOutputEnd () override
 Write the end of the file output.
std::string _getSignalName (Connection *signal)
 Get the full warptwin name of a signal from Connection object.
ImNode_getNodeByUid (int uid)
 Get pointer to a node by uid.
Connection_getConnectionByUid (int uid)
 Get pointer to connection by uid.
std::vector< Connection * > _getConnectionsByName (ImNode *node, const std::string &name)
 Return all connections matching set criteria in a node.
std::vector< Connection * > _getConnectionsByType (ImNode *node, int type)
 Return all connections matching set criteria in a node.

Protected Attributes

bool _is_run
 Boolean to indicate whether this is a build or run. True indicates run.
bool _is_build
 Boolean to indicate whether this is a build or run. True indicates build.
Protected Attributes inherited from warptwin::ConfigurationWriter
AutoDoc_autodoc_ptr
EventLogger_logger_ptr
std::vector< ImNode * > _watched_nodes
std::vector< ImNode * > _sequenced_nodes
std::vector< std::pair< Connection *, Connection * > > _paired_connections
std::string _filename = "gui_config_file.py"

Detailed Description

Write out WarpTwin Python file from node information.

Constructor & Destructor Documentation

◆ WarpTwinPyConfigWriter()

warptwin::WarpTwinPyConfigWriter::WarpTwinPyConfigWriter ( )
inline

◆ ~WarpTwinPyConfigWriter()

virtual warptwin::WarpTwinPyConfigWriter::~WarpTwinPyConfigWriter ( )
inlinevirtual

Member Function Documentation

◆ _decomposeNodeInformation()

void warptwin::WarpTwinPyConfigWriter::_decomposeNodeInformation ( )
overrideprotectedvirtual

Decompose all relevant strings from the provided node and connection information.

Reimplemented from warptwin::ConfigurationWriter.

◆ _getConnectionByUid()

Connection * warptwin::WarpTwinPyConfigWriter::_getConnectionByUid ( int uid)
protected

Get pointer to connection by uid.

Parameters
uidThe uid to search
Returns
Pointer to connection associated with uid. Nullptr if not found

◆ _getConnectionsByName()

std::vector< Connection * > warptwin::WarpTwinPyConfigWriter::_getConnectionsByName ( ImNode * node,
const std::string & name )
protected

Return all connections matching set criteria in a node.

Parameters
nodeThe node to search
nameThe name to search for
Returns
A vector of all connections matching the criteria

◆ _getConnectionsByType()

std::vector< Connection * > warptwin::WarpTwinPyConfigWriter::_getConnectionsByType ( ImNode * node,
int type )
protected

Return all connections matching set criteria in a node.

Parameters
typeThe connection type to search for
nameThe name to search for
Returns
A vector of all connections matching the criteria

◆ _getNodeByUid()

ImNode * warptwin::WarpTwinPyConfigWriter::_getNodeByUid ( int uid)
protected

Get pointer to a node by uid.

Parameters
uidThe uid to search
Returns
Pointer to node associated with uid. Nullptr if not found

◆ _getPythonScriptPIDs()

std::vector< std::string > warptwin::WarpTwinPyConfigWriter::_getPythonScriptPIDs ( )
protected

Retrieves the list of PIDs generated by running the Python file.

Returns
Vector of PIDs

◆ _getSignalName()

std::string warptwin::WarpTwinPyConfigWriter::_getSignalName ( Connection * signal)
protected

Get the full warptwin name of a signal from Connection object.

Parameters
signalThe signal to resolve name of
Returns
String with signal name

◆ _getStreamlitPIDs()

std::vector< std::string > warptwin::WarpTwinPyConfigWriter::_getStreamlitPIDs ( )
protected

Retrieves the list of PIDs generated by running the Streamlit app.

Returns
Vector of PIDs

◆ _killStreamlitPIDs()

void warptwin::WarpTwinPyConfigWriter::_killStreamlitPIDs ( )
protected

Kill the PIDs generated by running the Streamlit app.

◆ _runPythonSim()

int warptwin::WarpTwinPyConfigWriter::_runPythonSim ( const std::string & cmd)
protected

Function wrapper of system() call for async purposes.

Parameters
cmdCommand to run python script
Returns
Result of python script execution

◆ _setNodeConnectionSequence()

void warptwin::WarpTwinPyConfigWriter::_setNodeConnectionSequence ( )
overrideprotectedvirtual

Set the sequence of nodes for creation and write paired connections.

Reimplemented from warptwin::ConfigurationWriter.

◆ _writeDataConnection()

void warptwin::WarpTwinPyConfigWriter::_writeDataConnection ( Connection * upstream,
Connection * downstream )
overrideprotectedvirtual

Write the connection of one "Connection" to another.

Parameters
upstreamThe data output connection (typically, but not always an output) to connect
downstreamThe data input connection (typically, but not always an input) to connect

Reimplemented from warptwin::ConfigurationWriter.

◆ _writeDataValue()

void warptwin::WarpTwinPyConfigWriter::_writeDataValue ( ImNode * node)
overrideprotectedvirtual

Write the creation of a single node, given by node.

Parameters
nodeThe node to write to file

Reimplemented from warptwin::ConfigurationWriter.

◆ _writeLogData()

void warptwin::WarpTwinPyConfigWriter::_writeLogData ( )
overrideprotectedvirtual

Write all logged data to file.

Reimplemented from warptwin::ConfigurationWriter.

◆ _writeOutputEnd()

void warptwin::WarpTwinPyConfigWriter::_writeOutputEnd ( )
overrideprotectedvirtual

Write the end of the file output.

Reimplemented from warptwin::ConfigurationWriter.

◆ _writeOutputStart()

void warptwin::WarpTwinPyConfigWriter::_writeOutputStart ( )
overrideprotectedvirtual

Write the start of the file.

Reimplemented from warptwin::ConfigurationWriter.

◆ build()

std::future< int > warptwin::WarpTwinPyConfigWriter::build ( )
virtual

Write the Python file and run with a zero step to show updates.

Implements warptwin::ConfigurationWriter.

◆ post()

int warptwin::WarpTwinPyConfigWriter::post ( )

Call the dallin tool to post process data.

◆ resetRunStatus()

void warptwin::WarpTwinPyConfigWriter::resetRunStatus ( )
inline

Reset the run status boolean.

◆ run()

std::future< int > warptwin::WarpTwinPyConfigWriter::run ( )

Write the Python file and run as configured.

◆ stop()

std::vector< int > warptwin::WarpTwinPyConfigWriter::stop ( std::vector< std::string > & pids)

Stop the PIDs related to execution of the Python file.

Parameters
pidsVector of PIDs to be populated
Returns
Result of system command to stop the PIDs

Member Data Documentation

◆ _is_build

bool warptwin::WarpTwinPyConfigWriter::_is_build
protected

Boolean to indicate whether this is a build or run. True indicates build.

◆ _is_run

bool warptwin::WarpTwinPyConfigWriter::_is_run
protected

Boolean to indicate whether this is a build or run. True indicates run.


The documentation for this class was generated from the following files: