diff --git a/include/trick/CheckPointAgent.hh b/include/trick/CheckPointAgent.hh index fa792d79..ea3948a9 100644 --- a/include/trick/CheckPointAgent.hh +++ b/include/trick/CheckPointAgent.hh @@ -95,7 +95,7 @@ namespace Trick { bool reduced_checkpoint; /**< ** Reduced Checkpoint flag. */ bool hexfloat_checkpoint; /**< ** HexFloat Checkpoint flag. */ int debug_level; /**< ** Debug Level. */ - std::vector leftside_stack; /**< ** Left-side name stack. */ + std::vector < VarNameElement > leftside_stack; /**< ** Left-side name stack. */ }; diff --git a/trick_source/sim_services/CheckPointAgent/CheckPointAgent.cpp b/trick_source/sim_services/CheckPointAgent/CheckPointAgent.cpp index e9250dc8..1624e47a 100644 --- a/trick_source/sim_services/CheckPointAgent/CheckPointAgent.cpp +++ b/trick_source/sim_services/CheckPointAgent/CheckPointAgent.cpp @@ -3,30 +3,30 @@ // MEMBER FUNCTION void Trick::CheckPointAgent::push_basename( const char* name) { - VarNameElement *part = new VarNameElement; + VarNameElement part ; - part->type = BASE_NAME; - part->name = name; - leftside_stack.push_back( part); + part.type = BASE_NAME; + part.name = name; + leftside_stack.push_back(part); } // MEMBER FUNCTION void Trick::CheckPointAgent::push_struct_elem( const char* name) { - VarNameElement *part = new VarNameElement; + VarNameElement part ; - part->type = ELEM_NAME; - part->name = name; + part.type = ELEM_NAME; + part.name = name; leftside_stack.push_back( part); } // MEMBER FUNCTION void Trick::CheckPointAgent::push_array_elem( int index) { - VarNameElement *part = new VarNameElement; + VarNameElement part ; - part->type = ARRAY_INDEX; - part->index = index; + part.type = ARRAY_INDEX; + part.index = index; leftside_stack.push_back( part); } @@ -34,7 +34,6 @@ void Trick::CheckPointAgent::push_array_elem( int index) { void Trick::CheckPointAgent::pop_elem() { leftside_stack.pop_back(); - // FIXME Memory leak here? } diff --git a/trick_source/sim_services/CheckPointAgent/ClassicCheckPointerAgent.cpp b/trick_source/sim_services/CheckPointAgent/ClassicCheckPointerAgent.cpp index 9651ddc0..e59ba40d 100644 --- a/trick_source/sim_services/CheckPointAgent/ClassicCheckPointerAgent.cpp +++ b/trick_source/sim_services/CheckPointAgent/ClassicCheckPointerAgent.cpp @@ -75,21 +75,21 @@ std::string Trick::ClassicCheckPointAgent::left_side_name() { for (ii = 0; ii < n_elements ; ii++) { - VarNameElement* element = leftside_stack[ii]; + VarNameElement & element = leftside_stack[ii]; - switch( element->type) { + switch( element.type) { case BASE_NAME: { - name = element->name; + name = element.name; } break; case ELEM_NAME: { - name += '.' + element->name; + name += '.' + element.name; } break; case ARRAY_INDEX: { std::stringstream index_string; - index_string << element->index; + index_string << element.index; name += '['; name += index_string.str(); name += ']'; diff --git a/trick_source/sim_services/CheckPointAgent/PythonPrint.cpp b/trick_source/sim_services/CheckPointAgent/PythonPrint.cpp index 987eefe4..a78393e0 100644 --- a/trick_source/sim_services/CheckPointAgent/PythonPrint.cpp +++ b/trick_source/sim_services/CheckPointAgent/PythonPrint.cpp @@ -389,21 +389,21 @@ std::string Trick::PythonPrint::left_side_name() { for (ii = 0; ii < n_elements ; ii++) { - VarNameElement* element = leftside_stack[ii]; + VarNameElement & element = leftside_stack[ii]; - switch( element->type) { + switch( element.type) { case BASE_NAME: { - name = element->name; + name = element.name; } break; case ELEM_NAME: { - name += '.' + element->name; + name += '.' + element.name; } break; case ARRAY_INDEX: { std::stringstream index_string; - index_string << element->index; + index_string << element.index; name += '['; name += index_string.str(); name += ']';