@@ -28,35 +28,32 @@ int main() {
2828
2929 std::cout << " Window ID: 0x" << std::hex << window_id << std::dec
3030 << " (Type: " << IdAllocator::GetType (window_id)
31- << " , Sequence: " << IdAllocator::GetSequence (window_id) << " )"
32- << std::endl;
31+ << " , Sequence: " << IdAllocator::GetSequence (window_id) << " )" << std::endl;
3332
3433 std::cout << " Menu ID: 0x" << std::hex << menu_id << std::dec
3534 << " (Type: " << IdAllocator::GetType (menu_id)
36- << " , Sequence: " << IdAllocator::GetSequence (menu_id) << " )"
37- << std::endl;
35+ << " , Sequence: " << IdAllocator::GetSequence (menu_id) << " )" << std::endl;
3836
3937 std::cout << " Tray ID: 0x" << std::hex << tray_id << std::dec
4038 << " (Type: " << IdAllocator::GetType (tray_id)
41- << " , Sequence: " << IdAllocator::GetSequence (tray_id) << " )"
42- << std::endl;
39+ << " , Sequence: " << IdAllocator::GetSequence (tray_id) << " )" << std::endl;
4340
4441 // Example 2: TryAllocate with error checking
4542 std::cout << " \n 2. TryAllocate (safer allocation):" << std::endl;
4643
4744 auto maybe_id = IdAllocator::TryAllocate<MenuItem>();
4845 if (maybe_id != IdAllocator::kInvalidId ) {
49- std::cout << " MenuItem ID allocated successfully: 0x" << std::hex
50- << maybe_id << std::dec << std::endl;
46+ std::cout << " MenuItem ID allocated successfully: 0x" << std::hex << maybe_id << std::dec
47+ << std::endl;
5148 } else {
5249 std::cout << " MenuItem ID allocation failed" << std::endl;
5350 }
5451
5552 // Example 3: ID validation and decomposition
5653 std::cout << " \n 3. ID Validation and Decomposition:" << std::endl;
5754
58- std::cout << " Is window_id valid? "
59- << ( IdAllocator::IsValid (window_id) ? " Yes " : " No " ) << std::endl;
55+ std::cout << " Is window_id valid? " << ( IdAllocator::IsValid (window_id) ? " Yes " : " No " )
56+ << std::endl;
6057
6158 auto decomposed = IdAllocator::Decompose (window_id);
6259 std::cout << " Window ID decomposed - Type: " << decomposed.first
@@ -70,8 +67,7 @@ int main() {
7067
7168 auto new_window_id = IdAllocator::Allocate<Window>();
7269 std::cout << " New Window ID: 0x" << std::hex << new_window_id << std::dec
73- << " (Sequence: " << IdAllocator::GetSequence (new_window_id) << " )"
74- << std::endl;
70+ << " (Sequence: " << IdAllocator::GetSequence (new_window_id) << " )" << std::endl;
7571
7672 std::cout << " Current Window counter (after allocation): "
7773 << IdAllocator::GetCurrentCount<Window>() << std::endl;
@@ -86,10 +82,8 @@ int main() {
8682
8783 std::cout << " Allocated " << window_ids.size () << " Window IDs:" << std::endl;
8884 for (size_t i = 0 ; i < window_ids.size (); ++i) {
89- std::cout << " ID " << (i + 1 ) << " : 0x" << std::hex << window_ids[i]
90- << std::dec
91- << " (Sequence: " << IdAllocator::GetSequence (window_ids[i])
92- << " )" << std::endl;
85+ std::cout << " ID " << (i + 1 ) << " : 0x" << std::hex << window_ids[i] << std::dec
86+ << " (Sequence: " << IdAllocator::GetSequence (window_ids[i]) << " )" << std::endl;
9387 }
9488
9589 // Example 6: Thread safety demonstration
@@ -125,51 +119,41 @@ int main() {
125119 }
126120
127121 auto end_time = std::chrono::high_resolution_clock::now ();
128- auto duration = std::chrono::duration_cast<std::chrono::microseconds>(
129- end_time - start_time);
122+ auto duration = std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time);
130123
131- std::cout << " Allocated " << thread_ids.size () << " Display IDs from "
132- << num_threads << " threads in " << duration.count ()
133- << " microseconds" << std::endl;
124+ std::cout << " Allocated " << thread_ids.size () << " Display IDs from " << num_threads
125+ << " threads in " << duration.count () << " microseconds" << std::endl;
134126
135127 // Verify all IDs are unique
136128 std::sort (thread_ids.begin (), thread_ids.end ());
137129 auto it = std::unique (thread_ids.begin (), thread_ids.end ());
138- std::cout << " All IDs are unique: " << (it == thread_ids.end () ? " Yes" : " No" )
139- << std::endl;
130+ std::cout << " All IDs are unique: " << (it == thread_ids.end () ? " Yes" : " No" ) << std::endl;
140131
141132 // Example 7: Different object types
142133 std::cout << " \n 7. Different Object Types:" << std::endl;
143134
144135 auto display_id = IdAllocator::Allocate<Display>();
145136
146137 std::cout << " Display ID: 0x" << std::hex << display_id << std::dec
147- << " (Type: " << IdAllocator::GetType (display_id) << " )"
148- << std::endl;
138+ << " (Type: " << IdAllocator::GetType (display_id) << " )" << std::endl;
149139
150140 // Example 8: Reset functionality (for testing)
151141 std::cout << " \n 8. Reset Functionality:" << std::endl;
152142
153- std::cout << " Menu counter before reset: "
154- << IdAllocator::GetCurrentCount<Menu>() << std::endl;
143+ std::cout << " Menu counter before reset: " << IdAllocator::GetCurrentCount<Menu>() << std::endl;
155144 IdAllocator::Reset<Menu>();
156- std::cout << " Menu counter after reset: "
157- << IdAllocator::GetCurrentCount<Menu>() << std::endl;
145+ std::cout << " Menu counter after reset: " << IdAllocator::GetCurrentCount<Menu>() << std::endl;
158146
159147 auto new_menu_id = IdAllocator::Allocate<Menu>();
160- std::cout << " New Menu ID after reset: 0x" << std::hex << new_menu_id
161- << std::dec
162- << " (Sequence: " << IdAllocator::GetSequence (new_menu_id) << " )"
163- << std::endl;
148+ std::cout << " New Menu ID after reset: 0x" << std::hex << new_menu_id << std::dec
149+ << " (Sequence: " << IdAllocator::GetSequence (new_menu_id) << " )" << std::endl;
164150
165151 // Example 9: Independent types after reset
166152 std::cout << " \n 9. Independent Types After Reset:" << std::endl;
167153
168154 auto window_after_reset = IdAllocator::Allocate<Window>();
169- std::cout << " Window ID after Menu reset: 0x" << std::hex
170- << window_after_reset << std::dec
171- << " (Sequence: " << IdAllocator::GetSequence (window_after_reset)
172- << " )" << std::endl;
155+ std::cout << " Window ID after Menu reset: 0x" << std::hex << window_after_reset << std::dec
156+ << " (Sequence: " << IdAllocator::GetSequence (window_after_reset) << " )" << std::endl;
173157 std::cout << " Window counter was not affected by Menu reset" << std::endl;
174158
175159 std::cout << " \n Example completed successfully!" << std::endl;
0 commit comments