mirror of
https://github.com/nasa/trick.git
synced 2024-12-18 20:57:55 +00:00
Split test sims and fun sims into separate directories.
Gave each sim their own model directory, or in some cases just a header file. Each sim in the test directory is now independent of each other. Modifying one test will not affect any other test. refs #191
This commit is contained in:
parent
f627771387
commit
bf80dcc03f
194
test/SIM_rti/ClassOfEverything.hh
Normal file
194
test/SIM_rti/ClassOfEverything.hh
Normal file
@ -0,0 +1,194 @@
|
||||
/**
|
||||
@file
|
||||
|
||||
@verbatim
|
||||
PURPOSE:
|
||||
(Test input processor)
|
||||
LIBRARY DEPENDENCY:
|
||||
()
|
||||
@endverbatim
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef BALL_TEST_HH
|
||||
#define BALL_TEST_HH
|
||||
|
||||
// Model include files.
|
||||
#include "trick/mm_macros.hh"
|
||||
#define NUM 8
|
||||
|
||||
typedef enum {
|
||||
FIRST,
|
||||
SECOND,
|
||||
THIRD,
|
||||
_FORTH,
|
||||
FIFTH,
|
||||
SIXTH,
|
||||
SEVENTH
|
||||
} MY_ENUM ;
|
||||
|
||||
class ClassOfEverything {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrClassOfEverything() ;
|
||||
|
||||
public:
|
||||
// Default constructor and destructor.
|
||||
ClassOfEverything() {};
|
||||
~ClassOfEverything() {};
|
||||
|
||||
/* maybe someday we'll be able to do something like this. */
|
||||
double d_test ; /* -- blah */
|
||||
|
||||
double d ; /* kg blah */
|
||||
double da[3] ; /* kg blah */
|
||||
double * dp ; /* kg blah */
|
||||
double daa[2][3] ; /* kg blah */
|
||||
double * dap[4] ; /* kg blah */
|
||||
double ** dpp ; /* kg blah */
|
||||
double daaa[2][3][4] ; /* kg blah */
|
||||
double daaaa[2][3][4][5] ; /* kg blah */
|
||||
|
||||
float f ; /* kg blah */
|
||||
float fa[3] ; /* kg blah */
|
||||
float * fp ; /* kg blah */
|
||||
float faa[2][3] ; /* kg blah */
|
||||
float * fap[4] ; /* kg blah */
|
||||
float ** fpp ; /* kg blah */
|
||||
|
||||
float f_rad ; /* r float test value */
|
||||
double d_deg ; /* d blah */
|
||||
|
||||
char c ; /* -- blah */
|
||||
char ca[20] ; /* -- blah */
|
||||
char * cp ; /* -- blah */
|
||||
char caa[3][16] ; /* -- blah */
|
||||
char * cap[4] ; /* -- blah */
|
||||
char **cpp;
|
||||
|
||||
unsigned char uc ; /* -- blah */
|
||||
unsigned char uca[20] ; /* -- blah */
|
||||
unsigned char * ucp ; /* -- blah */
|
||||
unsigned char ucaa[2][3] ; /* -- blah */
|
||||
unsigned char * ucap[4] ; /* -- blah */
|
||||
unsigned char **ucpp;
|
||||
|
||||
short s ; /* -- blah */
|
||||
short sa[20] ; /* -- blah */
|
||||
short * sp ; /* -- blah */
|
||||
short saa[2][3] ; /* -- blah */
|
||||
short * sap[4] ; /* -- blah */
|
||||
short **spp;
|
||||
|
||||
unsigned short us ; /* -- blah */
|
||||
unsigned short usa[20] ; /* -- blah */
|
||||
unsigned short * usp ; /* -- blah */
|
||||
unsigned short usaa[2][3] ; /* -- blah */
|
||||
unsigned short * usap[4] ; /* -- blah */
|
||||
unsigned short **uspp;
|
||||
|
||||
MY_ENUM e ;
|
||||
MY_ENUM ea[4] ;
|
||||
MY_ENUM * ep ;
|
||||
MY_ENUM eaa[2][3] ;
|
||||
MY_ENUM * eap[4] ;
|
||||
MY_ENUM ** epp ;
|
||||
|
||||
int i ; /* -- blah */
|
||||
int ia[3] ; /* -- blah */
|
||||
int * ip ; /* -- blah */
|
||||
int iaa[2][3] ; /* -- blah */
|
||||
int * iap[NUM] ; /* -- blah */
|
||||
int ** ipp ; /* -- blah */
|
||||
|
||||
unsigned int ui ; /* -- blah */
|
||||
unsigned int uia[20] ; /* -- blah */
|
||||
unsigned int * uip ; /* -- blah */
|
||||
unsigned int uiaa[2][3] ; /* -- blah */
|
||||
unsigned int * uiap[4] ; /* -- blah */
|
||||
unsigned int **uipp;
|
||||
|
||||
long l ; /* -- blah */
|
||||
long la[20] ; /* -- blah */
|
||||
long * lp ; /* -- blah */
|
||||
long laa[2][3] ; /* -- blah */
|
||||
long * lap[4] ; /* -- blah */
|
||||
long **lpp;
|
||||
|
||||
unsigned long ul ; /* -- blah */
|
||||
unsigned long ula[20] ; /* -- blah */
|
||||
unsigned long * ulp ; /* -- blah */
|
||||
unsigned long ulaa[2][3] ; /* -- blah */
|
||||
unsigned long * ulap[4] ; /* -- blah */
|
||||
unsigned long **ulpp;
|
||||
|
||||
long long ll ; /* -- blah */
|
||||
long long lla[20] ; /* -- blah */
|
||||
long long * llp ; /* -- blah */
|
||||
long long llaa[2][3] ; /* -- blah */
|
||||
long long * llap[4] ; /* -- blah */
|
||||
long long **llpp;
|
||||
|
||||
unsigned long long ull ; /* -- blah */
|
||||
unsigned long long ulla[20] ; /* -- blah */
|
||||
unsigned long long * ullp ; /* -- blah */
|
||||
unsigned long long ullaa[2][3] ; /* -- blah */
|
||||
unsigned long long * ullap[4] ; /* -- blah */
|
||||
unsigned long long **ullpp;
|
||||
|
||||
bool b ; /* -- blah */
|
||||
bool ba[20] ; /* -- blah */
|
||||
bool * bp ; /* -- blah */
|
||||
bool baa[2][3] ; /* -- blah */
|
||||
bool * bap[4] ; /* -- blah */
|
||||
bool **bpp;
|
||||
|
||||
char cbit_0 : 2 ; /**< -- blah */
|
||||
char cbit_1 : 3 ; /**< -- blah */
|
||||
char cbit_2 : 3 ; /**< -- blah */
|
||||
|
||||
unsigned char ucbit_0 : 2 ; /**< -- blah */
|
||||
unsigned char ucbit_1 : 3 ; /**< -- blah */
|
||||
unsigned char ucbit_2 : 3 ; /**< -- blah */
|
||||
|
||||
char cpad[2] ;
|
||||
|
||||
short sbit_0 : 4 ; /**< -- blah */
|
||||
short sbit_1 : 5 ; /**< -- blah */
|
||||
short sbit_2 : 7 ; /**< -- blah */
|
||||
|
||||
unsigned short usbit_0 : 4 ; /**< -- blah */
|
||||
unsigned short usbit_1 : 5 ; /**< -- blah */
|
||||
unsigned short usbit_2 : 7 ; /**< -- blah */
|
||||
|
||||
int bit_0 : 4 ; /**< -- blah */
|
||||
int bit_1 : 5 ; /**< -- blah */
|
||||
int bit_2 : 6 ; /**< -- blah */
|
||||
int pad : 17 ; /**< -- blah */
|
||||
|
||||
unsigned int ubit_0 : 4 ; /**< -- blah */
|
||||
unsigned int ubit_1 : 5 ; /**< -- blah */
|
||||
unsigned int ubit_2 : 6 ; /**< -- blah */
|
||||
unsigned int upad : 17 ; /**< -- blah */
|
||||
|
||||
long lbit_0 : 4 ; /**< -- blah */
|
||||
long lbit_1 : 5 ; /**< -- blah */
|
||||
long lbit_2 : 6 ; /**< -- blah */
|
||||
long lpad : 17 ; /**< -- blah */
|
||||
|
||||
unsigned long ulbit_0 : 4 ; /**< -- blah */
|
||||
unsigned long ulbit_1 : 5 ; /**< -- blah */
|
||||
unsigned long ulbit_2 : 6 ; /**< -- blah */
|
||||
unsigned long ulpad : 17 ; /**< -- blah */
|
||||
|
||||
bool boolbit_0 : 1 ; /**< -- blah */
|
||||
bool boolbit_1 : 1 ; /**< -- blah */
|
||||
bool boolbit_2 : 1 ; /**< -- blah */
|
||||
|
||||
private:
|
||||
ClassOfEverything (const ClassOfEverything &);
|
||||
ClassOfEverything & operator= (const ClassOfEverything &);
|
||||
|
||||
};
|
||||
|
||||
#endif /* _BALL_HH_ */
|
||||
|
@ -7,15 +7,12 @@ LIBRARY DEPENDENCIES:
|
||||
*************************************************************/
|
||||
|
||||
#include "sim_objects/default_trick_sys.sm"
|
||||
##include "test_ip/include/ClassOfEverything.hh"
|
||||
##include "ClassOfEverything.hh"
|
||||
|
||||
class testSimObject : public Trick::SimObject {
|
||||
|
||||
public:
|
||||
ClassOfEverything obj ;
|
||||
TEST_STRUCT t ;
|
||||
my_ns::AA ns_test ;
|
||||
|
||||
testSimObject() {}
|
||||
|
||||
private:
|
||||
|
@ -1,2 +1,2 @@
|
||||
TRICK_CFLAGS += -I../models
|
||||
TRICK_CXXFLAGS += -I../models
|
||||
TRICK_CFLAGS += -I.
|
||||
TRICK_CXXFLAGS += -I.
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
TRICK_CFLAGS += -I../models
|
||||
TRICK_CXXFLAGS += -I../models
|
||||
TRICK_CFLAGS += -I./models
|
||||
TRICK_CXXFLAGS += -I./models
|
||||
|
||||
|
@ -276,5 +276,6 @@ STLCheckpoint::STLCheckpoint(std::string in_name) {
|
||||
|
||||
int STLCheckpoint::speak() {
|
||||
message_publish(1,"Quack!\n") ;
|
||||
return 0 ;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "sim_objects/default_trick_sys.sm"
|
||||
|
||||
##include "stl_checkpoint/include/STLCheckpoint.hh"
|
||||
##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
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
TRICK_CFLAGS += -I../models
|
||||
TRICK_CXXFLAGS += -I../models
|
||||
TRICK_CFLAGS += -I./models
|
||||
TRICK_CXXFLAGS += -I./models
|
||||
|
||||
|
281
test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.cpp
Normal file
281
test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.cpp
Normal file
@ -0,0 +1,281 @@
|
||||
|
||||
#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 ;
|
||||
}
|
||||
|
93
test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.hh
Normal file
93
test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.hh
Normal file
@ -0,0 +1,93 @@
|
||||
/*
|
||||
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
|
||||
|
@ -1,3 +1,3 @@
|
||||
TRICK_ICG_EXCLUDE=${TRICK_HOME}/trick_models/exclude_me
|
||||
TRICK_CFLAGS += -I../models
|
||||
TRICK_CXXFLAGS += -I../models
|
||||
TRICK_ICG_EXCLUDE=./models/exclude_me
|
||||
TRICK_CFLAGS += -I./models
|
||||
TRICK_CXXFLAGS += -I./models
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "sim_objects/default_trick_sys.sm"
|
||||
|
||||
##include "test_ip/include/TemplateTest.hh"
|
||||
##include "TemplateTest.hh"
|
||||
|
||||
class templateSimObject : public Trick::SimObject {
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
|
||||
TRICK_CFLAGS += -I../models
|
||||
TRICK_CXXFLAGS += -I../models
|
||||
TRICK_CFLAGS += -I.
|
||||
TRICK_CXXFLAGS += -I.
|
||||
|
||||
|
48
test/SIM_test_templates/TemplateTest.hh
Normal file
48
test/SIM_test_templates/TemplateTest.hh
Normal file
@ -0,0 +1,48 @@
|
||||
/**
|
||||
@file
|
||||
|
||||
@verbatim
|
||||
PURPOSE:
|
||||
(Template tests)
|
||||
@endverbatim
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef TEMPLATETEST_HH
|
||||
#define TEMPLATETEST_HH
|
||||
|
||||
template <class A, class B>
|
||||
class TTT {
|
||||
public:
|
||||
|
||||
TTT() {
|
||||
aa = 0 ;
|
||||
bb = 0 ;
|
||||
cc = NULL ;
|
||||
dd = NULL ;
|
||||
} ;
|
||||
A aa ;
|
||||
B bb ;
|
||||
TTT<A,B> * ttt ;
|
||||
|
||||
typedef TTT<A,B> C ;
|
||||
C * cc ;
|
||||
typedef TTT<B,A> D ;
|
||||
D * dd ;
|
||||
} ;
|
||||
|
||||
class TemplateTest {
|
||||
|
||||
friend class InputProcessor ;
|
||||
friend void init_attrTemplateTest() ;
|
||||
|
||||
public:
|
||||
TTT< int , double > TTT_var ;
|
||||
|
||||
};
|
||||
|
||||
#ifdef SWIG
|
||||
%struct_str(TemplateTest)
|
||||
#endif
|
||||
|
||||
#endif /* _BALL_HH_ */
|
||||
|
Loading…
Reference in New Issue
Block a user