Support #1725: Improving pup_stl testing
[charm.git] / examples / charm++ / PUP / STLPUP / SimplePUP.C
1 /////////////////////////////////////
2 //
3 //  SimplePUP.C
4 //
5 //  Definition of chares in SimplePUP
6 //
7 //  Author: Eric Bohm
8 //  Date: 2012/7/30
9 //
10 /////////////////////////////////////
11
12 #include "SimplePUP.h"
13 #include "SimplePUP.def.h"
14
15 template <typename U> void execute_example(std::vector<U> &dataToCompare)
16 {
17   //normal object construction
18   HeapObject<U> exampleObject(20, false);
19   exampleObject.data = dataToCompare;
20
21   //normal chare array construction
22   CProxy_SimpleArray<U> simpleProxy= CProxy_SimpleArray<U>::ckNew(30);
23
24   //pass object to remote method invocation on the chare array
25   simpleProxy[29].acceptData(exampleObject, dataToCompare);
26 }
27
28 main::main(CkArgMsg *m)
29 {
30     std::vector<float> dataToCompare1{ 10.23, 20.92, 30.71 };
31     execute_example<float>(dataToCompare1);
32
33     std::vector<int> dataToCompare2{ 10, 20, 30 };
34     execute_example<int>(dataToCompare2);
35
36     std::vector<bool> dataToCompare3{ false, false, true};
37     execute_example<bool>(dataToCompare3);
38 }
39