mirror of
https://github.com/nasa/trick.git
synced 2025-01-19 03:06:23 +00:00
Add direct STL checkpointing
Modified ICG to save the non-canonical name for STLs. This is typically more readable because it is shorter. Added code to the variable server to filter out requests accessing STLs, because those accesses will not currently work. refs #206
This commit is contained in:
parent
0b7e3e2dc9
commit
fb7432d096
@ -479,6 +479,9 @@ namespace Trick {
|
||||
/** Dummy integer for bad references.\n */
|
||||
static int bad_ref_int ; /**< trick_io(**) */
|
||||
|
||||
/** Dummy integer for bad references. If a variable points here, do not try to re-resolve address\n */
|
||||
static int do_not_resolve_bad_ref_int ; /**< trick_io(**) */
|
||||
|
||||
/** The simulation time converted to seconds\n */
|
||||
double time ; /**< trick_units(s) */
|
||||
|
||||
|
@ -1,7 +1,11 @@
|
||||
|
||||
#ifndef CHECKPOINT_STL_PROTOS_HH
|
||||
#define CHECKPOINT_STL_PROTOS_HH
|
||||
|
||||
#include <string>
|
||||
|
||||
// prototype of functions used in checkpoint_stl templates
|
||||
|
||||
std::string stl_type_name_convert(std::string in_type) ;
|
||||
|
||||
#endif
|
||||
|
@ -1,9 +0,0 @@
|
||||
#ifndef STL_S_DEFINE_MACRO_HH
|
||||
#define STL_S_DEFINE_MACRO_HH
|
||||
|
||||
#define CHECKPOINT_STL(varname) \
|
||||
("checkpoint") checkpoint_stl(varname, name + std::string("_") + std::string(#varname), std::string("")) ; \
|
||||
("post_checkpoint") delete_stl (varname, name + std::string("_") + std::string(#varname), std::string("")) ; \
|
||||
("restart") restore_stl (varname, name + std::string("_") + std::string(#varname), std::string(""))
|
||||
|
||||
#endif
|
@ -251,6 +251,14 @@ unsigned int FieldDescription::getBaseClassOffset() {
|
||||
return base_class_offset ;
|
||||
}
|
||||
|
||||
void FieldDescription::setNonCanonicalTypeName( std::string in_val ) {
|
||||
non_canonical_type_name = in_val ;
|
||||
}
|
||||
|
||||
std::string FieldDescription::getNonCanonicalTypeName() {
|
||||
return non_canonical_type_name ;
|
||||
}
|
||||
|
||||
void FieldDescription::setTypeName( std::string in_val ) {
|
||||
type_name = in_val ;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ class FieldDescription : public ConstructValues {
|
||||
std::string getContainerClass() ;
|
||||
void setContainerClass( std::string in_name ) ;
|
||||
unsigned int getBaseClassOffset() ;
|
||||
void setNonCanonicalTypeName( std::string in_val ) ;
|
||||
std::string getNonCanonicalTypeName() ;
|
||||
void setTypeName( std::string in_val ) ;
|
||||
std::string getTypeName() ;
|
||||
void setLineNo( unsigned int ) ;
|
||||
@ -99,7 +101,10 @@ class FieldDescription : public ConstructValues {
|
||||
be added to field offset */
|
||||
unsigned int base_class_offset ;
|
||||
|
||||
/** Name of the type */
|
||||
/** Name of the type. Non-canonical. It's what was actually read in input file */
|
||||
std::string non_canonical_type_name ;
|
||||
|
||||
/** Name of the type, will be canonical, resolving all typedefs and adding default template args */
|
||||
std::string type_name ;
|
||||
|
||||
/** Name of the type */
|
||||
|
@ -217,6 +217,7 @@ bool FieldVisitor::VisitFieldDecl( clang::FieldDecl *field ) {
|
||||
//field->dump() ;
|
||||
}
|
||||
if ( !qt.isCanonical() ) {
|
||||
fdes->setNonCanonicalTypeName(qt.getAsString()) ;
|
||||
clang::QualType ct = qt.getCanonicalType() ;
|
||||
std::string tst_string = ct.getAsString() ;
|
||||
if ( debug_level >= 3 ) {
|
||||
@ -377,7 +378,10 @@ bool FieldVisitor::VisitRecordType(clang::RecordType *rt) {
|
||||
fdes->setSTL(true) ;
|
||||
fdes->setTypeName(tst_string) ;
|
||||
fdes->setSTLClear((*it).second) ;
|
||||
fdes->setMangledTypeName(mangle_string(tst_string)) ;
|
||||
// set the type name to the non canonical name, the name the user put in the header file
|
||||
// The typename is not used by STL variables, and it is nice to see the type that was
|
||||
// actually inputted by the user
|
||||
fdes->setMangledTypeName(fdes->getNonCanonicalTypeName()) ;
|
||||
return false ;
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "trick/sie_c_intf.h"
|
||||
|
||||
int Trick::VariableServerThread::bad_ref_int = 0 ;
|
||||
int Trick::VariableServerThread::do_not_resolve_bad_ref_int = 0 ;
|
||||
|
||||
REF2* Trick::VariableServerThread::make_time_ref() {
|
||||
REF2* new_ref;
|
||||
@ -62,6 +63,15 @@ int Trick::VariableServerThread::var_add(std::string in_name) {
|
||||
// Replace the REF2 object we got from ref_attributes with an error-ref.
|
||||
free(new_ref);
|
||||
new_ref = make_error_ref(in_name);
|
||||
// set the address of the data to the do_not_resolve address. We won't retry resolving the name
|
||||
new_ref->address = (char *)&do_not_resolve_bad_ref_int ;
|
||||
} else if ( new_ref->attr->type == TRICK_STL ) {
|
||||
message_publish(MSG_ERROR, "Variable Server: var_add cant add \"%s\" because its an STL variable.\n", in_name.c_str());
|
||||
// Replace the REF2 object we got from ref_attributes with an error-ref.
|
||||
free(new_ref);
|
||||
new_ref = make_error_ref(in_name);
|
||||
// set the address of the data to the do_not_resolve address. We won't retry resolving the name
|
||||
new_ref->address = (char *)&do_not_resolve_bad_ref_int ;
|
||||
}
|
||||
} else {
|
||||
message_publish(MSG_ERROR, "Variable Server: BAD MOJO - Missing ATTRIBUTES.");
|
||||
|
Loading…
Reference in New Issue
Block a user