From bf80dcc03f0a5e3fdc5195915e6a3bd864992043 Mon Sep 17 00:00:00 2001 From: Alex Lin Date: Thu, 25 Feb 2016 14:40:55 -0600 Subject: [PATCH] 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 --- test/SIM_rti/ClassOfEverything.hh | 194 ++++++++++++ test/SIM_rti/S_define | 5 +- test/SIM_rti/S_overrides.mk | 4 +- test/SIM_stls/S_overrides.mk | 4 +- .../stl_checkpoint/include/STLCheckpoint.hh | 0 .../stl_checkpoint/include/STLCompanion.hh | 0 .../stl_checkpoint/src/STLCheckpoint.cpp | 1 + .../src/STLCompanion_checkpoint.cpp | 0 .../src/STLCompanion_post_checkpoint.cpp | 0 .../src/STLCompanion_restart.cpp | 0 test/SIM_stls2/S_define | 2 +- test/SIM_stls2/S_overrides.mk | 4 +- .../models/stl_checkpoint/STLCheckpoint.cpp | 281 ++++++++++++++++++ .../models/stl_checkpoint/STLCheckpoint.hh | 93 ++++++ test/SIM_test_ip/S_overrides.mk | 6 +- .../models/exclude_me/include/exclude_me.hh | 0 .../test_ip/include/ClassOfEverything.hh | 0 .../models/test_ip/include/EmbeddedClasses.hh | 0 .../models/test_ip/include/Namespace_tests.hh | 0 .../models/test_ip/include/NoICG.hh | 0 .../test_ip/include/OverloadedVariable.hh | 0 .../models/test_ip/include/TemplateTest.hh | 0 .../models/test_ip/src/ClassOfEverything.cpp | 0 test/SIM_test_templates/S_define | 2 +- test/SIM_test_templates/S_overrides.mk | 4 +- test/SIM_test_templates/TemplateTest.hh | 48 +++ 26 files changed, 631 insertions(+), 17 deletions(-) create mode 100644 test/SIM_rti/ClassOfEverything.hh rename test/{ => SIM_stls}/models/stl_checkpoint/include/STLCheckpoint.hh (100%) rename test/{ => SIM_stls}/models/stl_checkpoint/include/STLCompanion.hh (100%) rename test/{ => SIM_stls}/models/stl_checkpoint/src/STLCheckpoint.cpp (99%) rename test/{ => SIM_stls}/models/stl_checkpoint/src/STLCompanion_checkpoint.cpp (100%) rename test/{ => SIM_stls}/models/stl_checkpoint/src/STLCompanion_post_checkpoint.cpp (100%) rename test/{ => SIM_stls}/models/stl_checkpoint/src/STLCompanion_restart.cpp (100%) create mode 100644 test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.cpp create mode 100644 test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.hh rename test/{ => SIM_test_ip}/models/exclude_me/include/exclude_me.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/include/ClassOfEverything.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/include/EmbeddedClasses.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/include/Namespace_tests.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/include/NoICG.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/include/OverloadedVariable.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/include/TemplateTest.hh (100%) rename test/{ => SIM_test_ip}/models/test_ip/src/ClassOfEverything.cpp (100%) create mode 100644 test/SIM_test_templates/TemplateTest.hh diff --git a/test/SIM_rti/ClassOfEverything.hh b/test/SIM_rti/ClassOfEverything.hh new file mode 100644 index 00000000..8f0f2471 --- /dev/null +++ b/test/SIM_rti/ClassOfEverything.hh @@ -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_ */ + diff --git a/test/SIM_rti/S_define b/test/SIM_rti/S_define index 643fc0a8..3938d4e8 100644 --- a/test/SIM_rti/S_define +++ b/test/SIM_rti/S_define @@ -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: diff --git a/test/SIM_rti/S_overrides.mk b/test/SIM_rti/S_overrides.mk index ce5861e6..abb1483f 100644 --- a/test/SIM_rti/S_overrides.mk +++ b/test/SIM_rti/S_overrides.mk @@ -1,2 +1,2 @@ -TRICK_CFLAGS += -I../models -TRICK_CXXFLAGS += -I../models +TRICK_CFLAGS += -I. +TRICK_CXXFLAGS += -I. diff --git a/test/SIM_stls/S_overrides.mk b/test/SIM_stls/S_overrides.mk index a2eff6d4..27536a3b 100644 --- a/test/SIM_stls/S_overrides.mk +++ b/test/SIM_stls/S_overrides.mk @@ -1,4 +1,4 @@ -TRICK_CFLAGS += -I../models -TRICK_CXXFLAGS += -I../models +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models diff --git a/test/models/stl_checkpoint/include/STLCheckpoint.hh b/test/SIM_stls/models/stl_checkpoint/include/STLCheckpoint.hh similarity index 100% rename from test/models/stl_checkpoint/include/STLCheckpoint.hh rename to test/SIM_stls/models/stl_checkpoint/include/STLCheckpoint.hh diff --git a/test/models/stl_checkpoint/include/STLCompanion.hh b/test/SIM_stls/models/stl_checkpoint/include/STLCompanion.hh similarity index 100% rename from test/models/stl_checkpoint/include/STLCompanion.hh rename to test/SIM_stls/models/stl_checkpoint/include/STLCompanion.hh diff --git a/test/models/stl_checkpoint/src/STLCheckpoint.cpp b/test/SIM_stls/models/stl_checkpoint/src/STLCheckpoint.cpp similarity index 99% rename from test/models/stl_checkpoint/src/STLCheckpoint.cpp rename to test/SIM_stls/models/stl_checkpoint/src/STLCheckpoint.cpp index 2a036012..c8472d15 100644 --- a/test/models/stl_checkpoint/src/STLCheckpoint.cpp +++ b/test/SIM_stls/models/stl_checkpoint/src/STLCheckpoint.cpp @@ -276,5 +276,6 @@ STLCheckpoint::STLCheckpoint(std::string in_name) { int STLCheckpoint::speak() { message_publish(1,"Quack!\n") ; + return 0 ; } diff --git a/test/models/stl_checkpoint/src/STLCompanion_checkpoint.cpp b/test/SIM_stls/models/stl_checkpoint/src/STLCompanion_checkpoint.cpp similarity index 100% rename from test/models/stl_checkpoint/src/STLCompanion_checkpoint.cpp rename to test/SIM_stls/models/stl_checkpoint/src/STLCompanion_checkpoint.cpp diff --git a/test/models/stl_checkpoint/src/STLCompanion_post_checkpoint.cpp b/test/SIM_stls/models/stl_checkpoint/src/STLCompanion_post_checkpoint.cpp similarity index 100% rename from test/models/stl_checkpoint/src/STLCompanion_post_checkpoint.cpp rename to test/SIM_stls/models/stl_checkpoint/src/STLCompanion_post_checkpoint.cpp diff --git a/test/models/stl_checkpoint/src/STLCompanion_restart.cpp b/test/SIM_stls/models/stl_checkpoint/src/STLCompanion_restart.cpp similarity index 100% rename from test/models/stl_checkpoint/src/STLCompanion_restart.cpp rename to test/SIM_stls/models/stl_checkpoint/src/STLCompanion_restart.cpp diff --git a/test/SIM_stls2/S_define b/test/SIM_stls2/S_define index 03057ffe..38dfe170 100644 --- a/test/SIM_stls2/S_define +++ b/test/SIM_stls2/S_define @@ -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 diff --git a/test/SIM_stls2/S_overrides.mk b/test/SIM_stls2/S_overrides.mk index a2eff6d4..27536a3b 100644 --- a/test/SIM_stls2/S_overrides.mk +++ b/test/SIM_stls2/S_overrides.mk @@ -1,4 +1,4 @@ -TRICK_CFLAGS += -I../models -TRICK_CXXFLAGS += -I../models +TRICK_CFLAGS += -I./models +TRICK_CXXFLAGS += -I./models diff --git a/test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.cpp b/test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.cpp new file mode 100644 index 00000000..c8472d15 --- /dev/null +++ b/test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.cpp @@ -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(11,111)) ; + my_int_multimap.insert(std::pair(22,222)) ; + my_int_multimap.insert(std::pair(33,333)) ; + my_int_multimap.insert(std::pair(11,111)) ; + my_int_multimap.insert(std::pair(22,222)) ; + my_int_multimap.insert(std::pair(33,333)) ; + + my_string_key_multimap.insert(std::pair("one", 1)) ; + my_string_key_multimap.insert(std::pair("two", 2)) ; + my_string_key_multimap.insert(std::pair("three", 3)) ; + my_string_key_multimap.insert(std::pair("one", 1)) ; + my_string_key_multimap.insert(std::pair("two", 2)) ; + my_string_key_multimap.insert(std::pair("three", 3)) ; + + my_string_data_multimap.insert(std::pair(4, "vier")) ; + my_string_data_multimap.insert(std::pair(5, "fumf")) ; + my_string_data_multimap.insert(std::pair(6, "sechs")) ; + my_string_data_multimap.insert(std::pair(4, "four")) ; + my_string_data_multimap.insert(std::pair(5, "five")) ; + my_string_data_multimap.insert(std::pair(6, "six")) ; + + my_string_multimap.insert(std::pair("mother","Marge")) ; + my_string_multimap.insert(std::pair("father","Homer")) ; + my_string_multimap.insert(std::pair("mother","Lois")) ; + my_string_multimap.insert(std::pair("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(44,444)) ; + my_int_multimap.insert(std::pair(55,555)) ; + my_int_multimap.insert(std::pair(66,666)) ; + my_int_multimap.insert(std::pair(44,444)) ; + my_int_multimap.insert(std::pair(55,555)) ; + my_int_multimap.insert(std::pair(66,666)) ; + + my_string_key_multimap.insert(std::pair("four", 4)) ; + my_string_key_multimap.insert(std::pair("five", 5)) ; + my_string_key_multimap.insert(std::pair("six", 6)) ; + my_string_key_multimap.insert(std::pair("four", 44)) ; + my_string_key_multimap.insert(std::pair("five", 55)) ; + my_string_key_multimap.insert(std::pair("six", 66)) ; + + my_string_data_multimap.insert(std::pair(7, "seiben")) ; + my_string_data_multimap.insert(std::pair(8, "acht")) ; + my_string_data_multimap.insert(std::pair(9, "neun")) ; + my_string_data_multimap.insert(std::pair(7, "seven")) ; + my_string_data_multimap.insert(std::pair(8, "eight")) ; + my_string_data_multimap.insert(std::pair(9, "nine")) ; + + my_string_multimap.insert(std::pair("sister","Lisa")) ; + my_string_multimap.insert(std::pair("dog","Santa's Little Helper")) ; + my_string_multimap.insert(std::pair("sister","Meg")) ; + my_string_multimap.insert(std::pair("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 ; +} + diff --git a/test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.hh b/test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.hh new file mode 100644 index 00000000..8a4b4031 --- /dev/null +++ b/test/SIM_stls2/models/stl_checkpoint/STLCheckpoint.hh @@ -0,0 +1,93 @@ +/* + PURPOSE: (Illustrate how to checkpoint STLs) + LIBRARY_DEPENDENCIES: ( + (STLCheckpoint.o) + ) +*/ + +#ifndef STLCHECKPOINT_HH +#define STLCHECKPOINT_HH + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* 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 + diff --git a/test/SIM_test_ip/S_overrides.mk b/test/SIM_test_ip/S_overrides.mk index 40a6b97e..dfad28e0 100644 --- a/test/SIM_test_ip/S_overrides.mk +++ b/test/SIM_test_ip/S_overrides.mk @@ -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 diff --git a/test/models/exclude_me/include/exclude_me.hh b/test/SIM_test_ip/models/exclude_me/include/exclude_me.hh similarity index 100% rename from test/models/exclude_me/include/exclude_me.hh rename to test/SIM_test_ip/models/exclude_me/include/exclude_me.hh diff --git a/test/models/test_ip/include/ClassOfEverything.hh b/test/SIM_test_ip/models/test_ip/include/ClassOfEverything.hh similarity index 100% rename from test/models/test_ip/include/ClassOfEverything.hh rename to test/SIM_test_ip/models/test_ip/include/ClassOfEverything.hh diff --git a/test/models/test_ip/include/EmbeddedClasses.hh b/test/SIM_test_ip/models/test_ip/include/EmbeddedClasses.hh similarity index 100% rename from test/models/test_ip/include/EmbeddedClasses.hh rename to test/SIM_test_ip/models/test_ip/include/EmbeddedClasses.hh diff --git a/test/models/test_ip/include/Namespace_tests.hh b/test/SIM_test_ip/models/test_ip/include/Namespace_tests.hh similarity index 100% rename from test/models/test_ip/include/Namespace_tests.hh rename to test/SIM_test_ip/models/test_ip/include/Namespace_tests.hh diff --git a/test/models/test_ip/include/NoICG.hh b/test/SIM_test_ip/models/test_ip/include/NoICG.hh similarity index 100% rename from test/models/test_ip/include/NoICG.hh rename to test/SIM_test_ip/models/test_ip/include/NoICG.hh diff --git a/test/models/test_ip/include/OverloadedVariable.hh b/test/SIM_test_ip/models/test_ip/include/OverloadedVariable.hh similarity index 100% rename from test/models/test_ip/include/OverloadedVariable.hh rename to test/SIM_test_ip/models/test_ip/include/OverloadedVariable.hh diff --git a/test/models/test_ip/include/TemplateTest.hh b/test/SIM_test_ip/models/test_ip/include/TemplateTest.hh similarity index 100% rename from test/models/test_ip/include/TemplateTest.hh rename to test/SIM_test_ip/models/test_ip/include/TemplateTest.hh diff --git a/test/models/test_ip/src/ClassOfEverything.cpp b/test/SIM_test_ip/models/test_ip/src/ClassOfEverything.cpp similarity index 100% rename from test/models/test_ip/src/ClassOfEverything.cpp rename to test/SIM_test_ip/models/test_ip/src/ClassOfEverything.cpp diff --git a/test/SIM_test_templates/S_define b/test/SIM_test_templates/S_define index 5a5c4e6c..18f2986b 100644 --- a/test/SIM_test_templates/S_define +++ b/test/SIM_test_templates/S_define @@ -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 { diff --git a/test/SIM_test_templates/S_overrides.mk b/test/SIM_test_templates/S_overrides.mk index a2eff6d4..b3a5f31f 100644 --- a/test/SIM_test_templates/S_overrides.mk +++ b/test/SIM_test_templates/S_overrides.mk @@ -1,4 +1,4 @@ -TRICK_CFLAGS += -I../models -TRICK_CXXFLAGS += -I../models +TRICK_CFLAGS += -I. +TRICK_CXXFLAGS += -I. diff --git a/test/SIM_test_templates/TemplateTest.hh b/test/SIM_test_templates/TemplateTest.hh new file mode 100644 index 00000000..845da5ea --- /dev/null +++ b/test/SIM_test_templates/TemplateTest.hh @@ -0,0 +1,48 @@ +/** +@file + +@verbatim +PURPOSE: + (Template tests) +@endverbatim +*******************************************************************************/ + +#ifndef TEMPLATETEST_HH +#define TEMPLATETEST_HH + +template +class TTT { + public: + + TTT() { + aa = 0 ; + bb = 0 ; + cc = NULL ; + dd = NULL ; + } ; + A aa ; + B bb ; + TTT * ttt ; + + typedef TTT C ; + C * cc ; + typedef TTT 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_ */ +