Common scenarios populated, FAQ moved

Updated database/networking/advanced from feedback
This commit is contained in:
Peter Turcan
2023-05-26 15:33:40 -07:00
committed by Alan de Freitas
parent cbbf18b656
commit 7dccea0880
10 changed files with 163 additions and 1 deletions

View File

@@ -1,9 +1,13 @@
* xref:intro.adoc[]
* xref:whats-inside.adoc[]
* xref:getting-started.adoc[]
* xref:faq.adoc[]
* Common Scenarios
** xref:faq.adoc[]
** xref:task-networking.adoc[]
** xref:task-simulation.adoc[]
** xref:task-system.adoc[]
** xref:task-text-processing.adoc[]
** xref:testing-debugging.adoc[]
* Tutorials
@@ -11,6 +15,10 @@
* Advanced Scenarios
** xref:advanced-builds.adoc[]
** xref:task-database.adoc[]
** xref:task-machine-learning.adoc[]
** xref:task-metaprogramming.adoc[]
** xref:task-natural-language-parsing.adoc[]
* Community
** xref:reporting-issues.adoc[]

View File

@@ -0,0 +1,33 @@
= High-Performance Database
:navtitle: Database
Creating a high-performance database application in pass:[C++] involves a range of tasks, including network communication, concurrent programming, memory management, and more. Here are some Boost libraries that might be useful:
[circle]
* boost:mysql[]: This library is built on top of boost:asio[], and provides a pass:[C++]11 client for the https://www.mysql.com/[MySQL] and https://mariadb.com/[MariaDB] database servers. As a library it is most useful when your app needs efficient and asynchronous access to one of these servers.
* boost:asio[] : This library provides a consistent asynchronous model using a modern pass:[C++] approach for network and low-level I/O programming. It supports a variety of network protocols, which could be helpful if your database needs to communicate over a network.
* https://github.com/boostorg/redis[Boost.Redis]: Redis (which stands for _Remote Dictionary Server_) is a popular in-memory data structure store, used in database, cache, and message broker applications. This library implements Redis plain text protocol RESP3. It can multiplex any number of client requests, responses, and server pushes onto a single active socket connection to the Redis server.
* boost:container[] : This library provides STL-compatible containers, including stable vector, flat set/map and more. The containers provided by this library can offer performance benefits over their standard library equivalents, making them a good fit for a high-performance database application.
* boost:serialization[] : If you need to serialize objects for storage, boost:serialization[] can be a useful tool. However, be aware that for many database applications, more specialized serialization formats (like Protocol Buffers, Thrift, etc.) might be more appropriate.
* boost:thread[] : This library provides a portable interface for multithreading, which can be crucial when creating a high-performance database that can handle multiple queries concurrently.
* boost:fiber[] : This library provides a framework for micro-/userland-threads (fibers) scheduled cooperatively. Fibers can be used to simplify asynchronous programming, especially when there are many I/O operations, which is typical in database applications.
* boost:interprocess[] : This library allows for shared memory communication and synchronization between processes. In a database context, this can be useful for inter-process communication (IPC) and shared memory databases.
* boost:lockfree[] : This library provides lock-free data structures which could be useful in multi-threaded database applications where you want to avoid locking overhead.
* boost:polygon[] or boost:geometry[] : For storing and querying spatial data, these libraries can provide the necessary data types and algorithms.
* boost:multiprecision[] : For handling high-precision numbers or calculations, this library can be useful.
* boost:pool[] : This library is used for simple, fast memory allocation and can improve efficiency in some scenarios by managing memory in chunks.
* boost:smart_ptr[] : It provides smart pointer class templates, which can be very helpful in managing resources and preventing memory leaks.

View File

@@ -0,0 +1,4 @@
= Machine Learning
:navtitle: Machine Learning
Content under construction

View File

@@ -0,0 +1,4 @@
= Metaprogramming
:navtitle: Metaprogramming
Content under construction

View File

@@ -0,0 +1,4 @@
= Natural Language Parsing
:navtitle: Natural Language
Content under construction

View File

@@ -0,0 +1,23 @@
= Networking
:navtitle: Networking
Developing a networking application in pass:[C++] involves a lot of different components, and the Boost libraries offer numerous options that might help you. Here are a few that are most directly applicable:
[circle]
* boost:asio[]: This is the most important library for your needs. boost:asio[] is a cross-platform pass:[C++] library for network and low-level I/O programming. It provides a consistent asynchronous model using a modern pass:[C++] approach. boost:asio[] supports a variety of network protocols, including ICMP, TCP, and UDP, and it can manage other resources such as serial ports, file descriptors, and even regular files.
* boost:beast[]: This is a library built on top of boost:asio[] that provides implementations of HTTP and WebSocket. These are common protocols for network programming, so if your app needs to work with them, boost:beast[] can be a huge help.
* boost:mysql[]: This library is also built on top of boost:asio[], and provides a pass:[C++]11 client for the https://www.mysql.com/[MySQL] and https://mariadb.com/[MariaDB] database servers. As a library it is most useful when your app needs efficient and asynchronous access to one of these servers.
* https://github.com/boostorg/redis[Boost.Redis]: Redis (which stands for _Remote Dictionary Server_) is a popular in-memory data structure store, used in database, cache, and message broker applications. This library implements Redis plain text protocol RESP3. It can multiplex any number of client requests, responses, and server pushes onto a single active socket connection to the Redis server.
* boost:endian[]: This library provides facilities for dealing with data that is represented in different byte orders. This is a common issue in network programming because different machines may represent multi-byte integers differently.
* boost:spirit[]: If you're creating a new protocol or using a lesser-known one, boost:spirit[], a parser generator framework, could be useful. It allows you to define grammar rules that can parse complex data structures sent over the network.
* boost:thread[]: If your application is multithreaded, this library will be useful. It provides a portable pass:[C++] interface for multithreading.
* boost:smart_ptr[]: This provides smart pointer class templates, including scoped_ptr, shared_ptr, weak_ptr, and intrusive_ptr. Smart pointers can be very helpful in managing resources and preventing memory leaks, especially in an environment where exceptions may be thrown.
* boost:test[]: This library provides support for simple program testing, full unit testing, and for program execution monitoring. Since it's always important to thoroughly test your code, especially when dealing with networking where there are many unpredictable factors, this library can be extremely useful.

View File

@@ -0,0 +1,21 @@
= Real-Time Simulation
:navtitle: Simulation
Creating a real-time simulation of vehicles involves various aspects, including physical modeling, concurrent programming for real-time response, data storage and manipulation, networking for multi-vehicle simulation, and perhaps a graphic interface. Here are some libraries that may be helpful:
[circle]
* boost:chrono[]: Timing is critical in real-time applications. This library can help you measure time intervals, which could be useful for controlling the timing of your simulation.
* boost:geometry[]: For spatial computations and geometric algorithms, which you will likely need for modeling the physical behavior and interactions of your vehicles.
* boost:units[]: This library can help with calculations involving units of measurement. It provides classes and functions that can enforce the correct usage of units and conversions between them, which could be helpful in a physical simulation.
* boost:graph[]: In case you need to represent roads or pathways as a graph, this library provides a flexible and powerful way to represent and manipulate graphs. It also includes a number of graph algorithms.
* boost:thread[] or boost:asio[]: To achieve real-time performance, you might need to make use of multi-threading or asynchronous input/output. boost:thread[] provides classes and functions for multi-threading, synchronization, and inter-thread communication. boost:asio[] is a cross-platform library for asynchronous programming and can handle a lot of networking tasks as well.
* boost:interprocess[]: If you need to share data between different processes in real-time, this library can be useful. It supports shared memory, memory-mapped files, semaphores, and more.
* boost:mpi[] or boost:asio[]: For distributed simulations that run across multiple systems, you might need a library for network communication. boost:mpi[] provides a pass:[C++] interface for the Message Passing Interface (MPI) standard for distributed computing. boost:asio[] can also handle networking tasks and it is a bit lower-level.
* boost:serialization[]: To save the state of the simulation or to communicate complex data structures over a network, you might find this library helpful.

View File

@@ -0,0 +1,25 @@
= System Components
:navtitle: System
Developing a system component for an operating system in pass:[C++] involves a wide range of low-level tasks. The relevant Boost libraries will largely depend on the specifics of your project. Some operating systems may not support all of the features of these libraries, and for low-level tasks, it may be more appropriate to use system APIs directly. Here are some Boost libraries that should be useful:
[circle]
* boost:asio[] : This library provides a consistent asynchronous model using a modern pass:[C++] approach for network and low-level I/O programming. This might be useful for network-related components or any component that interacts with hardware.
* boost:interprocess[] : This library provides a way of sharing memory and communicating between processes. It's useful for creating shared memory regions, handling inter-process communication, managing shared objects, and synchronizing processes.
* boost:thread[] : This library provides a portable interface for multithreading. It includes features for creating and managing threads, mutexes, condition variables, and futures.
* boost:fiber[] : A fiber is a lightweight thread of execution. boost:fiber[] provides a framework for creating and managing fibers, which can be useful in some system-level programming tasks.
* boost:filesystem[] : This library provides a portable way of querying and manipulating paths, files, and directories. It can be very helpful for system-level tasks that need to interact with the file system.
* boost:program_options[] : This library allows program options to be defined, with types and default values, and their values to be retrieved from the command line, from config files, and programmatically.
* boost:system[] : This library provides simple, light-weight error_code objects that encapsulate system-specific "error codes", distinct from pass:[C++] exceptions.
* boost:container[] : This provides advanced data structures beyond the ones provided by the pass:[C++] standard library, which may be useful in certain scenarios.
* boost:process[] : This library allows you to create child processes, setup their environment and provides means to communicate with them asynchronously through various streams.
* boost:chrono[] : This library provides a set of handy features for measuring time, which might be useful for system-level tasks that need to measure or manipulate time.

View File

@@ -0,0 +1,25 @@
= Text Processing
:navtitle: Text Processing
Developing a word processor, or other text based app, involves handling text, GUI (Graphical User Interface), file operations, and possibly networking for cloud features. Boost does not provide a library for creating a GUI. You may want to consider using a library like Qt or wxWidgets for the GUI part of your word processor. Here are some Boost libraries that might assist you in this task:
[circle]
* boost:locale[] : This library provides a way of handling and manipulating text in a culturally-aware manner. It provides localization and internationalization facilities, allowing your word processor to be used by people with different languages and locales.
* boost:filesystem[] : This library provides a way of manipulating files and directories. This would be critical in a word processor for opening, saving, and managing documents.
* boost:spirit[] : This library is a parser framework that can parse complex data structures. If you're creating a word processor, it could be useful to interpret different markup and file formats.
* boost:asio[] : If your word processor has network-related features, such as real-time collaboration or cloud-based storage, boost:asio[] provides a consistent asynchronous model for network programming.
* boost:serialization[] : This library provides a way of serializing and deserializing data, which could be useful for saving and loading documents in a specific format.
* boost:regex[] or boost:xpressive[] : Both libraries could be useful for implementing features like search and replace, spell-checking, and more.
* boost:algorithm[] : This library includes a variety of algorithms for string and sequence processing, which can be useful for handling text.
* boost:date-time[] : If you need to timestamp changes or edits, or if you're implementing any kind of version history feature, this library can help.
* boost:multi-index[] : This library provides a way of maintaining a set of items sorted according to multiple keys, which could be useful for implementing features like an index or a sorted list of items.
* boost:thread[] : If your application is multithreaded (for example, if you want to save a document while the user continues to work), this library will be useful.

View File

@@ -160,3 +160,18 @@ Each of these levels can be used to log messages of different importance:
. `fatal`: Severe errors that may prevent the program from continuing to run.
You can customize these levels to fit your app, and you can also filter logs based on their severity level. For example, in a production environment, you might ignore `trace` and `debug` logs and only record `info`, `warning`, `error`, and `fatal` logs.
== Other Libraries
Other libraries that might help you with testing and debugging include:
[circle]
* boost:stacktrace[]: Stacktrace can be used to capture, store, and print sequences of function calls and their arguments. This can be a lifesaver when you need to debug complex code or post-mortem crashes.
* boost:exception[]: This library enhances the error handling capabilities of pass:[C++]. It enables attaching arbitrary data to exceptions, transporting of exceptions between threads, and more, thereby providing richer error information during debugging.
* boost:static_assert[]: It provides a macro, `BOOST_STATIC_ASSERT`, which can be used to perform assertions that are checked at compile time rather than at run time. This can be used to catch programming errors as early as possible.
* boost:bind[] and boost:lambda[]: These libraries allow for the creation of small, unnamed function objects at the point where they are used. These can be useful in writing concise tests.
* boost:mpl[]: A MetaProgramming Library, though not exclusively for testing or debugging, this library can be helpful in writing compile-time tests.