Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Viriliter/ace-examples

Repository files navigation

ACE Examples

This repository contains examples demonstrating the use of ACE (ADAPTIVE Communication Environment) framework.

Prerequisites

Before building these examples, make sure you have:

  1. ACE Library: Install the ACE development library

    # On Ubuntu/Debian:
    sudo apt-get install libace-dev
    
    # On RHEL/CentOS/Fedora:
    sudo yum install ace-devel
    # or
    sudo dnf install ace-devel
  2. CMake: Version 3.12 or higher

    sudo apt-get install cmake
  3. C++ Compiler: GCC or Clang with C++11 support

Building

Quick Build

Use the provided build script:

./build.sh

Manual Build

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make -j$(nproc)

Release Build

mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j$(nproc)

Examples

hello_reactor

A simple example demonstrating ACE Reactor pattern with timer events.

Location: hello_reactor/

Description: Creates a timer that triggers every 2 seconds after an initial 1-second delay.

Run:

cd build
./hello_reactor/hello_reactor

Or use the CMake target:

cd build
make run_hello_reactor

Project Structure

.
├── CMakeLists.txt          # Root CMake configuration
├── build.sh                # Build script
├── hello_reactor/          # Hello Reactor example
│   ├── CMakeLists.txt      # Example-specific CMake config
│   ├── main.cpp            # Source code
│   └── hello_reactor       # Pre-compiled binary (reference)
└── README.md              # This file

Adding New Examples

To add a new example:

  1. Create a new directory for your example
  2. Add your source files to the directory
  3. Create a CMakeLists.txt file for the example:
    project(your_example_name)
    
    add_executable(your_executable_name main.cpp)
    
    target_link_libraries(your_executable_name 
        ACE::ACE
        pthread
    )
  4. Add the subdirectory to the root CMakeLists.txt:
    add_subdirectory(your_example_directory)

Troubleshooting

ACE Library Not Found

If you get an error about ACE library not being found:

  1. Make sure ACE is installed (see Prerequisites)
  2. Set the ACE_ROOT environment variable if ACE is installed in a custom location:
    export ACE_ROOT=/path/to/ace
  3. You can also specify the path during CMake configuration:
    cmake .. -DACE_ROOT=/path/to/ace

Build Errors

  • Ensure you have C++11 support
  • Check that all required dependencies are installed
  • Try a clean build by removing the build/ directory and rebuilding

License

These examples are provided for educational purposes.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published