F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
SendFileRequestPortAc.cpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SendFileRequestPortAc.cpp
3 // \author Generated by fpp-to-cpp
4 // \brief cpp file for SendFileRequest port
5 // ======================================================================
6 
8 #include "Fw/Types/Assert.hpp"
10 
11 namespace Svc {
12 
13  namespace SendFileRequestPortStrings {
14 
15  // ----------------------------------------------------------------------
16  // StringSize100 class
17  // ----------------------------------------------------------------------
18 
21  StringBase()
22  {
23  this->m_buf[0] = 0;
24  }
25 
27  StringSize100(const char* src) :
28  StringBase()
29  {
30  Fw::StringUtils::string_copy(this->m_buf, src, sizeof(this->m_buf));
31  }
32 
34  StringSize100(const Fw::StringBase& src) :
35  StringBase()
36  {
37  Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
38  }
39 
41  StringSize100(const StringSize100& src) :
42  StringBase()
43  {
44  Fw::StringUtils::string_copy(this->m_buf, src.toChar(), sizeof(this->m_buf));
45  }
46 
49  {
50 
51  }
52 
54  operator=(const StringSize100& other)
55  {
56  if (this == &other) {
57  return *this;
58  }
59 
60  Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
61  return *this;
62  }
63 
65  operator=(const Fw::StringBase& other)
66  {
67  if (this == &other) {
68  return *this;
69  }
70 
71  Fw::StringUtils::string_copy(this->m_buf, other.toChar(), sizeof(this->m_buf));
72  return *this;
73  }
74 
76  operator=(const char* other)
77  {
78  Fw::StringUtils::string_copy(this->m_buf, other, sizeof(this->m_buf));
79  return *this;
80  }
81 
82  const char* StringSize100 ::
83  toChar() const
84  {
85  return this->m_buf;
86  }
87 
89  getCapacity() const
90  {
91  return sizeof(this->m_buf);
92  }
93 
94  }
95 
96  // ----------------------------------------------------------------------
97  // Input Port Member functions
98  // ----------------------------------------------------------------------
99 
102  Fw::InputPortBase(),
103  m_func(nullptr)
104  {
105 
106  }
107 
109  init()
110  {
112  }
113 
116  Fw::PassiveComponentBase* callComp,
117  CompFuncPtr funcPtr
118  )
119  {
120  FW_ASSERT(callComp != nullptr);
121  FW_ASSERT(funcPtr != nullptr);
122 
123  this->m_comp = callComp;
124  this->m_func = funcPtr;
125  this->m_connObj = callComp;
126  }
127 
129  invoke(
130  const SendFileRequestPortStrings::StringSize100& sourceFileName,
131  const SendFileRequestPortStrings::StringSize100& destFileName,
132  U32 offset,
133  U32 length
134  )
135  {
136 #if FW_PORT_TRACING == 1
137  this->trace();
138 #endif
139 
140  FW_ASSERT(this->m_comp != nullptr);
141  FW_ASSERT(this->m_func != nullptr);
142 
143  return this->m_func(this->m_comp, this->m_portNum, sourceFileName, destFileName, offset, length);
144  }
145 
146 #if FW_PORT_SERIALIZATION == 1
147 
148  Fw::SerializeStatus InputSendFileRequestPort ::
149  invokeSerial(Fw::SerializeBufferBase& _buffer)
150  {
151  // For ports with a return type, invokeSerial is not used
152  (void) _buffer;
153 
154  FW_ASSERT(0);
155  return Fw::FW_SERIALIZE_OK;
156  }
157 
158 #endif
159 
160  // ----------------------------------------------------------------------
161  // Output Port Member functions
162  // ----------------------------------------------------------------------
163 
166  Fw::OutputPortBase(),
167  m_port(nullptr)
168  {
169 
170  }
171 
173  init()
174  {
176  }
177 
180  {
181  FW_ASSERT(callPort != nullptr);
182 
183  this->m_port = callPort;
184  this->m_connObj = callPort;
185 
186 #if FW_PORT_SERIALIZATION == 1
187  this->m_serPort = nullptr;
188 #endif
189  }
190 
192  invoke(
193  const SendFileRequestPortStrings::StringSize100& sourceFileName,
194  const SendFileRequestPortStrings::StringSize100& destFileName,
195  U32 offset,
196  U32 length
197  )
198  {
199 #if FW_PORT_TRACING == 1
200  this->trace();
201 #endif
202 
203  FW_ASSERT(this->m_port != nullptr);
204  return this->m_port->invoke(sourceFileName, destFileName, offset, length);
205  }
206 
207 }
#define FW_ASSERT(...)
Definition: Assert.hpp:14
PlatformUIntType NATIVE_UINT_TYPE
Definition: BasicTypes.h:52
NATIVE_INT_TYPE m_portNum
virtual void init()
PassiveComponentBase * m_comp
virtual void init()
Fw::ObjBase * m_connObj
Definition: PortBase.hpp:33
virtual const CHAR * toChar() const =0
void addCallComp(Fw::PassiveComponentBase *callComp, CompFuncPtr funcPtr)
Register a component.
Svc::SendFileResponse invoke(const SendFileRequestPortStrings::StringSize100 &sourceFileName, const SendFileRequestPortStrings::StringSize100 &destFileName, U32 offset, U32 length)
Invoke a port interface.
void init()
Initialization function.
Svc::SendFileResponse invoke(const SendFileRequestPortStrings::StringSize100 &sourceFileName, const SendFileRequestPortStrings::StringSize100 &destFileName, U32 offset, U32 length)
Invoke a port interface.
void init()
Initialization function.
void addCallPort(InputSendFileRequestPort *callPort)
Register an input port.
const char * toChar() const
Retrieves char buffer of string.
StringSize100 & operator=(const StringSize100 &other)
Copy assignment operator.
NATIVE_UINT_TYPE getCapacity() const
return size of buffer
char * string_copy(char *destination, const char *source, U32 num)
copy string with null-termination guaranteed
Definition: StringUtils.cpp:5
SerializeStatus
forward declaration for string
@ FW_SERIALIZE_OK
Serialization/Deserialization operation was successful.