Add direct STL checkpointing

Made adjustments to template default arguments to avoid clang compiler
errors.  Also added an irnore warning during python glue code compilation

refs #206
This commit is contained in:
Alex Lin 2016-03-29 09:59:49 -05:00
parent 46aec08b80
commit c57c10edcd
6 changed files with 32 additions and 32 deletions

View File

@ -37,8 +37,8 @@ int checkpoint_map_stl(STL & in_map , std::string object_name , std::string var_
typename STL::iterator iter ;
int status ;
typename STL::key_type * keys ;
typename STL::mapped_type * items ;
typename STL::key_type * keys = nullptr ;
typename STL::mapped_type * items = nullptr ;
cont_size = in_map.size() ;
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
@ -85,7 +85,7 @@ int checkpoint_map_stl_key_string(STL & in_map , std::string object_name , std::
int status ;
char ** keys ;
typename STL::mapped_type * items ;
typename STL::mapped_type * items = nullptr ;
cont_size = in_map.size() ;
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
@ -130,7 +130,7 @@ int checkpoint_map_stl_data_string(STL & in_map , std::string object_name , std:
typename STL::iterator iter ;
int status ;
typename STL::key_type * keys ;
typename STL::key_type * keys = nullptr ;
char ** items ;
cont_size = in_map.size() ;

View File

@ -41,7 +41,7 @@ int checkpoint_stl(std::queue<ITEM_TYPE> & in_stl , std::string object_name , st
char var_declare[128] ;
int status ;
ITEM_TYPE * items ;
ITEM_TYPE * items = nullptr ;
std::queue<ITEM_TYPE> temp_queue ;
cont_size = in_stl.size() ;
@ -74,7 +74,7 @@ int checkpoint_stl(std::priority_queue<ITEM_TYPE> & in_stl , std::string object_
char var_declare[128] ;
int status ;
ITEM_TYPE * items ;
ITEM_TYPE * items = nullptr ;
std::priority_queue<ITEM_TYPE> temp_queue ;
cont_size = in_stl.size() ;

View File

@ -174,13 +174,13 @@ int checkpoint_sequence_stl_stl(STL & in_stl , std::string object_name , std::st
// std::vector
// This template is only enabled if the items in the vector are an STL
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the vector are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -191,13 +191,13 @@ int checkpoint_stl(std::vector<std::string> & in_vector , std::string object_nam
// -----------
// std::list
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the list are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -208,13 +208,13 @@ int checkpoint_stl(std::list<std::string> & in_list , std::string object_name ,
// -----------
// std::deque
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the deque are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -225,13 +225,13 @@ int checkpoint_stl(std::deque<std::string> & in_vector , std::string object_name
// -----------
// std::set
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the set are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -242,13 +242,13 @@ int checkpoint_stl(std::set<std::string> & in_vector , std::string object_name ,
// -----------
// std::multiset
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the multiset are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -429,13 +429,13 @@ int restore_sequence_stl_stl(STL & in_stl , std::string object_name , std::strin
// std::vector
// This template is only enabled if the items in the vector are an STL
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the vector are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -447,13 +447,13 @@ int restore_stl(std::vector<std::string> & in_vector , std::string object_name ,
// std::list
// This template is only enabled if the items in the list are an STL
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the list are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -464,13 +464,13 @@ int restore_stl(std::list<std::string> & in_list , std::string object_name , std
// std::deque
// This template is only enabled if the items in the deque are an STL
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the deque are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -481,13 +481,13 @@ int restore_stl(std::deque<std::string> & in_deque , std::string object_name , s
// std::set
// This template is only enabled if the items in the set are an STL
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the set are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}
@ -498,13 +498,13 @@ int restore_stl(std::set<std::string> & in_set , std::string object_name , std::
// std::multiset
// This template is only enabled if the items in the multiset are an STL
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_stl( in_stl , object_name , var_name ) ;
}
// This template is only enabled if the items in the multiset are NOT an STL, except for std::string
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_stl_intrinsic( in_stl , object_name , var_name ) ;
}

View File

@ -31,7 +31,7 @@ int checkpoint_stl(std::stack<ITEM_TYPE> & in_stl , std::string object_name , st
char var_declare[128] ;
int status ;
ITEM_TYPE * items ;
ITEM_TYPE * items = nullptr ;
std::stack<ITEM_TYPE> temp_stack ;
cont_size = in_stl.size() ;
@ -68,7 +68,7 @@ int restore_stl(std::stack<ITEM_TYPE> & in_stl , std::string object_name , std::
unsigned int cont_size ;
REF2 * items_ref ;
ITEM_TYPE * items ;
ITEM_TYPE * items = nullptr ;
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
//message_publish(1, "RESTORE_STL_STACK %s_%s\n", object_name.c_str() , var_name.c_str()) ;

View File

@ -173,7 +173,7 @@ sub make_swig_makefile() {
SWIG_FLAGS ?=
SWIG_CFLAGS := -I../include \${PYTHON_INCLUDES} -Wno-shadow -Wno-missing-field-initializers
ifeq (\$(IS_CC_CLANG), 1)
SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized
SWIG_CFLAGS += -Wno-self-assign -Wno-sometimes-uninitialized -Wno-deprecated-register
endif
ifdef TRICK_VERBOSE_BUILD

View File

@ -3,9 +3,9 @@ def main():
#trick.echo_jobs_on()
trick.sim_control_panel_set_enabled(True)
trick.real_time_enable()
trick.itimer_enable()
#trick.sim_control_panel_set_enabled(True)
#trick.real_time_enable()
#trick.itimer_enable()
trick.checkpoint_pre_init(True)
#trick.checkpoint_post_init(True)