Marine systems simulation
ExternalLinkStandard.h
1
47#ifndef EXTERNAL_LINK_STANDARD_H
48#define EXTERNAL_LINK_STANDARD_H
49
50
51#include <mutex>
52
53
54#include "ExternalLink.h"
55/*
56#include <vector>
57using std::vector;*/
58#include <map>
59using std::map;
60
61
62class ExternalLinkStandard : public ExternalLink
63{
64 public:
65 ExternalLinkStandard(string simObjectName, ISimObjectCreator* creator);
67 virtual bool SetMyOutputPort(const string& portName, const double* portValueArray);
68 virtual bool SetMyOutputPortWithCopy(const string& portName, const double* portValueArray);
69 virtual const double* GetMyInputPort(const string& portName);
70 virtual bool SetMyOutputPort(int portIndex, const double* portValueArray);
71 virtual bool SetMyOutputPortWithCopy(int portIndex, const double* portValueArray);
72 virtual const double* GetMyInputPort(int portIndex);
73 virtual vector<string> GetAllInputPorts();
74 virtual vector<string> GetAllOutputPorts();
75 virtual int GetInputPortSize(string portName);
76 virtual int GetOutputPortSize(string portName);
77 virtual int GetInputPortSize(int portIndex);
78 virtual int GetOutputPortSize(int portIndex);
79 //virtual void UpdateStatesAndTime(const double T, const double* const X); /// refresh state and time values. Must be called before GetMyInputPort
80
81
82 virtual int GetMyInputPortIndex(const string& portName);
83 virtual bool SetMyOutputPortWithIndex(const int portName, const double* portValueArray);
84 virtual bool SetMyOutputPortWithCopyWithIndex(const int portName, const double* portValueArray);
85
86
87 protected:
88 const double* externalPort(const double T, const double* const X, const int index);
89
90 const double** m_OutputArrays;
94 ISignalPort** m_InputPorts;
97 map<string, int> m_OutputPortIndex;
98 map<string, int> m_InputPortIndex;
99 //const double* m_X; /// holds the last updated simulation state array
100 //double m_T; /// holds the last updated simulation time
101
102 static std::recursive_mutex s_Mutex;
103};
104
105#endif
Definition: ExternalLinkStandard.h:63
virtual bool SetMyOutputPort(int portIndex, const double *portValueArray)
Gets value of externalobject input port.
int m_numInputPorts
size of all input ports
Definition: ExternalLinkStandard.h:96
double ** m_LocalBufferArrays
size of all output ports
Definition: ExternalLinkStandard.h:92
int m_numOutputPorts
holds pointers to initialized values
Definition: ExternalLinkStandard.h:93
map< string, int > m_OutputPortIndex
number of inputPorts;
Definition: ExternalLinkStandard.h:97
virtual int GetMyInputPortIndex(const string &portName)
Get size of output port.
virtual int GetOutputPortSize(string portName)
Get size of input port.
virtual bool SetMyOutputPortWithCopy(const string &portName, const double *portValueArray)
Sets value of externalobject output port. Only stores pointer, does NOT copy values.
const double ** m_OutputArrays
indexed output port. See PortDefs.h.
Definition: ExternalLinkStandard.h:90
virtual int GetOutputPortSize(int portIndex)
Get size of input port.
virtual bool SetMyOutputPortWithCopyWithIndex(const int portName, const double *portValueArray)
Sets value of externalobject output port. Only stores pointer, does NOT copy values.
virtual bool SetMyOutputPortWithCopy(int portIndex, const double *portValueArray)
Sets value of externalobject output port. Only stores pointer, does NOT copy values.
int * m_inputPortSize
holds pointers to all input port ISignalPorts
Definition: ExternalLinkStandard.h:95
virtual int GetInputPortSize(int portIndex)
Get size of output port.
virtual bool SetMyOutputPortWithIndex(const int portName, const double *portValueArray)
Gets index of externalobject input port.
ISignalPort ** m_InputPorts
number of outputPorts;
Definition: ExternalLinkStandard.h:94
virtual int GetInputPortSize(string portName)
Get names of all output ports.
const double * externalPort(const double T, const double *const X, const int index)
Sets value of externalobject output port. Copies values to internal buffer.
static std::recursive_mutex s_Mutex
maps the names of input ports to index in m_InputPorts
Definition: ExternalLinkStandard.h:102
virtual vector< string > GetAllInputPorts()
Gets value of externalobject input port.
int * m_outputPortSize
holds pointers to all output port arrays
Definition: ExternalLinkStandard.h:91
virtual ~ExternalLinkStandard()
reads parameters, registers states, input/output ports and shared resources
virtual const double * GetMyInputPort(int portIndex)
Sets value of externalobject output port. Copies values to internal buffer.
virtual vector< string > GetAllOutputPorts()
Get names of all input ports.
map< string, int > m_InputPortIndex
maps the names of output ports to index in m_OutputArrays
Definition: ExternalLinkStandard.h:98
virtual const double * GetMyInputPort(const string &portName)
Sets value of externalobject output port. Copies values to internal buffer.