(#143734) 915186754 SendMessage: sender 1, receiver 2, group 1000000000, type 24050, length 384, source 0
(#143781) 915248646 ReceiveMessage: receiver 1, sender 3, group 1000000000, type 24050, length 256, source 0
(#143658) 914941174 Collective: process 1, collective 11, group 1000000000, root 0, sent 0, received 0, duration 242440, source 0
(#143657) 914941174 Enter: MPI_Barrier, process 1, source 0
(#143728) 915183614 Leave: function 0, process 1, source 0

I have an input file that looks like the above. I need to:
1) Read in file // done
2) Determine if record type is "SendMessage", "ReceiveMessage", "Collective", "Enter", or "Leave"
3) Then parse data into the correct record struct.

I can think of a really inefficient loop looking for token "SendMessage", etc. Then for each message type I know the format of the rest of the record and can use the "," as a token to get the values. I'm wondering if there is a more elegant solution.

Recommended Answers

All 2 Replies

The <map> class might be useful here to map strings and function pointers

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.