Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make serializable type getters as const functions #729

Merged
merged 2 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ void ${name}::set(${args_proto_string}) {

#for ($member,$type,$size,$format,$comment,$typeinfo) in $members:
#if $size == None:
${type} ${name}::get${member}(void) {
${type} ${name}::get${member}(void) const {
return this->m_${member};
#else if $typeinfo == 'string' or $typeinfo == 'extern':
const ${type}& ${name}::get${member}(void) {
const ${type}& ${name}::get${member}(void) const {
return this->m_${member};
#else
const ${type}* ${name}::get${member}(NATIVE_INT_TYPE& size) {
const ${type}* ${name}::get${member}(NATIVE_INT_TYPE& size) const {
size = ${size};
return this->m_${member};
#end if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public:

#for name,type,size,format,comment,typeinfo in $members:
#if $size == None:
${type} get${name}(void); //!< get member $name
${type} get${name}(void) const; //!< get member $name
#else if $typeinfo == 'string' or $typeinfo == 'extern':
const ${type}& get${name}(void); //!< get member $name
const ${type}& get${name}(void) const; //!< get member $name
#else
const ${type}* get${name}(NATIVE_INT_TYPE& size); //!< get member $name
const ${type}* get${name}(NATIVE_INT_TYPE& size) const; //!< get member $name
#end if
#end for

Expand Down
10 changes: 5 additions & 5 deletions Fw/Time/Time.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ namespace Fw {

Time Time ::
add(
Time& a,
Time& b
)
const Time& a,
const Time& b
)
{
#if FW_USE_TIME_BASE
FW_ASSERT(a.getTimeBase() == b.getTimeBase(), a.getTimeBase(), b.getTimeBase() );
Expand All @@ -209,8 +209,8 @@ namespace Fw {

Time Time ::
sub(
Time& minuend, //!< Time minuend
Time& subtrahend //!< Time subtrahend
const Time& minuend, //!< Time minuend
const Time& subtrahend //!< Time subtrahend
)
{
#if FW_USE_TIME_BASE
Expand Down
8 changes: 4 additions & 4 deletions Fw/Time/Time.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ namespace Fw {
//! Add two times
//! \return The result
static Time add(
Time& a, //!< Time a
Time& b //!< Time b
const Time& a, //!< Time a
const Time& b //!< Time b
);

//! Subtract subtrahend from minuend
//! \return The result
static Time sub(
Time& minuend, //!< Value being subtracted from
Time& subtrahend //!< Value being subtracted
const Time& minuend, //!< Value being subtracted from
const Time& subtrahend //!< Value being subtracted
);

// add seconds and microseconds to existing time
Expand Down