MCPcopy Create free account
hub / github.com/davisking/dlib / main

Function main

examples/pipe_ex_2.cpp:130–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128// ----------------------------------------------------------------------------------------
129
130int main()
131{
132 pipe_example pe;
133
134 // Make one of our type_safe_union objects
135 tsu_type msg;
136
137 // Treat our msg as a float and assign it 4.567
138 msg.get<float>() = 4.567f;
139 // Now put the message into the pipe
140 pe.message_pipe.enqueue(msg);
141
142 // Put a string into the pipe
143 msg.get<std::string>() = "string message";
144 pe.message_pipe.enqueue(msg);
145
146 // And now an int
147 msg.get<int>() = 7;
148 pe.message_pipe.enqueue(msg);
149
150 // And another string
151 msg.get<std::string>() = "yet another string message";
152 pe.message_pipe.enqueue(msg);
153
154
155 // the main function won't really terminate here. It will call the destructor for pe
156 // which will block until all the messages have been processed.
157}
158
159// ----------------------------------------------------------------------------------------
160

Callers

nothing calls this directly

Calls 1

enqueueMethod · 0.45

Tested by

no test coverage detected