Add direct STL checkpointing

Removed the previous attempts at STL checkpointing. Removed
the header files and sims.  Also simplified the names of some of
the templates.

refs #206
This commit is contained in:
Alex Lin 2016-03-31 14:50:27 -05:00
parent 06a405ef35
commit c8a39f4a44
43 changed files with 413 additions and 5129 deletions

View File

@ -332,24 +332,6 @@ namespace Trick {
*/
virtual int load_default_data() ;
/**
* Our own pre_checkpoint job to save off our STLs
* @return always 0
*/
virtual int pre_checkpoint() ;
/**
* Our own pre_checkpoint job to remove extra memory when checkpoining STLs
* @return always 0
*/
virtual int post_checkpoint() ;
/**
* Our own restart job to restore STLs
* @return always 0
*/
virtual int restart() ;
// Removed all doxygen documents for functions that have documents in the parent class since
// Doxygen inherits the documents from the parent class automatically.

View File

@ -24,89 +24,111 @@
// Checkpoint routines
// vector
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// list
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// deque
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// set
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// multiset
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int checkpoint_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// map
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
// multimap
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
// pair
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
// queue
@ -143,89 +165,111 @@ int checkpoint_stl(std::stack<ITEM_TYPE, _Sequence> & in_stl , std::string objec
// Restore routines
// vector
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// list
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// deque
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// set
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// multiset
template <typename ITEM_TYPE, typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* = nullptr >
int restore_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) ;
// map
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
// multimap
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* = nullptr >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) ;
// pair
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* = nullptr >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
template <class FIRST, class SECOND,
typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* = nullptr >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) ;
// queue

View File

@ -19,28 +19,28 @@ struct is_stl_container {
static const bool value = false;
};
template <typename T,typename Alloc>
struct is_stl_container<std::vector<T,Alloc> > {
template <typename T,typename _Alloc>
struct is_stl_container<std::vector<T,_Alloc> > {
static const bool value = true;
};
template <typename T,typename Alloc>
struct is_stl_container<std::list<T,Alloc> > {
template <typename T,typename _Alloc>
struct is_stl_container<std::list<T,_Alloc> > {
static const bool value = true;
};
template <typename T,typename Alloc>
struct is_stl_container<std::deque<T,Alloc> > {
template <typename T,typename _Alloc>
struct is_stl_container<std::deque<T,_Alloc> > {
static const bool value = true;
};
template <typename T,typename Compare,typename Alloc>
struct is_stl_container<std::set<T,Compare,Alloc> > {
template <typename T,typename _Compare,typename _Alloc>
struct is_stl_container<std::set<T,_Compare,_Alloc> > {
static const bool value = true;
};
template <typename T,typename Compare,typename Alloc>
struct is_stl_container<std::multiset<T,Compare,Alloc> > {
template <typename T,typename _Compare,typename _Alloc>
struct is_stl_container<std::multiset<T,_Compare,_Alloc> > {
static const bool value = true;
};

View File

@ -35,7 +35,7 @@
// intrinsic key, intrinsic data
template <class STL>
int checkpoint_map_stl_ik_id(STL & in_map , std::string object_name , std::string var_name ) {
int checkpoint_map_ik_id(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -73,21 +73,23 @@ int checkpoint_map_stl_ik_id(STL & in_map , std::string object_name , std::strin
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_ik_id( in_map , object_name , var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_ik_id( in_map , object_name , var_name ) ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_ik_id( in_map , object_name , var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_ik_id( in_map , object_name , var_name ) ;
}
// intrinsic key, STL data
template <class STL>
int checkpoint_map_stl_ik_sd(STL & in_map , std::string object_name , std::string var_name ) {
int checkpoint_map_ik_sd(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -133,21 +135,23 @@ int checkpoint_map_stl_ik_sd(STL & in_map , std::string object_name , std::strin
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_ik_sd( in_map , object_name , var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_ik_sd( in_map , object_name , var_name ) ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_ik_sd( in_map , object_name , var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_ik_sd( in_map , object_name , var_name ) ;
}
// STL key, intrinsic data
template <class STL>
int checkpoint_map_stl_sk_id(STL & in_map , std::string object_name , std::string var_name ) {
int checkpoint_map_sk_id(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -193,16 +197,18 @@ int checkpoint_map_stl_sk_id(STL & in_map , std::string object_name , std::strin
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_sk_id( in_map , object_name , var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_sk_id( in_map , object_name , var_name ) ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_sk_id( in_map , object_name , var_name ) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_sk_id( in_map , object_name , var_name ) ;
}
// STL key, STL data
@ -213,7 +219,6 @@ int checkpoint_map_stl_sk_sd(STL & in_map , std::string object_name , std::strin
unsigned int cont_size ;
std::ostringstream var_declare ;
typename STL::iterator iter ;
int status ;
std::string * keys = nullptr ;
std::string * items = nullptr ;
@ -257,21 +262,23 @@ int checkpoint_map_stl_sk_sd(STL & in_map , std::string object_name , std::strin
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int checkpoint_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_sk_sd( in_map , object_name , var_name ) ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type*>
int checkpoint_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_sk_sd( in_map , object_name , var_name ) ;
}
/* =================================================================================================*/
template <class STL>
int delete_map_stl(STL & in_map __attribute__ ((unused)), std::string object_name , std::string var_name ) {
int delete_map_allocs(STL & in_map __attribute__ ((unused)), std::string object_name , std::string var_name ) {
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
REF2 * items_ref ;
items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name + std::string("_keys")).c_str()) ;
@ -283,14 +290,14 @@ int delete_map_stl(STL & in_map __attribute__ ((unused)), std::string object_nam
return 0 ;
}
template <class KEY, class DATA>
int delete_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return delete_map_stl(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc>
int delete_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return delete_map_allocs(in_map , object_name , var_name) ;
}
template <class KEY, class DATA>
int delete_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return delete_map_stl(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc>
int delete_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return delete_map_allocs(in_map , object_name , var_name) ;
}
/* =================================================================================================*/
@ -302,7 +309,7 @@ int delete_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , st
the map from the 2 arrays.
*/
template <class STL>
int restore_map_stl_ik_id(STL & in_map , std::string object_name , std::string var_name ) {
int restore_map_ik_id(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -333,20 +340,22 @@ int restore_map_stl_ik_id(STL & in_map , std::string object_name , std::string v
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_ik_id(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_ik_id(in_map , object_name , var_name) ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_ik_id(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_ik_id(in_map , object_name , var_name) ;
}
template <class STL>
int restore_map_stl_ik_sd(STL & in_map , std::string object_name , std::string var_name ) {
int restore_map_ik_sd(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -381,20 +390,22 @@ int restore_map_stl_ik_sd(STL & in_map , std::string object_name , std::string v
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_ik_sd(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_ik_sd(in_map , object_name , var_name) ;
}
template <class KEY, class DATA, typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_ik_sd(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if<!is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_ik_sd(in_map , object_name , var_name) ;
}
template <class STL>
int restore_map_stl_sk_id(STL & in_map , std::string object_name , std::string var_name ) {
int restore_map_sk_id(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -429,20 +440,22 @@ int restore_map_stl_sk_id(STL & in_map , std::string object_name , std::string v
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_sk_id(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_sk_id(in_map , object_name , var_name) ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_sk_id(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
!is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_sk_id(in_map , object_name , var_name) ;
}
template <class STL>
int restore_map_stl_sk_sd(STL & in_map , std::string object_name , std::string var_name ) {
int restore_map_sk_sd(STL & in_map , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -481,16 +494,18 @@ int restore_map_stl_sk_sd(STL & in_map , std::string object_name , std::string v
return 0 ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_sk_sd(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::map<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_sk_sd(in_map , object_name , var_name) ;
}
template <class KEY, class DATA, typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY , DATA> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_sk_sd(in_map , object_name , var_name) ;
template <class KEY, class DATA, typename _Compare, typename _Alloc,
typename std::enable_if< is_stl_container<KEY>::value &&
is_stl_container<DATA>::value >::type* >
int restore_stl(std::multimap<KEY,DATA,_Compare,_Alloc> & in_map , std::string object_name , std::string var_name ) {
return restore_map_sk_sd(in_map , object_name , var_name) ;
}
#endif

View File

@ -23,9 +23,9 @@
#include "trick/message_proto.h"
// intrinsic first , intrinsic second
template <class FIRST, class SECOND>
int checkpoint_pair_if_is(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
std::ostringstream var_declare ;
int status ;
@ -37,7 +37,7 @@ int checkpoint_pair_if_is(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_first[1]" ;
first = (FIRST *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_first").c_str()) ;
first[0] = in_stl.first ;
first[0] = in_pair.first ;
var_declare.str("") ;
var_declare.clear() ;
@ -45,20 +45,15 @@ int checkpoint_pair_if_is(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_second[1]" ;
second = (SECOND *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_second").c_str()) ;
second[0] = in_stl.second ;
second[0] = in_pair.second ;
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return checkpoint_pair_if_is( in_pair, object_name, var_name ) ;
}
// intrinsic first , STL second
template <class FIRST, class SECOND>
int checkpoint_pair_if_ss(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
std::ostringstream var_declare ;
int status ;
@ -71,7 +66,7 @@ int checkpoint_pair_if_ss(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_first[1]" ;
first = (FIRST *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_first").c_str()) ;
first[0] = in_stl.first ;
first[0] = in_pair.first ;
var_declare.str("") ;
var_declare.clear() ;
@ -79,20 +74,15 @@ int checkpoint_pair_if_ss(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_second[1]" ;
second = (std::string *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_second").c_str()) ;
checkpoint_stl( in_stl.second , object_name + "_" + var_name , "second" ) ;
checkpoint_stl( in_pair.second , object_name + "_" + var_name , "second" ) ;
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return checkpoint_pair_if_ss( in_pair, object_name, var_name ) ;
}
// STL first , intrinsic second
template <class FIRST, class SECOND>
int checkpoint_pair_sf_is(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
std::ostringstream var_declare ;
int status ;
@ -105,7 +95,7 @@ int checkpoint_pair_sf_is(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_first[1]" ;
first = (std::string *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_first").c_str()) ;
checkpoint_stl( in_stl.first , object_name + "_" + var_name , "first" ) ;
checkpoint_stl( in_pair.first , object_name + "_" + var_name , "first" ) ;
var_declare.str("") ;
var_declare.clear() ;
@ -113,23 +103,17 @@ int checkpoint_pair_sf_is(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_second[1]" ;
second = (SECOND *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_second").c_str()) ;
second[0] = in_stl.second ;
second[0] = in_pair.second ;
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return checkpoint_pair_sf_is( in_pair, object_name, var_name ) ;
}
// STL first , STL second
template <class FIRST, class SECOND>
int checkpoint_pair_sf_ss(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
std::ostringstream var_declare ;
int status ;
std::string * first = nullptr ;
std::string * second = nullptr ;
@ -139,7 +123,7 @@ int checkpoint_pair_sf_ss(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_first[1]" ;
first = (std::string *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_first").c_str()) ;
checkpoint_stl( in_stl.first , object_name + "_" + var_name , "first" ) ;
checkpoint_stl( in_pair.first , object_name + "_" + var_name , "first" ) ;
var_declare.str("") ;
var_declare.clear() ;
@ -147,17 +131,11 @@ int checkpoint_pair_sf_ss(std::pair<FIRST, SECOND> & in_stl , std::string object
<< object_name << "_" << var_name << "_second[1]" ;
second = (std::string *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name + "_second").c_str()) ;
checkpoint_stl( in_stl.second , object_name + "_" + var_name , "second" ) ;
checkpoint_stl( in_pair.second , object_name + "_" + var_name , "second" ) ;
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int checkpoint_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return checkpoint_pair_sf_ss( in_pair, object_name, var_name ) ;
}
/* =================================================================================================*/
template <class FIRST, class SECOND>
@ -176,8 +154,9 @@ int delete_stl(std::pair<FIRST, SECOND> & in_stl __attribute__ ((unused)) , std:
/* =================================================================================================*/
// intrinsic first, intrinsic second
template <class FIRST, class SECOND>
int restore_pair_if_is(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
REF2 * first_ref ;
REF2 * second_ref ;
@ -194,24 +173,19 @@ int restore_pair_if_is(std::pair<FIRST, SECOND> & in_stl , std::string object_na
first = (FIRST *)first_ref->address ;
second = (SECOND *)second_ref->address ;
in_stl.first = first[0] ;
in_stl.second = second[0] ;
in_pair.first = first[0] ;
in_pair.second = second[0] ;
delete_stl( in_stl , object_name , var_name ) ;
delete_stl( in_pair , object_name , var_name ) ;
}
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return restore_pair_if_is( in_pair, object_name, var_name ) ;
}
// intrinsic first, STL second
template <class FIRST, class SECOND>
int restore_pair_if_ss(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
REF2 * first_ref ;
REF2 * second_ref ;
@ -229,24 +203,19 @@ int restore_pair_if_ss(std::pair<FIRST, SECOND> & in_stl , std::string object_na
first = (FIRST *)first_ref->address ;
second = (std::string *)second_ref->address ;
in_stl.first = first[0] ;
restore_stl( in_stl.second , object_name + "_" + var_name , "second" ) ;
in_pair.first = first[0] ;
restore_stl( in_pair.second , object_name + "_" + var_name , "second" ) ;
delete_stl( in_stl , object_name , var_name ) ;
delete_stl( in_pair , object_name , var_name ) ;
}
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if<!is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return restore_pair_if_ss( in_pair, object_name, var_name ) ;
}
// STL first, intrinsic second
template <class FIRST, class SECOND>
int restore_pair_sf_is(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
REF2 * first_ref ;
REF2 * second_ref ;
@ -264,25 +233,19 @@ int restore_pair_sf_is(std::pair<FIRST, SECOND> & in_stl , std::string object_na
first = (std::string *)first_ref->address ;
second = (SECOND *)second_ref->address ;
restore_stl( in_stl.first , object_name + "_" + var_name , "first" ) ;
in_stl.second = second[0] ;
restore_stl( in_pair.first , object_name + "_" + var_name , "first" ) ;
in_pair.second = second[0] ;
delete_stl( in_stl , object_name , var_name ) ;
delete_stl( in_pair , object_name , var_name ) ;
}
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
!is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return restore_pair_sf_is( in_pair, object_name, var_name ) ;
}
// STL first, STL second
template <class FIRST, class SECOND>
int restore_pair_sf_ss(std::pair<FIRST, SECOND> & in_stl , std::string object_name , std::string var_name ) {
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
REF2 * first_ref ;
REF2 * second_ref ;
@ -299,19 +262,13 @@ int restore_pair_sf_ss(std::pair<FIRST, SECOND> & in_stl , std::string object_na
first = (std::string *)first_ref->address ;
second = (std::string *)second_ref->address ;
restore_stl( in_stl.first , object_name + "_" + var_name , "first" ) ;
restore_stl( in_stl.second , object_name + "_" + var_name , "second" ) ;
restore_stl( in_pair.first , object_name + "_" + var_name , "first" ) ;
restore_stl( in_pair.second , object_name + "_" + var_name , "second" ) ;
delete_stl( in_stl , object_name , var_name ) ;
delete_stl( in_pair , object_name , var_name ) ;
}
return 0 ;
}
template <class FIRST, class SECOND, typename std::enable_if< is_stl_container<FIRST>::value &&
is_stl_container<SECOND>::value >::type* >
int restore_stl(std::pair<FIRST , SECOND> & in_pair , std::string object_name , std::string var_name ) {
return restore_pair_sf_ss( in_pair, object_name, var_name ) ;
}
#endif

View File

@ -18,6 +18,7 @@
#include "checkpoint_is_stl_container.hh"
#include "checkpoint_fwd_declare.hh"
#include "checkpoint_sequence_stl.hh"
#include "trick/memorymanager_c_intf.h"
#include "trick/message_proto.h"
@ -64,7 +65,6 @@ int checkpoint_stl(std::queue<ITEM_TYPE,_Sequence> & in_stl , std::string object
unsigned int ii ;
unsigned int cont_size ;
std::ostringstream var_declare ;
int status ;
std::string * items = nullptr ;
std::queue<ITEM_TYPE,_Sequence> temp_queue(in_stl) ;
@ -134,7 +134,6 @@ int checkpoint_stl(std::priority_queue<ITEM_TYPE, _Container, _Compare> & in_stl
unsigned int ii ;
unsigned int cont_size ;
std::ostringstream var_declare ;
int status ;
std::string * items = nullptr ;
std::priority_queue<ITEM_TYPE,_Container,_Compare> temp_queue(in_stl) ;
@ -143,7 +142,7 @@ int checkpoint_stl(std::priority_queue<ITEM_TYPE, _Container, _Compare> & in_stl
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
if ( cont_size > 0 ) {
var_declare << abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ) << " "
var_declare << "std::string "
<< object_name << "_" << var_name << "[" << cont_size << "]" ;
items = (std::string *)TMM_declare_var_s(var_declare.str().c_str()) ;
TMM_add_checkpoint_alloc_dependency(std::string(object_name + "_" + var_name).c_str()) ;
@ -166,15 +165,17 @@ int checkpoint_stl(std::priority_queue<ITEM_TYPE, _Container, _Compare> & in_stl
/* =================================================================================================*/
// The delete routines use the same method as the sequence types
template <typename ITEM_TYPE, typename _Sequence>
int delete_stl(std::queue<ITEM_TYPE,_Sequence> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
template <typename ITEM_TYPE, typename _Container, typename _Compare>
int delete_stl(std::priority_queue<ITEM_TYPE,_Container,_Compare> & in_stl ,
std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
/* =================================================================================================*/

View File

@ -27,7 +27,7 @@
/* =================================================================================================*/
template <class STL>
int checkpoint_sequence_stl_intrinsic(STL & in_stl , std::string object_name , std::string var_name ) {
int checkpoint_sequence_i(STL & in_stl , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -62,7 +62,7 @@ int checkpoint_sequence_stl_intrinsic(STL & in_stl , std::string object_name , s
}
template <class STL>
int checkpoint_sequence_stl_stl(STL & in_stl , std::string object_name , std::string var_name ) {
int checkpoint_sequence_s(STL & in_stl , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -104,77 +104,87 @@ 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// std::list
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// std::deque
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// std::set
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// std::multiset
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int checkpoint_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return checkpoint_sequence_i( in_stl , object_name , var_name ) ;
}
/* =================================================================================================*/
template <class STL>
int delete_sequence_stl(STL & in_stl __attribute__ ((unused)), std::string object_name , std::string var_name ) {
int delete_sequence_alloc(STL & in_stl __attribute__ ((unused)), std::string object_name , std::string var_name ) {
std::replace_if(object_name.begin(), object_name.end(), std::ptr_fun<int,int>(&std::ispunct), '_');
REF2 * items_ref ;
items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name).c_str()) ;
@ -185,29 +195,29 @@ int delete_sequence_stl(STL & in_stl __attribute__ ((unused)), std::string objec
return 0 ;
}
template <class ITEM_TYPE>
int delete_stl(std::vector<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
template <class ITEM_TYPE, typename _Alloc>
int delete_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
template <class ITEM_TYPE>
int delete_stl(std::list<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
template <class ITEM_TYPE, typename _Alloc>
int delete_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
template <class ITEM_TYPE>
int delete_stl(std::deque<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
template <class ITEM_TYPE, typename _Alloc>
int delete_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
template <class ITEM_TYPE>
int delete_stl(std::set<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
template <class ITEM_TYPE, typename _Alloc>
int delete_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
template <class ITEM_TYPE>
int delete_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
template <class ITEM_TYPE, typename _Alloc>
int delete_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
@ -219,7 +229,7 @@ int delete_stl(std::multiset<ITEM_TYPE> & in_stl , std::string object_name , std
the map from the 2 arrays.
*/
template <class STL>
int restore_sequence_stl_intrinsic(STL & in_stl , std::string object_name , std::string var_name ) {
int restore_sequence_i(STL & in_stl , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -247,7 +257,7 @@ int restore_sequence_stl_intrinsic(STL & in_stl , std::string object_name , std:
}
template <class STL>
int restore_sequence_stl_stl(STL & in_stl , std::string object_name , std::string var_name ) {
int restore_sequence_s(STL & in_stl , std::string object_name , std::string var_name ) {
unsigned int ii ;
unsigned int cont_size ;
@ -282,75 +292,85 @@ 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::vector<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_i( in_stl , object_name , var_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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::list<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::deque<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::set<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_i( in_stl , object_name , var_name ) ;
}
// -----------
// 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_s( 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* >
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 ) ;
template <typename ITEM_TYPE, typename _Alloc,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
int restore_stl(std::multiset<ITEM_TYPE,_Alloc> & in_stl , std::string object_name , std::string var_name ) {
return restore_sequence_i( in_stl , object_name , var_name ) ;
}
#endif

View File

@ -62,7 +62,6 @@ int checkpoint_stl(std::stack<ITEM_TYPE,_Sequence> & in_stl , std::string object
unsigned int ii ;
unsigned int cont_size ;
std::ostringstream var_declare ;
int status ;
std::string * items = nullptr ;
std::stack<ITEM_TYPE,_Sequence> temp_stack(in_stl) ;
@ -94,17 +93,19 @@ int checkpoint_stl(std::stack<ITEM_TYPE,_Sequence> & in_stl , std::string object
/* =================================================================================================*/
// The delete routine uses the same method as the sequence types
template <typename ITEM_TYPE, typename _Sequence>
int delete_stl(std::stack<ITEM_TYPE,_Sequence> & in_stl , std::string object_name , std::string var_name ) {
return delete_sequence_stl( in_stl , object_name , var_name ) ;
return delete_sequence_alloc( in_stl , object_name , var_name ) ;
}
/* =================================================================================================*/
/* Find the arrays the map data was stored in the checkpoint using ref_attributes
/* Find the arrays the map data was stored in the checkpoint using ref_attributes
From the address of the resulting ref_attributes, we can figure out the number of
items that were stored in the checkpoint. Knowing the size, we can restore
the map from the 2 arrays.
the map from the 2 arrays.
*/
template <typename ITEM_TYPE, typename _Sequence,
typename std::enable_if<!is_stl_container<ITEM_TYPE>::value>::type* >
@ -118,7 +119,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()) ;
items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name).c_str()) ;
items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name).c_str()) ;
if ( items_ref != NULL ) {
cont_size = in_stl.size() ;
@ -149,7 +150,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()) ;
items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name).c_str()) ;
items_ref = ref_attributes((char *)(object_name + std::string("_") + var_name).c_str()) ;
if ( items_ref != NULL ) {
cont_size = in_stl.size() ;

View File

@ -1,594 +0,0 @@
/*
PURPOSE: (Illustrate how to checkpoint STLs)
*/
#ifndef CHECKPOINT_TRICK_MAP_HH
#define CHECKPOINT_TRICK_MAP_HH
#include <string>
#include <algorithm>
#include <typeinfo>
#ifdef __GNUC__
#include <cxxabi.h>
#endif
#include "trick/STLInterface.hh"
#include "trick/memorymanager_c_intf.h"
#include "trick/message_proto.h"
/* For all of the checkpoint_map_stl variations. Declare 2 memory manager arrays to hold
the contents of the map. No simulation variable actually points to these arrays. Only the
user knows they are there and how they are stored. The restart function knows how to
"retrieve" and restore the data. The name of the declaration is important. Each instance of
the STL requires a unique name to be saved correctly. The incoming "object_name" and "var_name"
gives that unique name.
*/
template <class STL>
int checkpoint_trick_map_nkey_ndata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
int status ;
typename STL::key_type * keys ;
typename STL::mapped_type * items ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "%s %s_%06d_keys[%d]" ,
abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status ), object_name.c_str(), id, cont_size) ;
keys = (typename STL::key_type *)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "%s %s_%06d_data[%d]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id, cont_size) ;
items = (typename STL::mapped_type *)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = iter->first ;
items[ii] = iter->second ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_nkey_sdata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
int status ;
typename STL::key_type * keys ;
char ** items ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "%s %s_%06d_keys[%d]" ,
abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status ), object_name.c_str(), id , cont_size) ;
keys = (typename STL::key_type *)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "char * %s_%06d_data[%d]" , object_name.c_str(), id , cont_size) ;
items = (char **)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = iter->first ;
items[ii] = (char *)((iter->second).c_str()) ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_nkey_stldata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
int status ;
typename STL::key_type * keys ;
unsigned int * items = NULL ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "%s %s_%06d_keys[%d]" ,
abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status ), object_name.c_str(), id , cont_size) ;
keys = (typename STL::key_type *)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "unsigned int %s_%06d_data[%d]" , object_name.c_str(), id , cont_size) ;
items = (unsigned int*)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = iter->first ;
items[ii] = (iter->second).stl_id ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_skey_ndata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
int status ;
char ** keys ;
typename STL::mapped_type * items ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "char * %s_%06d_keys[%d]" , object_name.c_str(), id , cont_size) ;
keys = (char **)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "%s %s_%06d_data[%d]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id , cont_size) ;
items = (typename STL::mapped_type *)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = (char *)((iter->first).c_str()) ;
items[ii] = iter->second ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_skey_sdata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
char ** keys ;
char ** items ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "char * %s_%06d_keys[%d]" , object_name.c_str(), id , cont_size) ;
keys = (char **)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "char * %s_%06d_data[%d]" , object_name.c_str(), id , cont_size) ;
items = (char **)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = (char *)((iter->first).c_str()) ;
items[ii] = (char *)((iter->second).c_str()) ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_skey_stldata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
char ** keys ;
unsigned int * items = NULL ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "char * %s_%06d_keys[%d]" , object_name.c_str(), id , cont_size) ;
keys = (char **)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "unsigned int %s_%06d_data[%d]" , object_name.c_str(), id , cont_size) ;
items = (unsigned int*)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = (char *)((iter->first).c_str()) ;
items[ii] = (iter->second).stl_id ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_stlkey_ndata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
int status ;
unsigned int * keys = NULL ;
typename STL::mapped_type * items ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "unsigned int %s_%06d_keys[%d]" , object_name.c_str(), id , cont_size) ;
keys = (unsigned int*)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "%s %s_%06d_data[%d]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id , cont_size) ;
items = (typename STL::mapped_type *)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = (iter->first).stl_id ;
items[ii] = iter->second ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_stlkey_sdata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
unsigned int * keys = NULL ;
char ** items ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "unsigned int %s_%06d_keys[%d]" , object_name.c_str(), id , cont_size) ;
keys = (unsigned int*)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "char * %s_%06d_data[%d]" , object_name.c_str(), id , cont_size) ;
items = (char **)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = (iter->first).stl_id ;
items[ii] = (char *)((iter->second).c_str()) ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_map_stlkey_stldata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
typename STL::iterator iter ;
unsigned int * keys = NULL ;
unsigned int * items = NULL ;
cont_size = in_map.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "unsigned int %s_%06d_keys[%d]" , object_name.c_str(), id , cont_size) ;
keys = (unsigned int*)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "unsigned int %s_%06d_data[%d]" , object_name.c_str(), id , cont_size) ;
items = (unsigned int*)TMM_declare_var_s(var_declare) ;
/* copy the contents of the map the 2 arrays */
for ( iter = in_map.begin() , ii = 0 ; iter != in_map.end() ; iter++ , ii++ ) {
keys[ii] = (iter->first).stl_id ;
items[ii] = (iter->second).stl_id ;
}
}
return 0 ;
}
/* For all restore_map_stl varieties.
Find the arrays the map data was stored in the checkpoint using ref_attributes
From the address of the resulting ref_attributes, we can figure out the number
of items that were stored in the checkpoint. Knowing the size, we can restore
the map from the 2 arrays.
*/
template <class STL>
int restore_trick_map_nkey_ndata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
typename STL::key_type * keys ;
typename STL::mapped_type * items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (typename STL::key_type *)keys_ref->address ;
items = (typename STL::mapped_type *)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
in_map.insert( std::pair<typename STL::key_type , typename STL::mapped_type>(keys[ii], items[ii])) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_nkey_sdata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
typename STL::key_type * keys ;
char ** items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (typename STL::key_type *)keys_ref->address ;
items = (char **)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
in_map.insert( std::pair<typename STL::key_type, std::string>(keys[ii] , std::string(items[ii]))) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_nkey_stldata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
typename STL::key_type * keys ;
unsigned int * items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (typename STL::key_type *)keys_ref->address ;
items = (unsigned int *)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
typename STL::mapped_type mt ;
mt.stl_id = items[ii] ;
mt.restart( object_name ) ;
in_map.insert( std::pair<typename STL::key_type, typename STL::mapped_type>(keys[ii] , mt)) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_skey_ndata( STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
char ** keys ;
typename STL::mapped_type * items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (char **)keys_ref->address ;
items = (typename STL::mapped_type *)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
in_map.insert( std::pair<std::string , typename STL::mapped_type>(std::string(keys[ii]), items[ii])) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_skey_sdata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
char ** keys ;
char ** items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (char **)keys_ref->address ;
items = (char **)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
in_map.insert( std::pair<std::string, std::string>(std::string(keys[ii]) , std::string(items[ii]))) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_skey_stldata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
char ** keys ;
unsigned int * items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (char **)keys_ref->address ;
items = (unsigned int *)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
typename STL::mapped_type mt ;
mt.stl_id = items[ii] ;
mt.restart( object_name ) ;
in_map.insert( std::pair<std::string, typename STL::mapped_type>(std::string(keys[ii]) , mt)) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_stlkey_ndata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
unsigned int * keys ;
typename STL::mapped_type * items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (unsigned int *)keys_ref->address ;
items = (typename STL::mapped_type *)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
typename STL::key_type kt ;
kt.stl_id = keys[ii] ;
kt.restart( object_name ) ;
in_map.insert( std::pair<typename STL::key_type, typename STL::mapped_type>(kt , items[ii])) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_stlkey_sdata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
unsigned int * keys ;
char ** items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (unsigned int *)keys_ref->address ;
items = (char **)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
typename STL::key_type kt ;
kt.stl_id = keys[ii] ;
kt.restart( object_name ) ;
in_map.insert( std::pair<typename STL::key_type, typename STL::mapped_type>(kt , std::string(items[ii]))) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_map_stlkey_stldata(STL & in_map , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
unsigned int * keys ;
unsigned int * items ;
in_map.clear() ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (unsigned int *)keys_ref->address ;
items = (unsigned int *)items_ref->address ;
cont_size = get_size((char *)keys) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
typename STL::key_type kt ;
kt.stl_id = keys[ii] ;
kt.restart( object_name ) ;
typename STL::mapped_type mt ;
mt.stl_id = items[ii] ;
mt.restart( object_name ) ;
in_map.insert( std::pair<typename STL::key_type, typename STL::mapped_type>(kt , mt)) ;
}
}
return 0 ;
}
#endif

View File

@ -1,459 +0,0 @@
/*
PURPOSE: (Illustrate how to checkpoint STLs)
*/
#ifndef CHECKPOINT_TRICK_PAIR_HH
#define CHECKPOINT_TRICK_PAIR_HH
#include <string>
#include <algorithm>
#include <typeinfo>
#ifdef __GNUC__
#include <cxxabi.h>
#endif
#include "trick/STLInterface.hh"
#include "trick/memorymanager_c_intf.h"
#include "trick/message_proto.h"
template <class STL>
int checkpoint_trick_pair_nkey_ndata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
int status ;
typename STL::first_type * keys ;
typename STL::second_type * items ;
sprintf(var_declare, "%s %s_%06d_keys[1]" ,
abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status ), object_name.c_str(), id) ;
keys = (typename STL::first_type *)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "%s %s_%06d_data[1]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id) ;
items = (typename STL::second_type *)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = in_pair.first ;
items[0] = in_pair.second ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_nkey_sdata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
int status ;
typename STL::first_type * keys ;
char ** items ;
sprintf(var_declare, "%s %s_%06d_keys[1]" ,
abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status ), object_name.c_str(), id ) ;
keys = (typename STL::first_type *)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "char * %s_%06d_data[1]" , object_name.c_str(), id ) ;
items = (char **)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = in_pair.first ;
items[0] = (char *)((in_pair.second).c_str()) ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_nkey_stldata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
int status ;
typename STL::first_type * keys ;
unsigned int * items = NULL ;
sprintf(var_declare, "%s %s_%06d_keys[1]" ,
abi::__cxa_demangle(typeid(*keys).name(), 0, 0, &status ), object_name.c_str(), id ) ;
keys = (typename STL::first_type *)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "unsigned int %s_%06d_data[1]" , object_name.c_str(), id ) ;
items = (unsigned int*)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = in_pair.first ;
items[0] = (in_pair.second).stl_id ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_skey_ndata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
int status ;
char ** keys ;
typename STL::second_type * items ;
sprintf(var_declare, "char * %s_%06d_keys[1]" , object_name.c_str(), id ) ;
keys = (char **)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "%s %s_%06d_data[1]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id ) ;
items = (typename STL::second_type *)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = (char *)((in_pair.first).c_str()) ;
items[0] = in_pair.second ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_skey_sdata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
char ** keys ;
char ** items ;
sprintf(var_declare, "char * %s_%06d_keys[1]" , object_name.c_str(), id ) ;
keys = (char **)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "char * %s_%06d_data[1]" , object_name.c_str(), id ) ;
items = (char **)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = (char *)((in_pair.first).c_str()) ;
items[0] = (char *)((in_pair.second).c_str()) ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_skey_stldata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
char ** keys ;
unsigned int * items = NULL ;
sprintf(var_declare, "char * %s_%06d_keys[1]" , object_name.c_str(), id ) ;
keys = (char **)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "unsigned int %s_%06d_data[1]" , object_name.c_str(), id ) ;
items = (unsigned int*)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = (char *)((in_pair.first).c_str()) ;
items[0] = (in_pair.second).stl_id ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_stlkey_ndata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
int status ;
unsigned int * keys = NULL ;
typename STL::second_type * items ;
sprintf(var_declare, "unsigned int %s_%06d_keys[1]" , object_name.c_str(), id ) ;
keys = (unsigned int*)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "%s %s_%06d_data[1]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id ) ;
items = (typename STL::second_type *)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = (in_pair.first).stl_id ;
items[0] = in_pair.second ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_stlkey_sdata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
unsigned int * keys = NULL ;
char ** items ;
sprintf(var_declare, "unsigned int %s_%06d_keys[1]" , object_name.c_str(), id ) ;
keys = (unsigned int*)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "char * %s_%06d_data[1]" , object_name.c_str(), id ) ;
items = (char **)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = (in_pair.first).stl_id ;
items[0] = (char *)((in_pair.second).c_str()) ;
return 0 ;
}
template <class STL>
int checkpoint_trick_pair_stlkey_stldata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
unsigned int * keys = NULL ;
unsigned int * items = NULL ;
sprintf(var_declare, "unsigned int %s_%06d_keys[1]" , object_name.c_str(), id ) ;
keys = (unsigned int*)TMM_declare_var_s(var_declare) ;
sprintf(var_declare, "unsigned int %s_%06d_data[1]" , object_name.c_str(), id ) ;
items = (unsigned int*)TMM_declare_var_s(var_declare) ;
/* copy the contents of the pair the 2 arrays */
keys[0] = (in_pair.first).stl_id ;
items[0] = (in_pair.second).stl_id ;
return 0 ;
}
/* RESTORE */
template <class STL>
int restore_trick_pair_nkey_ndata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
typename STL::first_type * keys ;
typename STL::second_type * items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (typename STL::first_type *)keys_ref->address ;
items = (typename STL::second_type *)items_ref->address ;
in_pair.first = keys[0] ;
in_pair.second = items[0] ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_nkey_sdata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
typename STL::first_type * keys ;
char ** items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (typename STL::first_type *)keys_ref->address ;
items = (char **)items_ref->address ;
in_pair.first = keys[0] ;
in_pair.second = items[0] ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_nkey_stldata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
typename STL::first_type * keys ;
unsigned int * items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (typename STL::first_type *)keys_ref->address ;
items = (unsigned int *)items_ref->address ;
typename STL::second_type mt ;
mt.stl_id = items[0] ;
mt.restart( object_name ) ;
in_pair.first = keys[0] ;
in_pair.second = mt ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_skey_ndata( STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
char ** keys ;
typename STL::second_type * items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (char **)keys_ref->address ;
items = (typename STL::second_type *)items_ref->address ;
in_pair.first = keys[0] ;
in_pair.second = items[0] ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_skey_sdata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
char ** keys ;
char ** items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (char **)keys_ref->address ;
items = (char **)items_ref->address ;
in_pair.first = keys[0] ;
in_pair.second = items[0] ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_skey_stldata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
char ** keys ;
unsigned int * items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (char **)keys_ref->address ;
items = (unsigned int *)items_ref->address ;
typename STL::second_type mt ;
mt.stl_id = items[0] ;
mt.restart( object_name ) ;
in_pair.first = keys[0] ;
in_pair.second = mt ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_stlkey_ndata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
unsigned int * keys ;
typename STL::second_type * items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (unsigned int *)keys_ref->address ;
items = (typename STL::second_type *)items_ref->address ;
typename STL::first_type kt ;
kt.stl_id = keys[0] ;
kt.restart( object_name ) ;
in_pair.first = kt ;
in_pair.second = items[0] ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_stlkey_sdata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
unsigned int * keys ;
char ** items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (unsigned int *)keys_ref->address ;
items = (char **)items_ref->address ;
typename STL::first_type kt ;
kt.stl_id = keys[0] ;
kt.restart( object_name ) ;
in_pair.first = kt ;
in_pair.second = items[0] ;
}
return 0 ;
}
template <class STL>
int restore_trick_pair_stlkey_stldata(STL & in_pair , std::string object_name , unsigned int id ) {
char var_declare[128] ;
REF2 * keys_ref , * items_ref ;
unsigned int * keys ;
unsigned int * items ;
sprintf(var_declare, "%s_%06d_keys" , object_name.c_str(), id ) ;
keys_ref = ref_attributes(var_declare) ;
sprintf(var_declare, "%s_%06d_data" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( keys_ref != NULL && items_ref != NULL ) {
keys = (unsigned int *)keys_ref->address ;
items = (unsigned int *)items_ref->address ;
typename STL::first_type kt ;
kt.stl_id = keys[0] ;
kt.restart( object_name ) ;
typename STL::second_type mt ;
mt.stl_id = items[0] ;
mt.restart( object_name ) ;
in_pair.first = kt ;
in_pair.second = mt ;
}
return 0 ;
}
#endif

View File

@ -1,199 +0,0 @@
/*
PURPOSE: (Helpers to checkpoint STLs)
*/
#ifndef CHECKPOINT_TRICK_SEQUENCE_STL_HH
#define CHECKPOINT_TRICK_SEQUENCE_STL_HH
#include <string>
#include <iostream>
#include <algorithm>
#include <typeinfo>
#ifdef __GNUC__ #include <cxxabi.h> #endif
#include "trick/STLInterface.hh"
#include "trick/memorymanager_c_intf.h"
#include "trick/message_proto.h"
/*
These template routines perform the checkpoint and restore work for sequence STL types.
The sequence STL types include vectors, lists, deques, sets, and multisets.
There are 3 checkpoint and restore versions depending on the contained type.
*/
template <class STL>
int checkpoint_trick_sequence_stl(STL & in_stl , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
int status ;
typename STL::value_type * items = NULL ;
typename STL::iterator it ;
typename STL::iterator end ;
cont_size = in_stl.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "%s %s_%06d[%d]" ,
abi::__cxa_demangle(typeid(*items).name(), 0, 0, &status ), object_name.c_str(), id, cont_size) ;
items = (typename STL::value_type *)TMM_declare_var_s(var_declare) ;
//message_publish(1, "CHECKPOINT_SEQUENCE_STL with %s\n", var_declare) ;
/* copy the contents of the stl */
for ( ii = 0 , it = in_stl.begin() , end = in_stl.end() ; it != end ; it++ , ii++ ) {
items[ii] = *it ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_sequence_stl_string(STL & in_stl , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
const char ** items ;
typename STL::iterator it ;
typename STL::iterator end ;
cont_size = in_stl.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "char * %s_%06d[%d]" , object_name.c_str(), id , cont_size) ;
items = (const char **)TMM_declare_var_s(var_declare) ;
//message_publish(1, "CHECKPOINT_SEQUENCE_STL_STRING with %s\n", var_declare) ;
/* copy the contents of the vector */
for ( ii = 0 , it = in_stl.begin() , end = in_stl.end() ; it != end ; it++ , ii++ ) {
items[ii] = it->c_str() ;
}
}
return 0 ;
}
template <class STL>
int checkpoint_trick_sequence_stl_STLInterface(STL & in_stl , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
unsigned int * items = NULL ;
typename STL::iterator it ;
typename STL::iterator end ;
typename STL::value_type vt ;
cont_size = in_stl.size() ;
if ( cont_size > 0 ) {
sprintf(var_declare, "unsigned int %s_%06d[%d]" , object_name.c_str(), id, cont_size) ;
items = (unsigned int *)TMM_declare_var_s(var_declare) ;
//message_publish(1, "CHECKPOINT_SEQUENCE_STL with %s\n", var_declare) ;
/* copy the contents of the stl */
for ( ii = 0 , it = in_stl.begin() , end = in_stl.end() ; it != end ; it++ , ii++ ) {
items[ii] = (*it).stl_id ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_sequence_stl(STL & in_stl , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * items_ref ;
typename STL::value_type * items ;
//message_publish(1, "RESTORE_SEQUENCE_STL %s_%s\n", object_name.c_str() , var_name.c_str()) ;
in_stl.clear() ;
sprintf(var_declare, "%s_%06d" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( items_ref != NULL ) {
items = (typename STL::value_type *)items_ref->address ;
cont_size = get_size((char *)items) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
in_stl.insert( in_stl.end(), items[ii] ) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_sequence_stl_string(STL & in_stl , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * items_ref ;
char ** items ;
//message_publish(1, "in specialized vector template restore\n") ;
in_stl.clear() ;
sprintf(var_declare, "%s_%06d" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( items_ref != NULL ) {
items = (char **)items_ref->address ;
cont_size = get_size((char *)items) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
in_stl.insert( in_stl.end(), items[ii] ) ;
}
}
return 0 ;
}
template <class STL>
int restore_trick_sequence_stl_STLInterface(STL & in_stl , std::string object_name , unsigned int id ) {
unsigned int ii ;
unsigned int cont_size ;
char var_declare[128] ;
REF2 * items_ref ;
unsigned int * items ;
//message_publish(1, "RESTORE_SEQUENCE_STL %s_%s\n", object_name.c_str() , var_name.c_str()) ;
in_stl.clear() ;
sprintf(var_declare, "%s_%06d" , object_name.c_str(), id ) ;
items_ref = ref_attributes(var_declare) ;
if ( items_ref != NULL ) {
items = (unsigned int *)items_ref->address ;
cont_size = get_size((char *)items) ;
for ( ii = 0 ; ii < cont_size ; ii++ ) {
typename STL::value_type vt ;
vt.stl_id = items[ii] ;
vt.restart( object_name ) ;
in_stl.insert( in_stl.end(), vt ) ;
}
}
return 0 ;
}
#endif

View File

@ -1,131 +0,0 @@
#ifndef TRICK_DEQUE_HH
#define TRICK_DEQUE_HH
#include <string>
#include <deque>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_sequence_stl.hh"
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Tp, typename _Alloc = std::allocator<_Tp> , class dummy = void >
class deque {} ;
// Template use for everything except strings and other STL types.
template <typename _Tp , typename _Alloc >
class deque<_Tp, _Alloc,
typename std::enable_if< !std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::deque<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
deque() {} ;
// fill constructor
explicit deque(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::deque<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
deque(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::deque<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
deque(const deque & __x) : std::deque<_Tp,_Alloc>(__x) {}
// assignment operator
deque& operator=(const deque & __x) {
std::deque<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
} ;
// Specialized deque for other Trick STL types.
template <typename _Tp , typename _Alloc >
class deque<_Tp, _Alloc, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Tp>::value>::type > : public std::deque<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
deque() {} ;
// fill constructor
explicit deque(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::deque<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
deque(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::deque<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
deque(const deque & __x) : std::deque<_Tp,_Alloc>(__x) {}
// assignment operator
deque& operator=(const deque & __x) {
std::deque<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
} ;
// Specialized deque for strings
template <typename _Tp , typename _Alloc >
class deque<_Tp, _Alloc, typename std::enable_if<std::is_same<_Tp,std::string>::value>::type > : public std::deque<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
deque() {} ;
// fill constructor
explicit deque(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::deque<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
deque(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::deque<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
deque(const deque & __x) : std::deque<_Tp,_Alloc>(__x) {}
// assignment operator
deque& operator=(const deque & __x) {
std::deque<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -1,131 +0,0 @@
#ifndef TRICK_LIST_HH
#define TRICK_LIST_HH
#include <string>
#include <list>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_sequence_stl.hh"
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Tp, typename _Alloc = std::allocator<_Tp> , class dummy = void >
class list {} ;
// Template use for everything except strings and other STL types.
template <typename _Tp , typename _Alloc >
class list<_Tp, _Alloc,
typename std::enable_if< !std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::list<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
list() {} ;
// fill constructor
explicit list(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::list<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
list(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::list<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
list(const list & __x) : std::list<_Tp,_Alloc>(__x) {}
// assignment operator
list& operator=(const list & __x) {
std::list<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
} ;
// Specialized list for other Trick STL types.
template <typename _Tp , typename _Alloc >
class list<_Tp, _Alloc, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Tp>::value>::type > : public std::list<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
list() {} ;
// fill constructor
explicit list(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::list<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
list(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::list<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
list(const list & __x) : std::list<_Tp,_Alloc>(__x) {}
// assignment operator
list& operator=(const list & __x) {
std::list<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
} ;
// Specialized list for strings
template <typename _Tp , typename _Alloc >
class list<_Tp, _Alloc, typename std::enable_if<std::is_same<_Tp,std::string>::value>::type > : public std::list<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
list() {} ;
// fill constructor
explicit list(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::list<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
list(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::list<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
list(const list & __x) : std::list<_Tp,_Alloc>(__x) {}
// assignment operator
list& operator=(const list & __x) {
std::list<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -1,851 +0,0 @@
#ifndef TRICK_MAP_HH
#define TRICK_MAP_HH
#include <string>
#include <map>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_map_stl.hh"
#include "trick/STLUtilities.hh"
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Alloc = std::allocator<_Tp> , class dummy = void >
class map {} ;
// Template used when both key and data are not strings or other STLs
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value &&
!std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_nkey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_nkey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map normal key, string data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_same<_Tp,std::string>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_nkey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_nkey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map normal key, STL data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_nkey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_nkey_stldata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map string key, normal data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_same<_Key,std::string>::value &&
!std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_skey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_skey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map string key, string data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_same<_Key,std::string>::value &&
std::is_same<_Tp,std::string>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_skey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_skey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map string key, STL data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_same<_Key,std::string>::value &&
std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_skey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_skey_stldata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map STL key, normal data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_Key>::value &&
!std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_stlkey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_stlkey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map STL key, string data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_same<_Tp,std::string>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_stlkey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_stlkey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized map STL key, STL data. (Really? Who in their right mind would do this?)
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class map<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::map<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
map() {} ;
// iterator range constructor
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
map(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::map<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
map(const map & __x) : std::map<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
map& operator=(const map & __x) {
std::map<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_stlkey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_stlkey_stldata( *this , obj_name , stl_id ) ;
}
} ;
/* MULTIMAP */
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Key, typename _Tp, typename _Compare = std::less<_Key>,
typename _Alloc = std::allocator<_Tp> , class dummy = void >
class multimap {} ;
// Template used when both key and data are not strings or other STLs
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value &&
!std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_nkey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_nkey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap normal key, string data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_same<_Tp,std::string>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_nkey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_nkey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap normal key, STL data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_nkey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_nkey_stldata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap string key, normal data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_same<_Key,std::string>::value &&
!std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_skey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_skey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap string key, string data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_same<_Key,std::string>::value &&
std::is_same<_Tp,std::string>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_skey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_skey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap string key, STL data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_same<_Key,std::string>::value &&
std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_skey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_skey_stldata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap STL key, normal data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_Key>::value &&
!std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_stlkey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_stlkey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap STL key, string data.
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_same<_Tp,std::string>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_stlkey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_stlkey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multimap STL key, STL data. (Really? Who in their right mind would do this?)
template <typename _Key, typename _Tp , typename _Compare, typename _Alloc >
class multimap<_Key, _Tp, _Compare, _Alloc,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_Key>::value &&
std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::multimap<_Key,_Tp,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multimap() {} ;
// iterator range constructor
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multimap(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multimap(const multimap & __x) : std::multimap<_Key,_Tp,_Compare,_Alloc>(__x) {}
// assignment operator
multimap& operator=(const multimap & __x) {
std::multimap<_Key,_Tp,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_map_stlkey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_map_stlkey_stldata( *this , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -1,382 +0,0 @@
#ifndef TRICK_PAIR_HH
#define TRICK_PAIR_HH
#include <string>
#include <utility>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_pair_stl.hh"
#include "trick/STLUtilities.hh"
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _T1, typename _T2, class dummy = void >
class pair {} ;
// Template used when both key and data are not strings or other STLs
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< !std::is_same<_T1,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_T1>::value &&
!std::is_same<_T2,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_T2>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {}
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_nkey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_nkey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair normal key, string data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< !std::is_same<_T1,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_T1>::value &&
std::is_same<_T2,std::string>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_nkey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_nkey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair normal key, STL data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< !std::is_same<_T1,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_T1>::value &&
std::is_base_of<Trick::STLInterface,_T2>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_nkey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_nkey_stldata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair string key, normal data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< std::is_same<_T1,std::string>::value &&
!std::is_same<_T2,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_T2>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_skey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_skey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair string key, string data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< std::is_same<_T1,std::string>::value &&
std::is_same<_T2,std::string>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_skey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_skey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair string key, STL data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< std::is_same<_T1,std::string>::value &&
std::is_base_of<Trick::STLInterface,_T2>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_skey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_skey_stldata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair STL key, normal data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_T1>::value &&
!std::is_same<_T2,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_T2>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_stlkey_ndata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_stlkey_ndata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair STL key, string data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_T1>::value &&
std::is_same<_T2,std::string>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_stlkey_sdata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_stlkey_sdata( *this , obj_name , stl_id ) ;
}
} ;
// Specialized pair STL key, STL data.
template <typename _T1, typename _T2 >
class pair<_T1, _T2,
typename std::enable_if< std::is_base_of<Trick::STLInterface,_T1>::value &&
std::is_base_of<Trick::STLInterface,_T2>::value
>::type > : public std::pair<_T1,_T2> , public STLInterface {
public:
// default constructor
pair() {} ;
// incoming data constructor
pair(const _T1& __a, const _T2& __b) : std::pair<_T1,_T2>(__a,__b) {}
// templated copy constructor
template<class _U1, class _U2>
pair(const pair<_U1, _U2>& __p) : std::pair<_T1,_T2>(__p) {}
// assignment operator
pair& operator=(const pair & __x) {
std::pair<_T1,_T2>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_pair_stlkey_stldata( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::checkpoint
virtual void post_checkpoint( std::string obj_name ) {
delete_trick_map_stl( obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_pair_stlkey_stldata( *this , obj_name , stl_id ) ;
}
} ;
template<class _T1, class _T2>
inline pair<_T1, _T2> make_pair(_T1 __x, _T2 __y) { return pair<_T1, _T2>(__x, __y); }
} ;
#endif

View File

@ -1,160 +0,0 @@
#ifndef TRICK_QUEUE_HH
#define TRICK_QUEUE_HH
#include <string>
#include <queue>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_sequence_stl.hh"
/*
This algorithm depends on the queue container type is called "c" and is
a protected variable. There are no guarantees this works with anything but
the current gcc versions we are using.
*/
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Tp, typename _Sequence = std::deque<_Tp>, class dummy = void >
class queue {} ;
// Template use for everything except strings and other STL types.
template <typename _Tp , typename _Sequence >
class queue<_Tp, _Sequence,
typename std::enable_if< !std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::queue<_Tp, _Sequence> , public STLInterface {
public:
// default constructor
explicit queue(const _Sequence& __c = _Sequence()) : std::queue<_Tp, _Sequence>(__c) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( std::queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( std::queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
// Specialized queue for strings
template <typename _Tp , typename _Sequence >
class queue<_Tp, _Sequence, typename std::enable_if<std::is_same<_Tp,std::string>::value>::type >
: public std::queue<_Tp, _Sequence> , public STLInterface {
public:
// default constructor
explicit queue(const _Sequence& __c = _Sequence()) : std::queue<_Tp, _Sequence>(__c) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( std::queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( std::queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
// Specialized queue for other Trick STL types.
template <typename _Tp , typename _Sequence >
class queue<_Tp, _Sequence, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Tp>::value>::type >
: public std::queue<_Tp, _Sequence> , public STLInterface {
public:
// default constructor
explicit queue(const _Sequence& __s = _Sequence()) : std::queue<_Tp, _Sequence>(__s) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( std::queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( std::queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
/* PRIORITY QUEUE */
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Tp, typename _Sequence = std::vector<_Tp>,
typename _Compare = std::less<typename _Sequence::value_type> , class dummy = void >
class priority_queue {} ;
// Template use for everything except strings and other STL types.
template <typename _Tp , typename _Sequence , typename _Compare >
class priority_queue<_Tp, _Sequence, _Compare,
typename std::enable_if< !std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::priority_queue<_Tp, _Sequence, _Compare> , public STLInterface {
public:
// default constructor
explicit priority_queue(const _Compare& __x = _Compare(), const _Sequence& __s = _Sequence())
: std::priority_queue<_Tp, _Sequence, _Compare>(__x, __s) { }
// iterator constructor
template<typename _InputIterator>
priority_queue(_InputIterator __first, _InputIterator __last,
const _Compare& __x = _Compare(),
const _Sequence& __s = _Sequence())
: std::priority_queue<_Tp, _Sequence, _Compare>(__first, __last, __x, __s) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( std::priority_queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( std::priority_queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
// Specialized priority_queue for strings
template <typename _Tp , typename _Sequence , typename _Compare >
class priority_queue<_Tp, _Sequence, _Compare, typename std::enable_if<std::is_same<_Tp,std::string>::value>::type >
: public std::priority_queue<_Tp, _Sequence, _Compare> , public STLInterface {
public:
// default constructor
explicit priority_queue(const _Compare& __x = _Compare(), const _Sequence& __s = _Sequence())
: std::priority_queue<_Tp, _Sequence, _Compare>(__x, __s) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( std::priority_queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( std::priority_queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
// Specialized priority_queue for other Trick STL types.
template <typename _Tp , typename _Sequence , typename _Compare >
class priority_queue<_Tp, _Sequence, _Compare, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Tp>::value>::type >
: public std::priority_queue<_Tp, _Sequence, _Compare> , public STLInterface {
public:
// default constructor
explicit priority_queue(const _Compare& __x = _Compare(), const _Sequence& __s = _Sequence())
: std::priority_queue<_Tp, _Sequence, _Compare>(__x, __s) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( std::priority_queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( std::priority_queue<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -1,256 +0,0 @@
#ifndef TRICK_SET_HH
#define TRICK_SET_HH
#include <string>
#include <set>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_sequence_stl.hh"
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Key, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<_Key>, class dummy = void >
class set {} ;
// Template use for everything except strings and other STL types.
template <typename _Key , typename _Compare , typename _Alloc >
class set<_Key, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value
>::type > : public std::set<_Key,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
set() {} ;
// iterator range constructor
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last) : std::set<_Key,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::set<_Key,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
set(const set & __x) : std::set<_Key,_Compare,_Alloc>(__x) {}
// assignment operator
set& operator=(const set & __x) {
std::set<_Key,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
} ;
// Specialized set for other Trick STL types.
template <typename _Key , typename _Compare , typename _Alloc >
class set<_Key, _Compare, _Alloc, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Key>::value>::type >
: public std::set<_Key,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
set() {} ;
// iterator range constructor
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last) : std::set<_Key,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::set<_Key,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
set(const set & __x) : std::set<_Key,_Compare,_Alloc>(__x) {}
// assignment operator
set& operator=(const set & __x) {
std::set<_Key,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
} ;
// Specialized set for strings
template <typename _Key , typename _Compare , typename _Alloc >
class set<_Key, _Compare, _Alloc, typename std::enable_if<std::is_same<_Key,std::string>::value>::type >
: public std::set<_Key,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
set() {} ;
// iterator range constructor
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last) : std::set<_Key,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
set(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::set<_Key,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
set(const set & __x) : std::set<_Key,_Compare,_Alloc>(__x) {}
// assignment operator
set& operator=(const set & __x) {
std::set<_Key,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
} ;
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Key, typename _Compare = std::less<_Key>, typename _Alloc = std::allocator<_Key>, class dummy = void >
class multiset {} ;
// Template use for everything except strings and other STL types.
template <typename _Key , typename _Compare , typename _Alloc >
class multiset<_Key, _Compare, _Alloc,
typename std::enable_if< !std::is_same<_Key,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Key>::value
>::type > : public std::multiset<_Key,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multiset() {} ;
// iterator range constructor
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last) : std::multiset<_Key,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multiset<_Key,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multiset(const multiset & __x) : std::multiset<_Key,_Compare,_Alloc>(__x) {}
// assignment operator
multiset& operator=(const multiset & __x) {
std::multiset<_Key,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multiset for other Trick STL types.
template <typename _Key , typename _Compare , typename _Alloc >
class multiset<_Key, _Compare, _Alloc, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Key>::value>::type >
: public std::multiset<_Key,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multiset() {} ;
// iterator range constructor
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last) : std::multiset<_Key,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multiset<_Key,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multiset(const multiset & __x) : std::multiset<_Key,_Compare,_Alloc>(__x) {}
// assignment operator
multiset& operator=(const multiset & __x) {
std::multiset<_Key,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
} ;
// Specialized multiset for strings
template <typename _Key , typename _Compare , typename _Alloc >
class multiset<_Key, _Compare, _Alloc, typename std::enable_if<std::is_same<_Key,std::string>::value>::type >
: public std::multiset<_Key,_Compare,_Alloc> , public STLInterface {
public:
// default constructor
multiset() {} ;
// iterator range constructor
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last) : std::multiset<_Key,_Compare,_Alloc>(__first, __last) {}
// iterator range constructor with compare function
template<typename _InputIterator>
multiset(_InputIterator __first, _InputIterator __last,
const _Compare& __comp,
const _Alloc& __a = _Alloc()) : std::multiset<_Key,_Compare,_Alloc>(__first, __last,__comp,__a) {}
// copy constructor
multiset(const multiset & __x) : std::multiset<_Key,_Compare,_Alloc>(__x) {}
// assignment operator
multiset& operator=(const multiset & __x) {
std::multiset<_Key,_Compare,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -1,83 +0,0 @@
#ifndef TRICK_STACK_HH
#define TRICK_STACK_HH
#include <string>
#include <stack>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_sequence_stl.hh"
/*
This algorithm depends on the stack container type is called "c" and is
a protected variable. There are no guarantees this works with anything but
the current gcc versions we are using.
*/
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Tp, typename _Sequence = std::deque<_Tp>, class dummy = void >
class stack {} ;
// Template use for everything except strings and other STL types.
template <typename _Tp , typename _Sequence >
class stack<_Tp, _Sequence, typename std::enable_if< !std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::stack<_Tp, _Sequence> , public STLInterface {
public:
// default constructor
explicit stack(const _Sequence& __c = _Sequence()) : std::stack<_Tp, _Sequence>(__c) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( std::stack<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( std::stack<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
// Specialized stack for strings
template <typename _Tp , typename _Sequence >
class stack<_Tp, _Sequence, typename std::enable_if<std::is_same<_Tp,std::string>::value>::type >
: public std::stack<_Tp, _Sequence> , public STLInterface {
public:
// default constructor
explicit stack(const _Sequence& __c = _Sequence()) : std::stack<_Tp, _Sequence>(__c) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( std::stack<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( std::stack<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
// Specialized stack for other Trick STL types.
template <typename _Tp, typename _Sequence >
class stack<_Tp, _Sequence, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Tp>::value>::type >
: public std::stack<_Tp, _Sequence> , public STLInterface {
public:
// default constructor
explicit stack(const _Sequence& __c = _Sequence()) : std::stack<_Tp, _Sequence>(__c) { }
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( std::stack<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( std::stack<_Tp, _Sequence>::c , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -1,133 +0,0 @@
#ifndef TRICK_VECTOR_HH
#define TRICK_VECTOR_HH
#include <string>
#include <vector>
#ifndef SWIG
#include <type_traits>
#endif
#include "trick/checkpoint_trick_sequence_stl.hh"
namespace Trick {
// Empty template. This version is not used, it allows us to specialize below.
template <typename _Tp, typename _Alloc = std::allocator<_Tp> , class dummy = void >
class vector {} ;
// Template use for everything except strings and other STL types.
template <typename _Tp , typename _Alloc >
class vector<_Tp, _Alloc,
typename std::enable_if< !std::is_same<_Tp,std::string>::value &&
!std::is_base_of<Trick::STLInterface,_Tp>::value
>::type > : public std::vector<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
vector() {} ;
// fill constructor
explicit vector(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::vector<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::vector<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
vector(const vector & __x) : std::vector<_Tp,_Alloc>(__x) {}
// assignment operator
vector& operator=(const vector & __x) {
std::vector<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl( *this , obj_name , stl_id ) ;
}
} ;
// Specialized vector for other Trick STL types.
template <typename _Tp , typename _Alloc >
class vector<_Tp, _Alloc, typename std::enable_if<std::is_base_of<Trick::STLInterface,_Tp>::value>::type >
: public std::vector<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
vector() {} ;
// fill constructor
explicit vector(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::vector<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::vector<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
vector(const vector & __x) : std::vector<_Tp,_Alloc>(__x) {}
// assignment operator
vector& operator=(const vector & __x) {
std::vector<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_STLInterface( *this , obj_name , stl_id ) ;
}
} ;
// Specialized vector for strings
template <typename _Tp , typename _Alloc >
class vector<_Tp, _Alloc, typename std::enable_if<std::is_same<_Tp,std::string>::value>::type >
: public std::vector<_Tp,_Alloc> , public STLInterface {
public:
// default constructor
vector() {} ;
// fill constructor
explicit vector(size_t __n, const _Tp & __value = _Tp(),
const _Alloc & __a = _Alloc()) : std::vector<_Tp,_Alloc>(__n, __value, __a) {}
// iterator range constructor
template<typename _InputIterator>
vector(_InputIterator __first, _InputIterator __last,
const _Alloc& __a = _Alloc()) : std::vector<_Tp,_Alloc>(__first, __last, __a) {}
// copy constructor
vector(const vector & __x) : std::vector<_Tp,_Alloc>(__x) {}
// assignment operator
vector& operator=(const vector & __x) {
std::vector<_Tp,_Alloc>::operator = (__x) ;
return *this ;
}
// inherited STLInterface::checkpoint
virtual void checkpoint( std::string obj_name ) {
checkpoint_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
// inherited STLInterface::restart
virtual void restart( std::string obj_name ) {
restore_trick_sequence_stl_string( *this , obj_name , stl_id ) ;
}
} ;
} ;
#endif

View File

@ -224,11 +224,6 @@ class CheckPointRestartSimObject : public Trick::SimObject {
{TRK} P0 ("freeze") cpr.load_checkpoint_job() ;
{TRK} P0 ("end_of_frame") cpr.load_checkpoint_job() ;
{TRK} P0 ("checkpoint") cpr.pre_checkpoint() ;
{TRK} P0 ("post_checkpoint") cpr.post_checkpoint() ;
{TRK} P0 ("restart") cpr.restart() ;
}
}
CheckPointRestartSimObject trick_cpr ;

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)

View File

@ -1,24 +0,0 @@
def main():
#trick.echo_jobs_on()
simControlPanel = trick.SimControlPanel()
simControlPanel.thisown = 0
trick.add_external_application(simControlPanel)
trick.real_time_enable()
#trick.itimer_enable()
trick.checkpoint_post_init(True)
trick.checkpoint_end(True)
trick.freeze(2.0)
the_object.stlc2.name = "Daisy"
trick.exec_set_freeze_frame(0.10)
trick.stop(5.0)
if __name__ == "__main__":
main()

View File

@ -1,15 +0,0 @@
def main():
trick.checkpoint_post_init(True)
trick.checkpoint_end(True)
the_object.stlc2.name = "Daisy"
# Data recording HDF5 test
trick.exec_set_freeze_frame(0.10)
trick.stop(5.0)
if __name__ == "__main__":
main()

View File

@ -1,37 +0,0 @@
#include "sim_objects/default_trick_sys.sm"
##include "stl_checkpoint/STLCheckpoint.hh"
/* This object tests having 2 of the same type of object containing STLs in the same sim_object.
The checkpoints use the name of the objects to give the STLs unique and identifiable names
in the checkpoint. This is done by invoking CHECKPOINT_STL for each variable (see stl_checkpoints.sm) */
class theSimObject : public Trick::SimObject {
public:
STLCheckpoint stlc ;
STLCheckpoint stlc2 ;
/** Constructor to add the jobs */
theSimObject() : stlc(std::string("Petunia")) , stlc2() {
(1.0, "scheduled") stlc.speak() ;
#include "stl_checkpoints.sm"
}
} ;
// Multiple simobjects
theSimObject the_object ;
theSimObject the_object2 ;
// Connect objects
void create_connections() {
// Set the default termination time
trick_sys.sched.set_terminate_time(10.0) ;
trick_sys.sched.set_freeze_frame(0.10) ;
}

View File

@ -1,4 +0,0 @@
TRICK_CFLAGS += -I./models
TRICK_CXXFLAGS += -I./models

View File

@ -1,281 +0,0 @@
#include "sim_services/Message/include/message_proto.h"
#include "STLCheckpoint.hh"
/* These 2 constructors add different data to an STLCheckpoint. */
STLCheckpoint::STLCheckpoint() {
my_double_map[11.1] = 111.1 ;
my_double_map[22.2] = 222.2 ;
my_double_map[33.3] = 333.3 ;
my_string_key_map[std::string("one")] = 1 ;
my_string_key_map[std::string("two")] = 2 ;
my_string_key_map[std::string("three")] = 3 ;
my_string_data_map[4] = std::string("vier") ;
my_string_data_map[5] = std::string("fumf") ;
my_string_data_map[6] = std::string("sechs") ;
my_string_map[std::string("mother")] = std::string("Marge") ;
my_string_map[std::string("father")] = std::string("Homer") ;
my_string_map[std::string("son")] = std::string("Bart") ;
my_int_multimap.insert(std::pair<int, int>(11,111)) ;
my_int_multimap.insert(std::pair<int, int>(22,222)) ;
my_int_multimap.insert(std::pair<int, int>(33,333)) ;
my_int_multimap.insert(std::pair<int, int>(11,111)) ;
my_int_multimap.insert(std::pair<int, int>(22,222)) ;
my_int_multimap.insert(std::pair<int, int>(33,333)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("one", 1)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("two", 2)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("three", 3)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("one", 1)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("two", 2)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("three", 3)) ;
my_string_data_multimap.insert(std::pair<int, std::string>(4, "vier")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(5, "fumf")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(6, "sechs")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(4, "four")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(5, "five")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(6, "six")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("mother","Marge")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("father","Homer")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("mother","Lois")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("father","Meg")) ;
my_double_vector.push_back(1.0) ;
my_double_vector.push_back(2.0) ;
my_double_vector.push_back(3.0) ;
my_string_vector.push_back("I") ;
my_string_vector.push_back("was") ;
my_string_vector.push_back("here") ;
my_short_list.push_back(300) ;
my_short_list.push_back(301) ;
my_short_list.push_back(302) ;
my_string_list.push_back("I") ;
my_string_list.push_back("was") ;
my_string_list.push_back("there") ;
my_float_deque.push_back(12.3) ;
my_float_deque.push_back(45.6) ;
my_float_deque.push_back(78.9) ;
my_string_deque.push_back("meow") ;
my_string_deque.push_back("bark") ;
my_string_deque.push_back("quack") ;
my_int_set.insert(8) ;
my_int_set.insert(4) ;
my_int_set.insert(2) ;
my_int_set.insert(1) ;
my_string_set.insert("e") ;
my_string_set.insert("a") ;
my_string_set.insert("d") ;
my_long_multiset.insert(8) ;
my_long_multiset.insert(4) ;
my_long_multiset.insert(4) ;
my_long_multiset.insert(2) ;
my_long_multiset.insert(1) ;
my_string_multiset.insert("e") ;
my_string_multiset.insert("a") ;
my_string_multiset.insert("d") ;
my_string_multiset.insert("e") ;
my_string_multiset.insert("a") ;
my_string_multiset.insert("d") ;
my_uint_stack.push(10) ;
my_uint_stack.push(20) ;
my_uint_stack.push(30) ;
my_uint_stack.push(40) ;
my_string_stack.push("abc I") ;
my_string_stack.push("abc want the one") ;
my_string_stack.push("abc with the bigger") ;
my_string_stack.push("abc Gee Bees") ;
my_int_queue.push(10) ;
my_int_queue.push(20) ;
my_int_queue.push(30) ;
my_int_queue.push(40) ;
my_string_queue.push("abc I") ;
my_string_queue.push("abc want") ;
my_string_queue.push("abc an") ;
my_string_queue.push("abc iPhone 4") ;
my_int_priority_queue.push(30) ;
my_int_priority_queue.push(20) ;
my_int_priority_queue.push(40) ;
my_int_priority_queue.push(10) ;
my_string_priority_queue.push("abc I") ;
my_string_priority_queue.push("abc want") ;
my_string_priority_queue.push("abc an") ;
my_string_priority_queue.push("abc iPhone 4") ;
my_int_pair.first = 1 ;
my_int_pair.second = 2 ;
my_string_first_pair.first = "abc string first" ;
my_string_first_pair.second = 2 ;
my_string_second_pair.first = 2 ;
my_string_second_pair.second = "abc string second" ;
my_string_pair.first = "abc pair first string" ;
my_string_pair.second = "abc pair second string" ;
return ;
}
STLCheckpoint::STLCheckpoint(std::string in_name) {
name = in_name ;
my_double_map[44.4] = 444.4 ;
my_double_map[55.5] = 555.5 ;
my_double_map[66.6] = 666.6 ;
my_string_key_map[std::string("four")] = 4 ;
my_string_key_map[std::string("five")] = 5 ;
my_string_key_map[std::string("six")] = 6 ;
my_string_data_map[7] = std::string("seiben") ;
my_string_data_map[8] = std::string("acht") ;
my_string_data_map[9] = std::string("neun") ;
my_string_map[std::string("sister")] = std::string("Lisa") ;
my_string_map[std::string("dog")] = std::string("Santa's Little Helper") ;
my_int_multimap.insert(std::pair<int, int>(44,444)) ;
my_int_multimap.insert(std::pair<int, int>(55,555)) ;
my_int_multimap.insert(std::pair<int, int>(66,666)) ;
my_int_multimap.insert(std::pair<int, int>(44,444)) ;
my_int_multimap.insert(std::pair<int, int>(55,555)) ;
my_int_multimap.insert(std::pair<int, int>(66,666)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("four", 4)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("five", 5)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("six", 6)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("four", 44)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("five", 55)) ;
my_string_key_multimap.insert(std::pair<std::string, int>("six", 66)) ;
my_string_data_multimap.insert(std::pair<int, std::string>(7, "seiben")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(8, "acht")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(9, "neun")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(7, "seven")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(8, "eight")) ;
my_string_data_multimap.insert(std::pair<int, std::string>(9, "nine")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("sister","Lisa")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("dog","Santa's Little Helper")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("sister","Meg")) ;
my_string_multimap.insert(std::pair<std::string, std::string>("dog","Brian")) ;
my_double_vector.push_back(4.0) ;
my_double_vector.push_back(5.0) ;
my_double_vector.push_back(6.0) ;
my_string_vector.push_back("It") ;
my_string_vector.push_back("has") ;
my_string_vector.push_back("the") ;
my_string_vector.push_back("Wi-Fies") ;
my_short_list.push_back(400) ;
my_short_list.push_back(401) ;
my_short_list.push_back(402) ;
my_string_list.push_back("I") ;
my_string_list.push_back("don't") ;
my_string_list.push_back("care") ;
my_float_deque.push_back(98.7) ;
my_float_deque.push_back(65.4) ;
my_float_deque.push_back(32.1) ;
my_string_deque.push_back("Welcome") ;
my_string_deque.push_back("to") ;
my_string_deque.push_back("PhoneMart") ;
my_int_set.insert(8000) ;
my_int_set.insert(4000) ;
my_int_set.insert(2000) ;
my_int_set.insert(1000) ;
my_string_set.insert("efg") ;
my_string_set.insert("abc") ;
my_string_set.insert("def") ;
my_long_multiset.insert(8000) ;
my_long_multiset.insert(4000) ;
my_long_multiset.insert(4000) ;
my_long_multiset.insert(2000) ;
my_long_multiset.insert(1000) ;
my_string_multiset.insert("efg") ;
my_string_multiset.insert("abc") ;
my_string_multiset.insert("def") ;
my_string_multiset.insert("efg") ;
my_string_multiset.insert("abc") ;
my_string_multiset.insert("def") ;
my_uint_stack.push(1) ;
my_uint_stack.push(2) ;
my_uint_stack.push(3) ;
my_uint_stack.push(4) ;
my_string_stack.push("I") ;
my_string_stack.push("want the one") ;
my_string_stack.push("with the bigger") ;
my_string_stack.push("Gee Bees") ;
my_int_queue.push(1) ;
my_int_queue.push(2) ;
my_int_queue.push(3) ;
my_int_queue.push(4) ;
my_string_queue.push("I") ;
my_string_queue.push("want") ;
my_string_queue.push("an") ;
my_string_queue.push("iPhone 4") ;
my_int_priority_queue.push(3) ;
my_int_priority_queue.push(2) ;
my_int_priority_queue.push(4) ;
my_int_priority_queue.push(1) ;
my_string_priority_queue.push("I") ;
my_string_priority_queue.push("want") ;
my_string_priority_queue.push("an") ;
my_string_priority_queue.push("iPhone 4") ;
my_int_pair.first = 10 ;
my_int_pair.second = 20 ;
my_string_first_pair.first = "string first" ;
my_string_first_pair.second = 25 ;
my_string_second_pair.first = 25 ;
my_string_second_pair.second = "string second" ;
my_string_pair.first = "pair first string" ;
my_string_pair.second = "pair second string" ;
return ;
}
int STLCheckpoint::speak() {
message_publish(1,"Quack!\n") ;
return 0 ;
}

View File

@ -1,93 +0,0 @@
/*
PURPOSE: (Illustrate how to checkpoint STLs)
LIBRARY_DEPENDENCIES: (
(STLCheckpoint.o)
)
*/
#ifndef STLCHECKPOINT_HH
#define STLCHECKPOINT_HH
#include <map>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <string>
#include <stack>
#include <queue>
#include <utility>
/* This shows the most difficult case in checkpointing STLs where all
STLs are private. There are no accessor routines to get individual
items out of the STLs. (In fact getting to all items in some of the
STLs forces changes in the contents, such as stacks and queues.) Anyways
in this case we need to specify a friend that carries out the checkpoint.
There are 2 methods one can use to call the Trick stl checkpoint routines:
1) Provide a companion class that calls the Trick routines for each STL
(STLCompanion in this example).
-- OR --
2) Invoke Trick's CHECKPOINT_STL macro in the sim object class for each STL
(theSimObject in this example).
Whichever method is chosen, make that class a friend of the class with STLs
(STLCheckpoint in this example).
Public STLs can be checkpointed in the same way (but no need to specify friend).
*/
class STLCheckpoint {
friend class STLCompanion ; // method 1
friend class theSimObject ; // method 2
public:
STLCheckpoint() ;
STLCheckpoint(std::string in_name) ;
int speak() ;
std::string name ;
private:
std::map< double , double > my_double_map ;
std::map< std::string , int > my_string_key_map ;
std::map< int , std::string > my_string_data_map ;
std::map< std::string , std::string > my_string_map ;
std::multimap< int , int > my_int_multimap ;
std::multimap< std::string , int > my_string_key_multimap ;
std::multimap< int , std::string > my_string_data_multimap ;
std::multimap< std::string , std::string > my_string_multimap ;
std::vector< double > my_double_vector ;
std::vector< std::string > my_string_vector ;
std::list< short > my_short_list ;
std::list< std::string > my_string_list ;
std::deque< float > my_float_deque ;
std::deque< std::string > my_string_deque ;
std::set< int > my_int_set ;
std::set< std::string > my_string_set ;
std::multiset< long > my_long_multiset ;
std::multiset< std::string > my_string_multiset ;
std::stack< unsigned int > my_uint_stack ;
std::stack< std::string > my_string_stack ;
std::queue< int > my_int_queue ;
std::queue< std::string > my_string_queue ;
std::priority_queue< int > my_int_priority_queue ;
std::priority_queue< std::string > my_string_priority_queue ;
std::pair< int , int > my_int_pair ;
std::pair< std::string , int > my_string_first_pair ;
std::pair< int , std::string > my_string_second_pair ;
std::pair< std::string , std::string > my_string_pair ;
} ;
#endif

View File

@ -1,57 +0,0 @@
CHECKPOINT_STL(stlc.my_double_map) ;
CHECKPOINT_STL(stlc.my_string_key_map) ;
CHECKPOINT_STL(stlc.my_string_data_map) ;
CHECKPOINT_STL(stlc.my_string_map) ;
CHECKPOINT_STL(stlc.my_int_multimap) ;
CHECKPOINT_STL(stlc.my_string_key_multimap) ;
CHECKPOINT_STL(stlc.my_string_data_multimap) ;
CHECKPOINT_STL(stlc.my_string_multimap) ;
CHECKPOINT_STL(stlc.my_double_vector) ;
CHECKPOINT_STL(stlc.my_string_vector) ;
CHECKPOINT_STL(stlc.my_short_list) ;
CHECKPOINT_STL(stlc.my_string_list) ;
CHECKPOINT_STL(stlc.my_float_deque) ;
CHECKPOINT_STL(stlc.my_string_deque) ;
CHECKPOINT_STL(stlc.my_int_set) ;
CHECKPOINT_STL(stlc.my_string_set) ;
CHECKPOINT_STL(stlc.my_long_multiset) ;
CHECKPOINT_STL(stlc.my_string_multiset) ;
CHECKPOINT_STL(stlc.my_uint_stack) ;
CHECKPOINT_STL(stlc.my_string_stack) ;
CHECKPOINT_STL(stlc.my_int_queue) ;
CHECKPOINT_STL(stlc.my_string_queue) ;
CHECKPOINT_STL(stlc.my_int_priority_queue) ;
CHECKPOINT_STL(stlc.my_string_priority_queue) ;
CHECKPOINT_STL(stlc.my_int_pair) ;
CHECKPOINT_STL(stlc.my_string_first_pair) ;
CHECKPOINT_STL(stlc.my_string_second_pair) ;
CHECKPOINT_STL(stlc.my_string_pair) ;
CHECKPOINT_STL(stlc2.my_double_map) ;
CHECKPOINT_STL(stlc2.my_string_key_map) ;
CHECKPOINT_STL(stlc2.my_string_data_map) ;
CHECKPOINT_STL(stlc2.my_string_map) ;
CHECKPOINT_STL(stlc2.my_int_multimap) ;
CHECKPOINT_STL(stlc2.my_string_key_multimap) ;
CHECKPOINT_STL(stlc2.my_string_data_multimap) ;
CHECKPOINT_STL(stlc2.my_string_multimap) ;
CHECKPOINT_STL(stlc2.my_double_vector) ;
CHECKPOINT_STL(stlc2.my_string_vector) ;
CHECKPOINT_STL(stlc2.my_short_list) ;
CHECKPOINT_STL(stlc2.my_string_list) ;
CHECKPOINT_STL(stlc2.my_float_deque) ;
CHECKPOINT_STL(stlc2.my_string_deque) ;
CHECKPOINT_STL(stlc2.my_int_set) ;
CHECKPOINT_STL(stlc2.my_string_set) ;
CHECKPOINT_STL(stlc2.my_long_multiset) ;
CHECKPOINT_STL(stlc2.my_string_multiset) ;
CHECKPOINT_STL(stlc2.my_uint_stack) ;
CHECKPOINT_STL(stlc2.my_string_stack) ;
CHECKPOINT_STL(stlc2.my_int_queue) ;
CHECKPOINT_STL(stlc2.my_string_queue) ;
CHECKPOINT_STL(stlc2.my_int_priority_queue) ;
CHECKPOINT_STL(stlc2.my_string_priority_queue) ;
CHECKPOINT_STL(stlc2.my_int_pair) ;
CHECKPOINT_STL(stlc2.my_string_first_pair) ;
CHECKPOINT_STL(stlc2.my_string_second_pair) ;
CHECKPOINT_STL(stlc2.my_string_pair) ;

View File

@ -1,8 +0,0 @@
def main():
trick.checkpoint_pre_init(True)
trick.stop(1.0)
if __name__ == "__main__":
main()

View File

@ -1,9 +0,0 @@
def main():
trick.real_time_enable()
trick.exec_set_software_frame(0.1)
trick.sim_control_panel_set_enabled(True)
if __name__ == "__main__":
main()

View File

@ -1,23 +0,0 @@
/*
This sim demonstrates the use of Trick STLs. Trick includes
checkpointable versions of all the STL constructs.
*/
#include "sim_objects/default_trick_sys.sm"
##include "TrickSTL/include/TrickSTLCheckpoint.hh"
class theSimObject : public Trick::SimObject {
public:
TrickSTLCheckpoint tstlc ;
theSimObject() {
(1.0, "scheduled") tstlc.speak() ;
(1.0, "freeze_scheduled") tstlc.speak() ;
}
} ;
theSimObject the_object ;

View File

@ -1,4 +0,0 @@
TRICK_CFLAGS += -I./models
TRICK_CXXFLAGS += -I./models -std=c++11

View File

@ -1,167 +0,0 @@
/*
PURPOSE: (Illustrate how to checkpoint STLs)
LIBRARY_DEPENDENCIES: (
(TrickSTLCheckpoint.o)
)
*/
#ifndef TRICKSTLCHECKPOINT_HH_
#define TRICKSTLCHECKPOINT_HH_
#include <string>
#include "sim_services/STL/include/trick_vector.hh"
#include "sim_services/STL/include/trick_list.hh"
#include "sim_services/STL/include/trick_deque.hh"
#include "sim_services/STL/include/trick_set.hh"
#include "sim_services/STL/include/trick_map.hh"
#include "sim_services/STL/include/trick_stack.hh"
#include "sim_services/STL/include/trick_queue.hh"
#include "sim_services/STL/include/trick_pair.hh"
class ClassOfInts {
public:
int i1 ;
int i2 ;
int i3 ;
bool operator < ( const ClassOfInts & c ) const {
return i1 > c.i1 ;
}
} ;
class TrickSTLCheckpoint {
public:
TrickSTLCheckpoint() ;
int speak() ;
std::string name ;
/* VECTOR */
Trick::vector< double > vector_double ;
Trick::vector< double , std::allocator<double> > vector_double_alloc ;
Trick::vector< std::string > vector_string ;
Trick::vector< double > vector_range ;
Trick::vector< double > vector_fill ;
Trick::vector< double > vector_copy ;
Trick::vector< ClassOfInts > vector_class ;
Trick::vector< ClassOfInts * > vector_class_ptr ;
Trick::vector< Trick::vector< double > > vector_vector_double ;
/* LIST */
Trick::list< double > list_double ;
Trick::list< double , std::allocator<double> > list_double_alloc ;
Trick::list< std::string > list_string ;
Trick::list< double > list_range ;
Trick::list< double > list_fill ;
Trick::list< double > list_copy ;
Trick::list< ClassOfInts > list_class ;
Trick::list< ClassOfInts * > list_class_ptr ;
Trick::list< Trick::list< double > > list_list_double ;
/* DEQUE */
Trick::deque< double > deque_double ;
Trick::deque< double , std::allocator<double> > deque_double_alloc ;
Trick::deque< std::string > deque_string ;
Trick::deque< double > deque_range ;
Trick::deque< double > deque_fill ;
Trick::deque< double > deque_copy ;
Trick::deque< ClassOfInts > deque_class ;
Trick::deque< ClassOfInts * > deque_class_ptr ;
Trick::deque< Trick::deque< double > > deque_deque_double ;
/* SET */
Trick::set< double > set_double ;
Trick::set< double , std::less< double > > set_double_compare ;
Trick::set< double , std::less< double > , std::allocator<double> > set_double_compare_alloc ;
Trick::set< std::string > set_string ;
Trick::set< double > set_range ;
Trick::set< double > set_fill ;
Trick::set< double > set_copy ;
Trick::set< ClassOfInts > set_class ;
Trick::set< ClassOfInts * > set_class_ptr ;
Trick::set< Trick::set< double > > set_set_double ;
/* MULTISET */
Trick::multiset< double > multiset_double ;
Trick::multiset< double , std::less< double > > multiset_double_compare ;
Trick::multiset< double , std::less< double > , std::allocator<double> > multiset_double_compare_alloc ;
Trick::multiset< std::string > multiset_string ;
Trick::multiset< double > multiset_range ;
Trick::multiset< double > multiset_fill ;
Trick::multiset< double > multiset_copy ;
Trick::multiset< ClassOfInts > multiset_class ;
Trick::multiset< ClassOfInts * > multiset_class_ptr ;
Trick::multiset< Trick::multiset< double > > multiset_multiset_double ;
/* MAP */
Trick::map< double , double > map_double_double ;
Trick::map< int , std::string > map_int_string ;
Trick::map< int , Trick::vector< double > > map_int_vector_double ;
Trick::map< std::string , int > map_string_int ;
Trick::map< std::string , std::string > map_string_string ;
Trick::map< std::string , Trick::vector< double > > map_string_vector_double ;
Trick::map< Trick::list< int > , double > map_list_int_double ;
Trick::map< Trick::list< int > , std::string > map_list_int_string ;
Trick::map< Trick::list< int > , Trick::vector< double > > map_list_int_vector_double ;
/* MULTIMAP */
Trick::multimap< double , double > multimap_double_double ;
Trick::multimap< int , std::string > multimap_int_string ;
Trick::multimap< int , Trick::vector< double > > multimap_int_vector_double ;
Trick::multimap< std::string , int > multimap_string_int ;
Trick::multimap< std::string , std::string > multimap_string_string ;
Trick::multimap< std::string , Trick::vector< double > > multimap_string_vector_double ;
Trick::multimap< Trick::list< int > , double > multimap_list_int_double ;
Trick::multimap< Trick::list< int > , std::string > multimap_list_int_string ;
Trick::multimap< Trick::list< int > , Trick::vector< double > > multimap_list_int_vector_double ;
/* STACK */
Trick::stack< unsigned int > stack_uint ;
Trick::stack< std::string > stack_string ;
Trick::stack< Trick::vector< double > > stack_vector_double ;
/* QUEUE */
Trick::queue< unsigned int > queue_uint ;
Trick::queue< std::string > queue_string ;
Trick::queue< Trick::vector< double > > queue_vector_double ;
/* PRIORITY QUEUE */
Trick::priority_queue< unsigned int > priority_queue_uint ;
Trick::priority_queue< std::string > priority_queue_string ;
Trick::priority_queue< Trick::vector< double > > priority_queue_vector_double ;
/* PAIRS */
Trick::pair< int , int > pair_int_int ;
Trick::pair< int , int > pair_fill_int_int ;
Trick::pair< int , std::string > pair_int_string ;
Trick::pair< int , Trick::list< int > > pair_int_list_int ;
Trick::pair< std::string , int > pair_string_int ;
Trick::pair< std::string , std::string > pair_string_string ;
Trick::pair< std::string , Trick::list< int > > pair_string_list_int ;
Trick::pair< Trick::list< int > , int > pair_list_int_int ;
Trick::pair< Trick::list< int > , std::string > pair_list_int_string ;
Trick::pair< Trick::list< int > , Trick::list< int > > pair_list_int_list_int ;
} ;
#endif

View File

@ -1,504 +0,0 @@
#include "TrickSTLCheckpoint.hh"
#include "sim_services/Message/include/message_proto.h"
#include "sim_services/MemoryManager/include/memorymanager_c_intf.h"
double matrix[3][3] = {{101,102,103},{104,105,106},{107,108,109}} ;
TrickSTLCheckpoint::TrickSTLCheckpoint()
: vector_range(matrix[2], matrix[2] + 3) ,
vector_fill( 5 , 200 ) ,
vector_copy( vector_range ) ,
list_range(matrix[2], matrix[2] + 3) ,
list_fill( 5 , 200 ) ,
list_copy( list_range ) ,
deque_range(matrix[2], matrix[2] + 3) ,
deque_fill( 5 , 200 ) ,
deque_copy( deque_range ) ,
pair_fill_int_int( 92 , 93 )
{
ClassOfInts coi ;
ClassOfInts * coi_ptr ;
/* VECTOR */
vector_double.push_back(1.0) ;
vector_double.push_back(2.0) ;
vector_double.push_back(3.0) ;
vector_double_alloc.push_back(4.0) ;
vector_double_alloc.push_back(5.0) ;
vector_double_alloc.push_back(6.0) ;
vector_string.push_back("I") ;
vector_string.push_back("was") ;
vector_string.push_back("here") ;
coi.i1 = 1 ;
coi.i2 = 2 ;
coi.i3 = 3 ;
vector_class.push_back(coi) ;
coi.i1 = 4 ;
coi.i2 = 5 ;
coi.i3 = 6 ;
vector_class.push_back(coi) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 11 ;
coi_ptr->i2 = 12 ;
coi_ptr->i3 = 13 ;
vector_class_ptr.push_back(coi_ptr) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 14 ;
coi_ptr->i2 = 15 ;
coi_ptr->i3 = 16 ;
vector_class_ptr.push_back(coi_ptr) ;
Trick::vector< double > vector_d3( 3 , 300 ) ;
Trick::vector< double > vector_d4( 4 , 400 ) ;
Trick::vector< double > vector_d5( 5 , 500 ) ;
vector_vector_double.push_back(vector_d3) ;
vector_vector_double.push_back(vector_d4) ;
vector_vector_double.push_back(vector_d5) ;
/* LIST */
list_double.push_back(1.0) ;
list_double.push_back(2.0) ;
list_double.push_back(3.0) ;
list_double_alloc.push_back(4.0) ;
list_double_alloc.push_back(5.0) ;
list_double_alloc.push_back(6.0) ;
list_string.push_back("I") ;
list_string.push_back("was") ;
list_string.push_back("here") ;
coi.i1 = 1 ;
coi.i2 = 2 ;
coi.i3 = 3 ;
list_class.push_back(coi) ;
coi.i1 = 4 ;
coi.i2 = 5 ;
coi.i3 = 6 ;
list_class.push_back(coi) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 11 ;
coi_ptr->i2 = 12 ;
coi_ptr->i3 = 13 ;
list_class_ptr.push_back(coi_ptr) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 14 ;
coi_ptr->i2 = 15 ;
coi_ptr->i3 = 16 ;
list_class_ptr.push_back(coi_ptr) ;
Trick::list< double > list_d3( 3 , 300 ) ;
Trick::list< double > list_d4( 4 , 400 ) ;
Trick::list< double > list_d5( 5 , 500 ) ;
list_list_double.push_back(list_d3) ;
list_list_double.push_back(list_d4) ;
list_list_double.push_back(list_d5) ;
/* DEQUE */
deque_double.push_back(1.0) ;
deque_double.push_back(2.0) ;
deque_double.push_back(3.0) ;
deque_double_alloc.push_back(4.0) ;
deque_double_alloc.push_back(5.0) ;
deque_double_alloc.push_back(6.0) ;
deque_string.push_back("I") ;
deque_string.push_back("was") ;
deque_string.push_back("here") ;
coi.i1 = 1 ;
coi.i2 = 2 ;
coi.i3 = 3 ;
deque_class.push_back(coi) ;
coi.i1 = 4 ;
coi.i2 = 5 ;
coi.i3 = 6 ;
deque_class.push_back(coi) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 11 ;
coi_ptr->i2 = 12 ;
coi_ptr->i3 = 13 ;
deque_class_ptr.push_back(coi_ptr) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 14 ;
coi_ptr->i2 = 15 ;
coi_ptr->i3 = 16 ;
deque_class_ptr.push_back(coi_ptr) ;
Trick::deque< double > deque_d3( 3 , 300 ) ;
Trick::deque< double > deque_d4( 4 , 400 ) ;
Trick::deque< double > deque_d5( 5 , 500 ) ;
deque_deque_double.push_back(deque_d3) ;
deque_deque_double.push_back(deque_d4) ;
deque_deque_double.push_back(deque_d5) ;
/* SET */
set_double.insert(1.0) ;
set_double.insert(2.0) ;
set_double.insert(3.0) ;
set_double_compare_alloc.insert(4.0) ;
set_double_compare_alloc.insert(5.0) ;
set_double_compare_alloc.insert(6.0) ;
set_string.insert("I") ;
set_string.insert("was") ;
set_string.insert("here") ;
coi.i1 = 1 ;
coi.i2 = 2 ;
coi.i3 = 3 ;
set_class.insert(coi) ;
coi.i1 = 4 ;
coi.i2 = 5 ;
coi.i3 = 6 ;
set_class.insert(coi) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 11 ;
coi_ptr->i2 = 12 ;
coi_ptr->i3 = 13 ;
set_class_ptr.insert(coi_ptr) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 14 ;
coi_ptr->i2 = 15 ;
coi_ptr->i3 = 16 ;
set_class_ptr.insert(coi_ptr) ;
Trick::set< double > set_d3( matrix[0], matrix[0] + 3 ) ;
Trick::set< double > set_d4( matrix[1], matrix[1] + 3 ) ;
Trick::set< double > set_d5( matrix[2], matrix[2] + 3 ) ;
set_set_double.insert(set_d3) ;
set_set_double.insert(set_d4) ;
set_set_double.insert(set_d5) ;
/* MULTISET */
multiset_double.insert(1.0) ;
multiset_double.insert(2.0) ;
multiset_double.insert(3.0) ;
multiset_double_compare_alloc.insert(4.0) ;
multiset_double_compare_alloc.insert(5.0) ;
multiset_double_compare_alloc.insert(6.0) ;
multiset_string.insert("I") ;
multiset_string.insert("was") ;
multiset_string.insert("here") ;
coi.i1 = 1 ;
coi.i2 = 2 ;
coi.i3 = 3 ;
multiset_class.insert(coi) ;
coi.i1 = 4 ;
coi.i2 = 5 ;
coi.i3 = 6 ;
multiset_class.insert(coi) ;
// Add an extra copy for multi-set.
multiset_class.insert(coi) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 11 ;
coi_ptr->i2 = 12 ;
coi_ptr->i3 = 13 ;
multiset_class_ptr.insert(coi_ptr) ;
coi_ptr = (ClassOfInts *)TMM_declare_var_1d("ClassOfInts" , 1) ;
coi_ptr->i1 = 14 ;
coi_ptr->i2 = 15 ;
coi_ptr->i3 = 16 ;
multiset_class_ptr.insert(coi_ptr) ;
Trick::multiset< double > multiset_d3( matrix[0], matrix[0] + 3 ) ;
Trick::multiset< double > multiset_d4( matrix[1], matrix[1] + 3 ) ;
Trick::multiset< double > multiset_d5( matrix[2], matrix[2] + 3 ) ;
multiset_multiset_double.insert(multiset_d3) ;
multiset_multiset_double.insert(multiset_d4) ;
multiset_multiset_double.insert(multiset_d5) ;
/* MAP */
map_double_double[11.1] = 111.1 ;
map_double_double[22.2] = 222.2 ;
map_double_double[33.3] = 333.3 ;
map_string_int[std::string("one")] = 1 ;
map_string_int[std::string("two")] = 2 ;
map_string_int[std::string("three")] = 3 ;
map_int_string[4] = std::string("vier") ;
map_int_string[5] = std::string("fumf") ;
map_int_string[6] = std::string("sechs") ;
map_string_string[std::string("mother")] = std::string("Marge") ;
map_string_string[std::string("father")] = std::string("Homer") ;
map_string_string[std::string("son")] = std::string("Bart") ;
map_int_vector_double[80] = vector_d3 ;
map_int_vector_double[81] = vector_d4 ;
map_int_vector_double[82] = vector_d5 ;
map_string_vector_double[std::string("cat")] = vector_d3 ;
map_string_vector_double[std::string("dog")] = vector_d4 ;
map_string_vector_double[std::string("duck")] = vector_d5 ;
Trick::list< int > list_int_i1(3 , 111) ;
Trick::list< int > list_int_i2(3 , 222) ;
map_list_int_double[list_int_i1] = 11.1 ;
map_list_int_double[list_int_i2] = 22.2 ;
// this line should overwrite the previous
map_list_int_double[list_int_i2] = 33.3 ;
map_list_int_string[list_int_i1] = std::string("banana") ;
map_list_int_string[list_int_i2] = std::string("apple") ;
map_list_int_vector_double[list_int_i1] = vector_d3 ;
map_list_int_vector_double[list_int_i2] = vector_d4 ;
/* MULTIMAP */
multimap_double_double.insert(std::pair<double, double >(11.1,111.1)) ;
multimap_double_double.insert(std::pair<double, double >(22.2,222.2)) ;
multimap_double_double.insert(std::pair<double, double >(33.2,333.3)) ;
multimap_string_int.insert(std::pair<std::string, int >(std::string("one"),1)) ;
multimap_string_int.insert(std::pair<std::string, int >(std::string("two"),2)) ;
multimap_string_int.insert(std::pair<std::string, int >(std::string("three"),3)) ;
multimap_int_string.insert(std::pair<int, std::string >(4 , std::string("vier"))) ;
multimap_int_string.insert(std::pair<int, std::string >(5 , std::string("fumf"))) ;
multimap_int_string.insert(std::pair<int, std::string >(6 , std::string("sechs"))) ;
multimap_string_string.insert(std::pair<std::string, std::string >(std::string("mother") , std::string("Marge"))) ;
multimap_string_string.insert(std::pair<std::string, std::string >(std::string("father") , std::string("Homer"))) ;
multimap_string_string.insert(std::pair<std::string, std::string >(std::string("son") , std::string("Bart"))) ;
multimap_int_vector_double.insert(std::pair<int, Trick::vector<double > >(80, vector_d3)) ;
multimap_int_vector_double.insert(std::pair<int, Trick::vector<double > >(81, vector_d4)) ;
multimap_int_vector_double.insert(std::pair<int, Trick::vector<double > >(82, vector_d5)) ;
multimap_string_vector_double.insert(std::pair<std::string, Trick::vector<double > >(std::string("cat"), vector_d3)) ;
multimap_string_vector_double.insert(std::pair<std::string, Trick::vector<double > >(std::string("dog"), vector_d4)) ;
multimap_string_vector_double.insert(std::pair<std::string, Trick::vector<double > >(std::string("duck"), vector_d5)) ;
multimap_list_int_double.insert(std::pair< Trick::list<int >, double >(list_int_i1, 11.1)) ;
multimap_list_int_double.insert(std::pair< Trick::list<int >, double >(list_int_i2, 22.2)) ;
// this line should not overwrite the previous
multimap_list_int_double.insert(std::pair< Trick::list<int >, double >(list_int_i2, 33.3)) ;
multimap_list_int_string.insert(std::pair< Trick::list<int >, std::string >(list_int_i1, std::string("banana"))) ;
multimap_list_int_string.insert(std::pair< Trick::list<int >, std::string >(list_int_i2, std::string("apple"))) ;
multimap_list_int_vector_double.insert(std::pair< Trick::list<int >, Trick::vector<double > >(list_int_i1, vector_d3)) ;
multimap_list_int_vector_double.insert(std::pair< Trick::list<int >, Trick::vector<double > >(list_int_i2, vector_d4)) ;
stack_uint.push(60) ;
stack_uint.push(61) ;
stack_uint.push(62) ;
stack_uint.push(63) ;
stack_string.push("abc I") ;
stack_string.push("abc want the one") ;
stack_string.push("abc with the bigger") ;
stack_string.push("abc Gee Bees") ;
stack_vector_double.push(vector_d3) ;
stack_vector_double.push(vector_d4) ;
stack_vector_double.push(vector_d5) ;
queue_uint.push(70) ;
queue_uint.push(71) ;
queue_uint.push(72) ;
queue_uint.push(73) ;
queue_string.push("efg I") ;
queue_string.push("efg want the one") ;
queue_string.push("efg with the bigger") ;
queue_string.push("efg Gee Bees") ;
queue_vector_double.push(vector_d3) ;
queue_vector_double.push(vector_d4) ;
queue_vector_double.push(vector_d5) ;
priority_queue_uint.push(81) ;
priority_queue_uint.push(80) ;
priority_queue_uint.push(83) ;
priority_queue_uint.push(82) ;
priority_queue_string.push("efg I") ;
priority_queue_string.push("efg want the one") ;
priority_queue_string.push("efg with the bigger") ;
priority_queue_string.push("efg Gee Bees") ;
priority_queue_vector_double.push(vector_d3) ;
priority_queue_vector_double.push(vector_d4) ;
priority_queue_vector_double.push(vector_d5) ;
pair_int_int = Trick::make_pair( 90 , 91 ) ;
pair_int_string = Trick::make_pair( 94 , "earth" ) ;
pair_int_list_int = Trick::make_pair( 95 , list_int_i1 ) ;
pair_string_int = Trick::make_pair( "mars" , 2 ) ;
pair_string_string = Trick::make_pair( "blue" , "moon" ) ;
pair_string_list_int = Trick::make_pair( "tissue" , list_int_i2 ) ;
pair_list_int_int = Trick::make_pair( list_int_i1 , 96 ) ;
pair_list_int_string = Trick::make_pair( list_int_i1 , "bag" ) ;
pair_list_int_list_int = Trick::make_pair( list_int_i1 , list_int_i2 ) ;
}
template< typename T>
void print_sequence(T & container) {
typename T::iterator lit ;
for ( lit = container.begin() ; lit != container.end() ; lit++ ) {
std::cout << (*lit) << " " ;
}
std::cout << std::endl ;
}
template< typename T>
void print_class_of_ints(T & container) {
typename T::iterator lit ;
unsigned int ii ;
for ( ii = 0 , lit = container.begin() ; lit != container.end() ; ii++ , lit++ ) {
std::cout << "ii = " << ii << ": " << (*lit).i1 << " " << (*lit).i2 ;
std::cout << " " << (*lit).i3 << std::endl ;
}
}
template< typename T>
void print_2d_container(T & container) {
typename T::iterator lldit ;
for ( lldit = container.begin() ; lldit != container.end() ; lldit++ ) {
std::cout << "size = " << (*lldit).size() << std::endl ;
typename T::value_type::iterator ldit ;
for ( ldit = (*lldit).begin() ; ldit != (*lldit).end() ; ldit++ ) {
std::cout << (*ldit) << " " ;
}
std::cout << std::endl ;
}
}
template< typename T>
void print_map(T & container) {
typename T::iterator lit ;
unsigned int ii ;
for ( ii = 0 , lit = container.begin() ; lit != container.end() ; ii++ , lit++ ) {
std::cout << "ii = " << ii << ": " << (*lit).first << " " << (*lit).second << std::endl ;
}
}
template< typename T>
void print_map_keys(T & container) {
typename T::iterator lit ;
unsigned int ii ;
for ( ii = 0 , lit = container.begin() ; lit != container.end() ; ii++ , lit++ ) {
std::cout << "ii = " << ii << ": " << (*lit).first << std::endl ;
}
}
template< typename T>
void print_map_data(T & container) {
typename T::iterator lit ;
unsigned int ii ;
for ( ii = 0 , lit = container.begin() ; lit != container.end() ; ii++ , lit++ ) {
std::cout << "ii = " << ii << ": " << (*lit).second << std::endl ;
}
}
int TrickSTLCheckpoint::speak() {
std::cout << "VECTOR" << std::endl ;
print_class_of_ints< Trick::vector< ClassOfInts > >( vector_class ) ;
print_2d_container< Trick::vector< Trick::vector< double > > >( vector_vector_double ) ;
std::cout << std::endl ;
std::cout << "LIST" << std::endl ;
print_class_of_ints< Trick::list< ClassOfInts > >( list_class ) ;
print_2d_container< Trick::list< Trick::list< double > > >( list_list_double ) ;
std::cout << std::endl ;
std::cout << "DEQUE" << std::endl ;
print_class_of_ints< Trick::deque< ClassOfInts > >( deque_class ) ;
print_2d_container< Trick::deque< Trick::deque< double > > >( deque_deque_double ) ;
std::cout << std::endl ;
std::cout << "SET" << std::endl ;
print_class_of_ints< Trick::set< ClassOfInts > >( set_class ) ;
print_2d_container< Trick::set< Trick::set< double > > >( set_set_double ) ;
std::cout << std::endl ;
std::cout << "MULTISET" << std::endl ;
print_class_of_ints< Trick::multiset< ClassOfInts > >( multiset_class ) ;
print_2d_container< Trick::multiset< Trick::multiset< double > > >( multiset_multiset_double ) ;
std::cout << std::endl ;
std::cout << "MAP" << std::endl ;
print_map< Trick::map< double,double > >( map_double_double ) ;
print_map< Trick::map< std::string,int > >( map_string_int ) ;
print_map< Trick::map< int,std::string > >( map_int_string ) ;
print_map< Trick::map< std::string,std::string > >( map_string_string ) ;
print_map_keys< Trick::map< int , Trick::vector< double > > >( map_int_vector_double ) ;
print_map_keys< Trick::map< std::string , Trick::vector< double > > >( map_string_vector_double ) ;
print_map_data< Trick::map< Trick::list< int > , double > >( map_list_int_double ) ;
print_map_data< Trick::map< Trick::list< int > , std::string > >( map_list_int_string ) ;
std::cout << std::endl ;
std::cout << "MULTIMAP" << std::endl ;
print_map< Trick::multimap< double,double > >( multimap_double_double ) ;
print_map< Trick::multimap< std::string,int > >( multimap_string_int ) ;
print_map< Trick::multimap< int,std::string > >( multimap_int_string ) ;
print_map< Trick::multimap< std::string,std::string > >( multimap_string_string ) ;
print_map_keys< Trick::multimap< int , Trick::vector< double > > >( multimap_int_vector_double ) ;
print_map_keys< Trick::multimap< std::string , Trick::vector< double > > >( multimap_string_vector_double ) ;
print_map_data< Trick::multimap< Trick::list< int > , double > >( multimap_list_int_double ) ;
print_map_data< Trick::multimap< Trick::list< int > , std::string > >( multimap_list_int_string ) ;
std::cout << std::endl ;
std::cout << "STACK" << std::endl ;
std::cout << "top " << stack_uint.top() << std::endl ;
std::cout << "top " << stack_string.top() << std::endl ;
print_sequence< Trick::vector< double > >( stack_vector_double.top() ) ;
std::cout << std::endl ;
std::cout << "QUEUE" << std::endl ;
std::cout << "front " << queue_uint.front() << std::endl ;
std::cout << "front " << queue_string.front() << std::endl ;
print_sequence< Trick::vector< double > >( queue_vector_double.front() ) ;
std::cout << std::endl ;
std::cout << "PRIORITY QUEUE" << std::endl ;
std::cout << "top " << priority_queue_uint.top() << std::endl ;
std::cout << "top " << priority_queue_string.top() << std::endl ;
//print_sequence< Trick::vector< double > >( priority_queue_vector_double.top() ) ;
std::cout << std::endl ;
std::cout << "PAIR" << std::endl ;
std::cout << "pair_int_int " << pair_int_int.first << " " << pair_int_int.second << std::endl ;
std::cout << "pair_fill_int_int " << pair_fill_int_int.first << " " << pair_fill_int_int.second << std::endl ;
std::cout << "pair_int_string " << pair_int_string.first << " " << pair_int_string.second << std::endl ;
std::cout << "pair_int_list_int " << pair_int_list_int.first << std::endl ;
print_sequence< Trick::list< int > >(pair_int_list_int.second) ;
std::cout << "pair_string_int " << pair_string_int.first << " " << pair_string_int.second << std::endl ;
std::cout << "pair_string_string " << pair_string_string.first << " " << pair_string_string.second << std::endl ;
std::cout << "pair_string_list_int " << pair_string_list_int.first << std::endl ;
print_sequence< Trick::list< int > >(pair_string_list_int.second) ;
std::cout << "pair_list_int_int " << std::endl ;
print_sequence< Trick::list< int > >(pair_list_int_int.first) ;
std::cout << pair_list_int_int.second << std::endl ;
std::cout << "pair_list_int_string " << std::endl ;
print_sequence< Trick::list< int > >(pair_list_int_string.first) ;
std::cout << pair_list_int_string.second << std::endl ;
std::cout << "pair_list_int_list_int " << std::endl ;
print_sequence< Trick::list< int > >(pair_list_int_list_int.first) ;
print_sequence< Trick::list< int > >(pair_list_int_list_int.second) ;
std::cout << std::endl ;
return 0 ;
}

View File

@ -7,7 +7,6 @@ COMPILE_DIRS = \
SIM_events \
SIM_rti \
SIM_stls \
SIM_stls2 \
SIM_test_dp \
SIM_test_dr \
SIM_test_io \
@ -30,7 +29,6 @@ SIMS_NEEDING_TEST = \
# SIM_test_varserv ( not sure what it is testing )
# SIM_dynamic_sim_object ( not running, class won't instantiate )
# SIM_segments ( not a test, but a demo )
# SIM_stls3 ( not compiling on most platforms )
# This test is temporarily sitting out until fixed.
# SIM_test_varserv

View File

@ -23,7 +23,6 @@
#include "trick/message_proto.h"
#include "trick/message_type.h"
#include "trick/TrickConstant.hh"
#include "trick/checkpoint_stl.hh"
Trick::CheckPointRestart * the_cpr ;
@ -397,24 +396,6 @@ int Trick::CheckPointRestart::safestore_checkpoint() {
return(0) ;
}
// These are jobs called from the S_define file. I called this one pre_checkpoint to avoid name overloading
int Trick::CheckPointRestart::pre_checkpoint() {
checkpoint_stl(checkpoint_times , std::string("trick_mm") , std::string("checkpoint_times")) ;
return 0 ;
}
int Trick::CheckPointRestart::post_checkpoint() {
if ( ! checkpoint_times.empty() ) {
delete_stl(checkpoint_times , std::string("trick_mm") , std::string("checkpoint_times")) ;
}
return 0 ;
}
int Trick::CheckPointRestart::restart() {
restore_stl(checkpoint_times , std::string("trick_mm") , std::string("checkpoint_times")) ;
return 0 ;
}
void Trick::CheckPointRestart::load_checkpoint(std::string file_name) {
load_checkpoint_file_name = file_name ;
}

View File

@ -7,5 +7,3 @@ ifneq ($(DMTCP),)
TRICK_CXXFLAGS += -D_DMTCP -I$(DMTCP)/dmtcpaware
endif
TRICK_CXXFLAGS += -std=c++11

View File

@ -16,46 +16,8 @@ object_${TRICK_HOST_CPU}/CheckPointRestart_c_intf.o: CheckPointRestart_c_intf.cp
${TRICK_HOME}/include/trick/io_alloc.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h
object_${TRICK_HOST_CPU}/checkpoint_queue.o: checkpoint_queue.cpp \
${TRICK_HOME}/include/trick/checkpoint_queue.hh \
${TRICK_HOME}/include/trick/checkpoint_sequence_stl.hh \
${TRICK_HOME}/include/trick/memorymanager_c_intf.h \
${TRICK_HOME}/include/trick/parameter_types.h \
${TRICK_HOME}/include/trick/attributes.h \
${TRICK_HOME}/include/trick/reference.h \
${TRICK_HOME}/include/trick/value.h \
${TRICK_HOME}/include/trick/dllist.h \
${TRICK_HOME}/include/trick/var.h \
${TRICK_HOME}/include/trick/io_alloc.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h
object_${TRICK_HOST_CPU}/checkpoint_map.o: checkpoint_map.cpp \
${TRICK_HOME}/include/trick/checkpoint_map.hh \
${TRICK_HOME}/include/trick/memorymanager_c_intf.h \
${TRICK_HOME}/include/trick/parameter_types.h \
${TRICK_HOME}/include/trick/attributes.h \
${TRICK_HOME}/include/trick/reference.h \
${TRICK_HOME}/include/trick/value.h \
${TRICK_HOME}/include/trick/dllist.h \
${TRICK_HOME}/include/trick/var.h \
${TRICK_HOME}/include/trick/io_alloc.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h
object_${TRICK_HOST_CPU}/next_attr_name.o: next_attr_name.cpp \
${TRICK_HOME}/include/trick/CheckPointRestart_c_intf.hh
object_${TRICK_HOST_CPU}/checkpoint_stack.o: checkpoint_stack.cpp \
${TRICK_HOME}/include/trick/checkpoint_stack.hh \
${TRICK_HOME}/include/trick/checkpoint_sequence_stl.hh \
${TRICK_HOME}/include/trick/memorymanager_c_intf.h \
${TRICK_HOME}/include/trick/parameter_types.h \
${TRICK_HOME}/include/trick/attributes.h \
${TRICK_HOME}/include/trick/reference.h \
${TRICK_HOME}/include/trick/value.h \
${TRICK_HOME}/include/trick/dllist.h \
${TRICK_HOME}/include/trick/var.h \
${TRICK_HOME}/include/trick/io_alloc.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h
object_${TRICK_HOST_CPU}/CheckPointRestart.o: CheckPointRestart.cpp \
${TRICK_HOME}/include/trick/DMTCP.hh \
${TRICK_HOME}/include/trick/dmtcp_checkpoint_c_intf.hh \
@ -77,47 +39,22 @@ object_${TRICK_HOST_CPU}/CheckPointRestart.o: CheckPointRestart.cpp \
${TRICK_HOME}/include/trick/CheckPointAgent.hh \
${TRICK_HOME}/include/trick/UCFn.hh \
${TRICK_HOME}/include/trick/Executive.hh \
${TRICK_HOME}/include/trick/Scheduler.hh \
${TRICK_HOME}/include/trick/ScheduledJobQueue.hh \
${TRICK_HOME}/include/trick/SimObject.hh \
${TRICK_HOME}/include/trick/Threads.hh \
${TRICK_HOME}/include/trick/ThreadBase.hh \
${TRICK_HOME}/include/trick/ThreadTrigger.hh \
${TRICK_HOME}/include/trick/sim_mode.h \
${TRICK_HOME}/include/trick/exec_proto.hh \
${TRICK_HOME}/include/trick/exec_proto.h \
${TRICK_HOME}/include/trick/sim_mode.h \
${TRICK_HOME}/include/trick/command_line_protos.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h \
${TRICK_HOME}/include/trick/TrickConstant.hh \
${TRICK_HOME}/include/trick/checkpoint_stl.hh \
${TRICK_HOME}/include/trick/checkpoint_sequence_stl.hh \
${TRICK_HOME}/include/trick/checkpoint_is_stl_container.hh \
${TRICK_HOME}/include/trick/checkpoint_fwd_declare.hh \
${TRICK_HOME}/include/trick/memorymanager_c_intf.h \
${TRICK_HOME}/include/trick/checkpoint_map.hh \
${TRICK_HOME}/include/trick/checkpoint_stack.hh \
${TRICK_HOME}/include/trick/checkpoint_queue.hh \
${TRICK_HOME}/include/trick/checkpoint_pair.hh
object_${TRICK_HOST_CPU}/checkpoint_pair.o: checkpoint_pair.cpp \
${TRICK_HOME}/include/trick/checkpoint_pair.hh \
${TRICK_HOME}/include/trick/memorymanager_c_intf.h \
${TRICK_HOME}/include/trick/parameter_types.h \
${TRICK_HOME}/include/trick/attributes.h \
${TRICK_HOME}/include/trick/reference.h \
${TRICK_HOME}/include/trick/value.h \
${TRICK_HOME}/include/trick/dllist.h \
${TRICK_HOME}/include/trick/var.h \
${TRICK_HOME}/include/trick/io_alloc.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h
object_${TRICK_HOST_CPU}/checkpoint_sequence_stl.o: checkpoint_sequence_stl.cpp \
${TRICK_HOME}/include/trick/checkpoint_sequence_stl.hh \
${TRICK_HOME}/include/trick/memorymanager_c_intf.h \
${TRICK_HOME}/include/trick/parameter_types.h \
${TRICK_HOME}/include/trick/attributes.h \
${TRICK_HOME}/include/trick/reference.h \
${TRICK_HOME}/include/trick/value.h \
${TRICK_HOME}/include/trick/dllist.h \
${TRICK_HOME}/include/trick/var.h \
${TRICK_HOME}/include/trick/io_alloc.h \
${TRICK_HOME}/include/trick/message_proto.h \
${TRICK_HOME}/include/trick/message_type.h

View File

@ -1,23 +0,0 @@
#include <string>
#include <map>
#include "trick/checkpoint_map.hh"
#if 0
int checkpoint_stl(std::map<std::string , std::string> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_strings( in_map , object_name , var_name ) ;
}
int checkpoint_stl(std::multimap<std::string , std::string> & in_map , std::string object_name , std::string var_name ) {
return checkpoint_map_stl_strings( in_map , object_name , var_name ) ;
}
int restore_stl(std::map<std::string , std::string> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_strings( in_map , object_name , var_name ) ;
}
int restore_stl(std::multimap<std::string , std::string> & in_map , std::string object_name , std::string var_name ) {
return restore_map_stl_strings( in_map , object_name , var_name ) ;
}
#endif

View File

@ -1,7 +0,0 @@
#include <string>
#include <utility>
#include "trick/checkpoint_pair.hh"

View File

@ -1,4 +0,0 @@
#include "trick/checkpoint_queue.hh"

View File

@ -1,3 +0,0 @@
#include "trick/checkpoint_sequence_stl.hh"

View File

@ -1,3 +0,0 @@
#include "trick/checkpoint_stack.hh"