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