Container System 0.1.0
High-performance C++20 type-safe container framework with SIMD-accelerated serialization
Loading...
Searching...
No Matches
asio_integration_example.cpp File Reference

Asio integration patterns: strands, timers, thread pools, and message queues. More...

#include <iostream>
#include <memory>
#include <vector>
#include <chrono>
#include <thread>
#include <functional>
#include <queue>
#include <mutex>
#include <condition_variable>
#include "container.h"
Include dependency graph for asio_integration_example.cpp:

Go to the source code of this file.

Macros

#define HAS_ASIO   0
 

Functions

void print_section (const std::string &title)
 Helper to print section headers.
 
void print_success (const std::string &message)
 Helper to print success message.
 
void print_info (const std::string &message)
 Helper to print info message.
 
int main ()
 

Detailed Description

Asio integration patterns: strands, timers, thread pools, and message queues.

Definition in file asio_integration_example.cpp.

Macro Definition Documentation

◆ HAS_ASIO

#define HAS_ASIO   0

Definition at line 47 of file asio_integration_example.cpp.

Function Documentation

◆ main()

int main ( )

Definition at line 384 of file asio_integration_example.cpp.

384 {
385 std::cout << std::string(60, '*') << std::endl;
386 std::cout << " Container System - Asio Integration Examples" << std::endl;
387 std::cout << std::string(60, '*') << std::endl;
388
389#if defined(HAS_STANDALONE_ASIO)
390 std::cout << "Using: Standalone Asio" << std::endl;
391#elif defined(HAS_BOOST_ASIO)
392 std::cout << "Using: Boost.Asio" << std::endl;
393#else
394 std::cout << "Asio not available!" << std::endl;
395 std::cout << "Install standalone Asio or Boost.Asio to run this example." << std::endl;
396 std::cout << std::endl;
397 std::cout << "Install via vcpkg:" << std::endl;
398 std::cout << " vcpkg install asio" << std::endl;
399 std::cout << " # or" << std::endl;
400 std::cout << " vcpkg install boost-asio" << std::endl;
401 return 1;
402#endif
403
404#if defined(HAS_STANDALONE_ASIO) || defined(HAS_BOOST_ASIO)
405 demonstrate_basic_asio_integration();
406 demonstrate_scheduled_processing();
407 demonstrate_concurrent_processing();
408 demonstrate_message_queue();
409
410#if CONTAINER_HAS_COROUTINES
411 demonstrate_coroutine_asio_hybrid();
412#else
413 std::cout << "\nNote: C++20 coroutine demos skipped (compiler support required)" << std::endl;
414#endif
415
416 print_section("All Asio Integration Examples Complete");
417 std::cout << "These patterns can be adapted for real network applications" << std::endl;
418 std::cout << "using TCP/UDP sockets with Asio." << std::endl;
419#endif
420
421 return 0;
422}
void print_section(const std::string &title)
Helper to print section headers.

References print_section().

Here is the call graph for this function:

◆ print_info()

void print_info ( const std::string & message)

Helper to print info message.

Examples
asio_integration_example.cpp.

Definition at line 75 of file asio_integration_example.cpp.

75 {
76 std::cout << "[INFO] " << message << std::endl;
77}

◆ print_section()

void print_section ( const std::string & title)

Helper to print section headers.

Examples
asio_integration_example.cpp, and async_coroutine_example.cpp.

Definition at line 59 of file asio_integration_example.cpp.

59 {
60 std::cout << "\n" << std::string(60, '=') << std::endl;
61 std::cout << " " << title << std::endl;
62 std::cout << std::string(60, '=') << std::endl;
63}

Referenced by main().

Here is the caller graph for this function:

◆ print_success()

void print_success ( const std::string & message)

Helper to print success message.

Examples
asio_integration_example.cpp, and async_coroutine_example.cpp.

Definition at line 68 of file asio_integration_example.cpp.

68 {
69 std::cout << "[OK] " << message << std::endl;
70}