mirror of
https://github.com/nasa/trick.git
synced 2024-12-19 21:27:54 +00:00
change c_intf ref_attributes param to const char ptr, remove casts from calls to function in trick (#1135)
closes #1129 Co-authored-by: Fennell, Scott P 263712616 <scott.p.fennell@nasa.gov>
This commit is contained in:
parent
77c761016c
commit
acdc60050c
@ -405,9 +405,9 @@ int restore_map_ik_id(STL & in_map , std::string object_name , std::string var_n
|
||||
|
||||
std::replace_if(object_name.begin(), object_name.end(), static_cast<int (*)(int)>(std::ispunct), '_');
|
||||
temp_str = object_name + "_" + var_name + "_keys";
|
||||
keys_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
keys_ref = ref_attributes(temp_str.c_str()) ;
|
||||
temp_str = object_name + "_" + var_name + "_data";
|
||||
items_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
items_ref = ref_attributes(temp_str.c_str()) ;
|
||||
|
||||
if ( keys_ref != NULL && items_ref != NULL ) {
|
||||
in_map.clear() ;
|
||||
@ -455,9 +455,9 @@ int restore_map_ik_sd(STL & in_map , std::string object_name , std::string var_n
|
||||
std::replace_if(object_name.begin(), object_name.end(), static_cast<int (*)(int)>(std::ispunct), '_');
|
||||
|
||||
temp_str = object_name + "_" + var_name + "_keys";
|
||||
keys_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
keys_ref = ref_attributes(temp_str.c_str()) ;
|
||||
temp_str = object_name + "_" + var_name + "_data";
|
||||
items_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
items_ref = ref_attributes(temp_str.c_str()) ;
|
||||
|
||||
if ( keys_ref != NULL && items_ref != NULL ) {
|
||||
in_map.clear() ;
|
||||
@ -509,9 +509,9 @@ int restore_map_sk_id(STL & in_map , std::string object_name , std::string var_n
|
||||
std::replace_if(object_name.begin(), object_name.end(), static_cast<int (*)(int)>(std::ispunct), '_');
|
||||
|
||||
temp_str = object_name + "_" + var_name + "_keys";
|
||||
keys_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
keys_ref = ref_attributes(temp_str.c_str()) ;
|
||||
temp_str = object_name + "_" + var_name + "_data";
|
||||
items_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
items_ref = ref_attributes(temp_str.c_str()) ;
|
||||
|
||||
if ( keys_ref != NULL && items_ref != NULL ) {
|
||||
in_map.clear() ;
|
||||
|
@ -202,7 +202,7 @@ int delete_stl(std::pair<FIRST, SECOND> & in_stl __attribute__ ((unused)) , std:
|
||||
std::replace_if(object_name.begin(), object_name.end(), static_cast<int (*)(int)>(std::ispunct), '_');
|
||||
REF2 * items_ref ;
|
||||
std::string temp_str = object_name + "_" + var_name + "_first";
|
||||
items_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
items_ref = ref_attributes(temp_str.c_str()) ;
|
||||
if ( items_ref != NULL ) {
|
||||
temp_str = object_name + "_" + var_name + "_first";
|
||||
TMM_delete_var_n(temp_str.c_str() ) ;
|
||||
|
@ -138,7 +138,7 @@ int restore_stl(std::stack<ITEM_TYPE,_Sequence> & in_stl , std::string object_na
|
||||
|
||||
//message_publish(1, "RESTORE_STL_STACK %s_%s\n", object_name.c_str() , var_name.c_str()) ;
|
||||
temp_str = object_name + std::string("_") + var_name ;
|
||||
items_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
items_ref = ref_attributes(temp_str.c_str()) ;
|
||||
|
||||
if ( items_ref != NULL ) {
|
||||
cont_size = in_stl.size() ;
|
||||
@ -170,7 +170,7 @@ int restore_stl(std::stack<ITEM_TYPE,_Sequence> & in_stl , std::string object_na
|
||||
|
||||
//message_publish(1, "RESTORE_STL_STACK %s_%s\n", object_name.c_str() , var_name.c_str()) ;
|
||||
temp_str = object_name + std::string("_") + var_name ;
|
||||
items_ref = ref_attributes((char *)temp_str.c_str()) ;
|
||||
items_ref = ref_attributes(temp_str.c_str()) ;
|
||||
|
||||
if ( items_ref != NULL ) {
|
||||
cont_size = in_stl.size() ;
|
||||
|
@ -57,7 +57,7 @@ int TMM_init_from_checkpoint( const char* filename);
|
||||
int TMM_add_shared_library_symbols( const char* filename);
|
||||
|
||||
|
||||
REF2* ref_attributes(char* name);
|
||||
REF2* ref_attributes(const char* name);
|
||||
int ref_var(REF2* R, char* name);
|
||||
int get_size(void *addr) ;
|
||||
|
||||
|
@ -211,7 +211,7 @@ extern "C" int load_checkpoint_job() {
|
||||
extern "C" void * get_address( const char * var_name ) {
|
||||
|
||||
REF2 * new_ref ;
|
||||
new_ref = ref_attributes((char *)var_name) ;
|
||||
new_ref = ref_attributes(var_name) ;
|
||||
void * address ;
|
||||
|
||||
if ( new_ref != NULL ) {
|
||||
|
@ -324,7 +324,7 @@ int Trick::DataRecordGroup::add_change_variable( std::string in_name ) {
|
||||
|
||||
REF2 * ref2 ;
|
||||
|
||||
ref2 = ref_attributes((char *)in_name.c_str()) ;
|
||||
ref2 = ref_attributes(in_name.c_str()) ;
|
||||
|
||||
if ( ref2 == NULL || ref2->attr == NULL ) {
|
||||
message_publish(MSG_WARNING, "Could not find Data Record change variable %s.\n", in_name.c_str()) ;
|
||||
@ -376,7 +376,7 @@ int Trick::DataRecordGroup::init() {
|
||||
if ( drb->ref_searched == false ) {
|
||||
REF2 * ref2 ;
|
||||
|
||||
ref2 = ref_attributes((char *)drb->name.c_str()) ;
|
||||
ref2 = ref_attributes(drb->name.c_str()) ;
|
||||
if ( ref2 == NULL || ref2->attr == NULL ) {
|
||||
message_publish(MSG_WARNING, "Could not find Data Record variable %s.\n", drb->name.c_str()) ;
|
||||
rec_buffer.erase(rec_buffer.begin() + jj--) ;
|
||||
|
@ -158,7 +158,7 @@ void Trick::IPPythonEvent::restart() {
|
||||
|
||||
for (jj=0; jj<condition_count; jj++) {
|
||||
if (condition_list[jj]->cond_type==1) { // condition variable
|
||||
condition_list[jj]->ref = ref_attributes((char*)condition_list[jj]->str.c_str());
|
||||
condition_list[jj]->ref = ref_attributes(condition_list[jj]->str.c_str());
|
||||
}
|
||||
if (condition_list[jj]->cond_type==2) { // condition job
|
||||
condition_list[jj]->job = exec_get_job(condition_list[jj]->str.c_str(),1);
|
||||
@ -176,7 +176,7 @@ void Trick::IPPythonEvent::restart() {
|
||||
int Trick::IPPythonEvent::condition_var(int num, std::string varname, std::string comment) {
|
||||
/** @par Detailed Design: */
|
||||
/** @li Find the variable reference for the varname string and pass it to condition() */
|
||||
REF2* ref = ref_attributes((char*)varname.c_str());
|
||||
REF2* ref = ref_attributes(varname.c_str());
|
||||
/** @li Emit an error if specified varname does not exist. */
|
||||
if (ref==NULL) {
|
||||
message_publish(MSG_WARNING, "Event condition variable %s not found. Setting condition to False.\n", varname.c_str()) ;
|
||||
|
@ -453,7 +453,7 @@ extern "C" int ref_allocate(REF2 *R, int num) {
|
||||
@relates Trick::MemoryManager
|
||||
This is the C Language version of Trick::MemoryManager::ref_attributes( name).
|
||||
*/
|
||||
extern "C" REF2* ref_attributes( char* name) {
|
||||
extern "C" REF2* ref_attributes(const char* name) {
|
||||
if (trick_MM != NULL) {
|
||||
return( trick_MM->ref_attributes( name));
|
||||
} else {
|
||||
|
@ -10,7 +10,7 @@ Trick::MonteVarCalculated::MonteVarCalculated(std::string in_name, std::string i
|
||||
this->name = in_name;
|
||||
this->unit = in_unit;
|
||||
|
||||
ref2 = ref_attributes((char *)name.c_str());
|
||||
ref2 = ref_attributes(name.c_str());
|
||||
if (ref2 == NULL) {
|
||||
message_publish(MSG_ERROR, "Monte : MonteVarCalculated could not find parameter %s.\n", name.c_str()) ;
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ int Trick::VariableServerThread::var_add(std::string in_name) {
|
||||
if ( in_name.compare("time") == 0 ) {
|
||||
new_ref = make_time_ref() ;
|
||||
} else {
|
||||
new_ref = ref_attributes(const_cast<char*>(in_name.c_str())) ;
|
||||
new_ref = ref_attributes(in_name.c_str()) ;
|
||||
}
|
||||
|
||||
if ( new_ref == NULL ) {
|
||||
@ -181,7 +181,7 @@ int Trick::VariableServerThread::var_exists(std::string in_name) {
|
||||
bool error = false ;
|
||||
|
||||
unsigned int msg_type ;
|
||||
REF2* var_ref = ref_attributes(const_cast<char*>(in_name.c_str()));
|
||||
REF2* var_ref = ref_attributes(in_name.c_str());
|
||||
|
||||
if ( var_ref == (REF2*)NULL ) {
|
||||
error = true;
|
||||
|
@ -25,7 +25,7 @@ int Trick::VariableServerThread::copy_sim_data() {
|
||||
|
||||
// if this variable is unresolved, try to resolve it
|
||||
if (curr_var->ref->address == &bad_ref_int) {
|
||||
REF2 *new_ref = ref_attributes(const_cast<char*>(curr_var->ref->reference));
|
||||
REF2 *new_ref = ref_attributes(curr_var->ref->reference);
|
||||
if (new_ref != NULL) {
|
||||
curr_var->ref = new_ref;
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ void var_set_value< void * > ( V_DATA & v_data , void * value ) {
|
||||
|
||||
template<class T>
|
||||
int var_set_base( const char * var , T value , const char * units ) {
|
||||
REF2 *ref = ref_attributes((char *)var) ;
|
||||
REF2 *ref = ref_attributes(var) ;
|
||||
if ( ref != NULL ) {
|
||||
if (ref->attr->io & TRICK_VAR_INPUT) {
|
||||
V_TREE v_tree ;
|
||||
|
Loading…
Reference in New Issue
Block a user