Skip to content

Commit

Permalink
Backport 80char replacement (#923)
Browse files Browse the repository at this point in the history
* Backport replacement of EightyCharacterString with Fw::String

* Remove test usage of 80 charater strings
  • Loading branch information
Joshua-Anderson authored Aug 20, 2021
1 parent 2df388e commit 9c4f2cc
Show file tree
Hide file tree
Showing 100 changed files with 392 additions and 404 deletions.
1 change: 1 addition & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,7 @@ foundin
fpconfighpp
FPGA
FPL
fpp
FPport
fprim
fprime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ void ${name}::toString(Fw::StringBase& text) const {
#if $typeinfo == "extern":
// Need to instantiate toString for arrays and serializable types
#for $index in $range(0, $size):
Fw::EightyCharString str${index};
Fw::String str${index};
this->elements[$index].toString(str${index});
#end for
#end if
Expand Down Expand Up @@ -263,7 +263,7 @@ void ${name}::toString(Fw::StringBase& text) const {

\#ifdef BUILD_UT
std::ostream& operator<<(std::ostream& os, const ${name}& obj) {
Fw::EightyCharString temp;
Fw::String temp;
obj.toString(temp);

os << temp;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
\#ifndef ${namespace}_${name}_HPP
\#define ${namespace}_${name}_HPP

\#include "Fw/Types/EightyCharString.hpp"
\#include "Fw/Types/String.hpp"
\#include "Fw/Types/BasicTypes.hpp"
\#include "Fw/Types/Serializable.hpp"
#for $t in $include_headers:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
\#include <${comp_include_path}/${include_name}ComponentAc.hpp>
\#include <Fw/Types/Assert.hpp>
\#if FW_ENABLE_TEXT_LOGGING
\#include <Fw/Types/EightyCharString.hpp>
\#include <Fw/Types/String.hpp>
\#endif

#set $class_name = $name + "ComponentBase"
Expand Down Expand Up @@ -1310,7 +1310,7 @@ namespace ${namespace} {

#for $arg_name, $arg_type, $comment, $size, $typeinfo in $args:
#if not ($is_primitive_type($arg_type) or ($typeinfo == "enum") or ($typeinfo == "string")) :
Fw::EightyCharString ${arg_name}Str;
Fw::String ${arg_name}Str;
${arg_name}.toString(${arg_name}Str);
#end if
#end for
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
\#ifndef ${namespace}_${name}_HPP
\#define ${namespace}_${name}_HPP

\#include "Fw/Types/EightyCharString.hpp"
\#include "Fw/Types/String.hpp"
\#include "Fw/Types/BasicTypes.hpp"
\#include "Fw/Types/Serializable.hpp"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
\#include <Fw/Types/BasicTypes.hpp>
\#include <Fw/Types/StringUtils.hpp>
\#if FW_SERIALIZABLE_TO_STRING
\#include <Fw/Types/EightyCharString.hpp>
\#include <Fw/Types/String.hpp>
\#endif
\#include <cstring>
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
\#include <stdio.h> // snprintf
\#ifdef BUILD_UT
\#include <iostream>
\#include <Fw/Types/EightyCharString.hpp>
\#include <Fw/Types/String.hpp>
\#endif
\#endif
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void ${name}::toString(Fw::StringBase& text) const {
#for ($member,$type,$size,$format,$comment,$default,$typeinfo) in $members:
#if $typeinfo == "extern":

Fw::EightyCharString ${member}Str;
Fw::String ${member}Str;
this->m_${member}.toString(${member}Str);
#end if
#end for
Expand Down Expand Up @@ -242,7 +242,7 @@ void ${name}::toString(Fw::StringBase& text) const {

\#ifdef BUILD_UT
std::ostream& operator<<(std::ostream& os, const ${name}& obj) {
Fw::EightyCharString str;
Fw::String str;
obj.toString(str);
os << str.toChar();
return os;
Expand Down
4 changes: 1 addition & 3 deletions Autocoders/Python/templates/ExampleType.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <Autocoders/Python/templates/ExampleType.hpp>
#include <Fw/Types/Assert.hpp>
#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/EightyCharString.hpp>
#endif

namespace ANameSpace {

mytype::mytype(void): Serializable() {
Expand Down
5 changes: 3 additions & 2 deletions Autocoders/Python/test/array_xml/ExampleArrayImpl.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <Autocoders/Python/test/array_xml/ExampleArrayImpl.hpp>
#include <Fw/Types/BasicTypes.hpp>
#include <Fw/Types/String.hpp>
#include <iostream>
#include <stdio.h>

Expand All @@ -19,15 +20,15 @@ namespace Example {
}

void ExampleArrayImpl::ExArrayIn_handler(NATIVE_INT_TYPE portNum, Example::ArrayType array1, Example::ArrSerial serial1) {
Fw::EightyCharString s;
Fw::String s;
array1.toString(s);

printf("%s Invoked ExArrayIn_handler();\n%s", this->getObjName(), s.toChar());
this->ArrayOut_out(0, array1, serial1);
}

void ExampleArrayImpl::ArrayIn_handler(NATIVE_INT_TYPE portNum, Example::ArrayType array1, Example::ArrSerial serial1) {
Fw::EightyCharString s;
Fw::String s;
array1.toString(s);

printf("%s Invoked ArrayIn_handler(%d);\n%s", this->getObjName(), portNum, s.toChar());
Expand Down
1 change: 0 additions & 1 deletion Autocoders/Python/test/array_xml/ExampleArrayImpl.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#ifndef EXAMPLE_ARRAY_IMPL_HPP
#define EXAMPLE_ARRAY_IMPL_HPP

#include <Fw/Types/EightyCharString.hpp>
#include <Autocoders/Python/test/array_xml/Component1ComponentAc.hpp>

namespace Example {
Expand Down
14 changes: 7 additions & 7 deletions Autocoders/Python/test/array_xml/test/ut/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <Fw/Obj/SimpleObjRegistry.hpp>
#include <Fw/Types/SerialBuffer.hpp>
#include <Fw/Types/BasicTypes.hpp>
#include <Fw/Types/EightyCharString.hpp>
#include <Fw/Types/String.hpp>
#include <Fw/Types/Assert.hpp>

#include <bitset>
Expand Down Expand Up @@ -67,18 +67,18 @@ int main(int argc, char* argv[]) {
InternalType array1 = InternalType(6,7,120,444);
Example::ArrayType array2 = Example::ArrayType(array1);
// Create string array for serializable
Fw::EightyCharString mem1 = "Member 1";
Fw::EightyCharString mem2 = "Member 2";
Fw::EightyCharString mem3 = "Member 3";
Fw::String mem1 = "Member 1";
Fw::String mem2 = "Member 2";
Fw::String mem3 = "Member 3";
StringArray array3 = StringArray(mem1, mem2, mem3);
Example::ArrSerial serial1;

// Print toString outputs for each array
cout << "Print toString for arrays" << endl;

Fw::EightyCharString tostring1;
Fw::EightyCharString tostring2;
Fw::EightyCharString tostring3;
Fw::String tostring1;
Fw::String tostring2;
Fw::String tostring3;
array1.toString(tostring1);
array2.toString(tostring2);
array3.toString(tostring3);
Expand Down
4 changes: 1 addition & 3 deletions Autocoders/Python/test/ext_dict/ExampleType.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <Autocoders/Python/test/ext_dict/ExampleType.hpp>
#include <Fw/Types/Assert.hpp>
#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/EightyCharString.hpp>
#endif

namespace ANameSpace {

mytype::mytype(void): Serializable() {
Expand Down
4 changes: 0 additions & 4 deletions Autocoders/Python/test/interface1/UserSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
#include <Fw/Types/Assert.hpp>
#include <cstdio>

#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/EightyCharString.hpp>
#endif

namespace ANameSpace {

UserSerializer::UserSerializer(void): Serializable() {
Expand Down
6 changes: 3 additions & 3 deletions Autocoders/Python/test/partition/DuckDuckImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ namespace Duck {

// Internal call - implemented by hand.
// downcall for input port externInputPort1
I32 DuckImpl::externInputPort1_Msg1_handler(U32 cmd, Fw::EightyCharString str) {
I32 DuckImpl::externInputPort1_Msg1_handler(U32 cmd, Fw::String str) {
// User code is written here.
printf("\n\t*** %s: externInputPort1_Msg1_handler down-call\n", this->m_objName);
this->outputPort1_Msg1_out(cmd, str);
Expand All @@ -33,13 +33,13 @@ namespace Duck {
}

// downcall for input port inputPort1
I32 DuckImpl::inputPort1_Msg1_handler(U32 cmd, Fw::EightyCharString str) {
I32 DuckImpl::inputPort1_Msg1_handler(U32 cmd, Fw::String str) {
// User code is written here.
return 0;
}

// downcall for input port inputPort2
I32 DuckImpl::inputPort2_Msg1_handler(U32 cmd, Fw::EightyCharString str) {
I32 DuckImpl::inputPort2_Msg1_handler(U32 cmd, Fw::String str) {
// User code is written here.
printf("\n\t*** %s: inputPort2_Msg1_handler(%d, %s) down-call\n", this->m_objName, cmd, str.toChar());
return 0;
Expand Down
6 changes: 3 additions & 3 deletions Autocoders/Python/test/partition/DuckDuckImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ namespace Duck {

private:
// downcall for input ports
I32 externInputPort1_Msg1_handler(U32 cmd, Fw::EightyCharString str);
I32 externInputPort1_Msg1_handler(U32 cmd, Fw::String str);
I32 externInputPort3_Msg3_handler(U32 cmd);
I32 inputPort1_Msg1_handler(U32 cmd, Fw::EightyCharString str);
I32 inputPort2_Msg1_handler(U32 cmd, Fw::EightyCharString str);
I32 inputPort1_Msg1_handler(U32 cmd, Fw::String str);
I32 inputPort2_Msg1_handler(U32 cmd, Fw::String str);
I32 inputPort3_Msg3_handler(U32 cmd);
};
};
Expand Down
6 changes: 2 additions & 4 deletions Autocoders/Python/test/partition/Msg1InterfaceAi.xml
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface name="Msg1" namespace="Ports">
<include_header>Fw/Types/FwStringType</include_header>
<include_header>Fw/Types/FwEightyCharString</include_header>
<include_header>Fw/Types/String.hpp</include_header>
<comment>
Msg 1 Interface to send cmd and stat arguments.
</comment>
<args>
<arg name="cmd" type="U32">
<comment>The U32 cmd argument</comment>
</arg>
<arg name="str" type="Fw::EightyCharString">
<arg name="str" type="Fw::String">
<comment>The 80 character string str argument</comment>
</arg>
</args>
</interface>

4 changes: 2 additions & 2 deletions Autocoders/Python/test/partition/Top.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ int main(int argc, char* argv[]) {
// Ask for input to huey or duey here.
char in[80];
U32 cmd;
Fw::EightyCharString *str;
Fw::String *str;
char str2[80];
//
while ( strcmp(in,"quit") != 0) {
Expand All @@ -101,7 +101,7 @@ int main(int argc, char* argv[]) {
cout << "Enter short string: ";
cin >> str2;
cout << "The string 2 is: " << str2 << endl;
str = new Fw::EightyCharString(str2);
str = new Fw::String(str2);
cout << "hueyComp_ptr->getexternInputPort1InputPort()->msg_in(" << cmd << "," << str2 << ")" << endl;
hueyComp_ptr->getexternInputPort1Msg1InputPort()->msg_in(cmd,*str);
} else if (in[0] == '3') {
Expand Down
4 changes: 1 addition & 3 deletions Autocoders/Python/test/port_loopback/ExampleType.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <Autocoders/Python/templates/ExampleType.hpp>
#include <Fw/Types/Assert.hpp>
#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/EightyCharString.hpp>
#endif

namespace ANameSpace {

mytype::mytype(void): Serializable() {
Expand Down
4 changes: 1 addition & 3 deletions Autocoders/Python/test/port_nogen/ExampleType.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#include <Autocoders/Python/test/port_nogen/ExampleType.hpp>
#include <Fw/Types/Assert.hpp>
#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/EightyCharString.hpp>
#endif

namespace ANameSpace {

mytype::mytype(void): Serializable() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <Autocoders/Python/test/serialize_user/ExampleComponentImpl.hpp>
#include <Fw/Types/EightyCharString.hpp>
#include <Fw/Types/String.hpp>
#include <cstdio>

#if FW_OBJECT_NAMES == 1
Expand All @@ -26,7 +26,7 @@ ExampleComponentImpl::~ExampleComponentImpl() {

void ExampleComponentImpl::exampleInput_handler(NATIVE_INT_TYPE portNum, I32 arg1, ANameSpace::UserSerializer arg2) {

Fw::EightyCharString str;
Fw::String str;
arg2.toString(str);
printf("ARG: %s\n",str.toChar());
}
4 changes: 0 additions & 4 deletions Autocoders/Python/test/serialize_user/UserSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
#include <Fw/Types/Assert.hpp>
#include <cstdio>

#if FW_SERIALIZABLE_TO_STRING
#include <Fw/Types/EightyCharString.hpp>
#endif

namespace ANameSpace {

UserSerializer::UserSerializer(void): Serializable() {
Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/stress/TestCommandImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <Autocoders/Python/test/stress/TestCommandImpl.hpp>
#include <Fw/Types/EightyCharString.hpp>
#include <Fw/Types/String.hpp>
#include <stdio.h>

#if FW_OBJECT_NAMES == 1
Expand All @@ -29,7 +29,7 @@ void TestCommand1Impl::aport_handler(NATIVE_INT_TYPE portNum, I32 arg4, F32 arg5
}

void TestCommand1Impl::aport2_handler(NATIVE_INT_TYPE portNum, I32 arg4, F32 arg5, Ref::Gnc::Quaternion arg6) {
Fw::EightyCharString str;
Fw::String str;
arg6.toString(str);
printf("Received aport2_Test2_handler call with %i %f %s\n",arg4,arg5,str.toChar());
}
Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/stress/TestTelemRecvImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <Autocoders/Python/test/stress/TestTelemRecvImpl.hpp>
#include <Fw/Types/EightyCharString.hpp>
#include <Fw/Types/String.hpp>
#include <Autocoders/Python/test/stress/QuaternionSerializableAc.hpp>
#include <stdio.h>

Expand All @@ -25,7 +25,7 @@ TestTelemRecvImpl::~TestTelemRecvImpl() {
void TestTelemRecvImpl::tlmRecvPort_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) {
Ref::Gnc::Quaternion tlmVal;
val.deserialize(tlmVal);
Fw::EightyCharString str;
Fw::String str;
#if FW_SERIALIZABLE_TO_STRING
tlmVal.toString(str);
#endif
Expand Down
4 changes: 2 additions & 2 deletions Autocoders/Python/test/tlm2/TestTelemRecvImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

#include <Autocoders/Python/test/tlm2/TestTelemRecvImpl.hpp>
#include <Fw/Types/EightyCharString.hpp>
#include <Fw/Types/String.hpp>
#include <Autocoders/Python/test/tlm2/QuaternionSerializableAc.hpp>
#include <stdio.h>

Expand All @@ -25,7 +25,7 @@ TestTelemRecvImpl::~TestTelemRecvImpl() {
void TestTelemRecvImpl::tlmRecvPort_handler(NATIVE_INT_TYPE portNum, FwChanIdType id, Fw::Time &timeTag, Fw::TlmBuffer &val) {
Ref::Gnc::Quaternion tlmVal;
val.deserialize(tlmVal);
Fw::EightyCharString str;
Fw::String str;
tlmVal.toString(str);
printf("ID: %d TLM value is %s. Time is %d:%d base: %d\n",id,str.toChar(),timeTag.getSeconds(),timeTag.getUSeconds(),timeTag.getTimeBase());
}
Expand Down
6 changes: 3 additions & 3 deletions Drv/Ip/docs/sdd.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,15 +161,15 @@ section.

In order to start the receiving thread a call to the `Drv::SocketReadTask::startSocketTask` method is performed passing
in a name, and all arguments to `Os::Task::start` to start the task. An optional parameter, reconnect, will determine if
this read task will reconnect to sockets should a disconnect or error occur. Once started the read task will continue
this read task will reconnect to sockets should a disconnect or error occur. Once started the read task will continue
until a `Drv::SocketReadTask::stopSocketTask` has been called or an error occurred when started without reconnect set to
`true`. Once the socket stop call has been made, the user should call `Drv::SocketReadTask::joinSocketTask` in order to
wait until the full task has finished. `Drv::SocketReadTask::stopSocketTask` will call `Drv::IpSocket::close` on the
provided Drv::IpSocket to ensure that the any blocking reads exit freeing the thread to completely stop. Normal usage of
a Drv::SocketReadTask derived class is shown below.

```c++
Fw::EightyCharString name("ReceiveTask");
Os::TaskString name("ReceiveTask");
uplinkComm.startSocketTask(name, 100, 10 * 1024); // Default reconnect=true
...

Expand Down Expand Up @@ -219,4 +219,4 @@ Further information can be read by referencing the following components.
`Drv::TcpClientComponent`: a F´ component wrapper of the tcp client
`Drv::TcpServerComponent`: a F´ component wrapper of the tcp server
`Drv::UdpComponent`: a F´ component wrapper of the udp
`Drv::UdpComponent`: a F´ component wrapper of the udp
Loading

0 comments on commit 9c4f2cc

Please sign in to comment.