C++ Boost

Boost Statechart 庫

Configuration 配置


General configuration 通用配置
Introduction 簡介
Debug mode compilation options 調試模式的編譯選項
Release mode compilation options 發佈模式的編譯選項
Application Defined Macros 應用程序定義的宏

General configuration 通用配置

Introduction 簡介

The library uses several configuration macros in <boost/config.hpp>, as well as two configuration macros meant to be supplied by the application. Moreover, two commonly available compiler options also have an impact on the available features.
本庫使用了 <boost/config.hpp> 中的幾個配置宏,以及兩個由應用程序提供的配置宏。此外,兩個常用的編譯器選項也會對可用的特性產生影響。

Debug mode compilation options 調試模式的編譯選項

Release mode compilation options 發佈模式的編譯選項

Application Defined Macros 應用程序定義的宏

The following macros may be defined by an application using the library:
以下宏可以由應用程序定義而被本庫使用:

Macro 宏 Meaning 含義
BOOST_STATECHART_USE_NATIVE_RTTI When defined, the library no longer uses its own speed-optimized RTTI implementation. Instead, native C++ RTTI is employed (see RTTI customization in the performance document for more information). This has the following effects:
如果被定義,本庫不再使用自己的有速度優化的RTTI實現。而是採用原生的 C++ RTTI (更多信息請見"性能"文檔中的 RTTI 定制)。它有以下影響:
  • state_machine::state_base_type becomes a polymorphic type. That is, when typeid is applied to a state_machine::state_base_type reference, the result refers to a type_info object representing the the type of the most derived state type
    state_machine::state_base_type 變為一個多態類型。即在將 typeid 應用於 state_machine::state_base_type 引用時,結果將引向一個 type_info 對象,該對像表示了其最底層狀態類型的類型
  • Custom state type information is no longer available
    定制化狀態類型信息 不再可用
  • All states need to store one pointer less, leading to a best-case state machine memory footprint reduction of about 15%
    所以狀態都可以少保存一個指針,最好情況中下,狀態機的內存佔用大約減少15%
  • Under most circumstances, dispatch speed degrades. This is because native C++ RTTI values are retrieved through an additional indirection on almost all platforms. See Speed versus scalability tradeoffs in the performance document for timings
    在多數情況下,分派速度會降低。這是因為在幾乎所有平台上,原生的 C++ RTTI 是通過一個額外的間接層來獲得。請見"性能"文檔中的 速度與可擴展性的折衷
BOOST_STATECHART_RELAX_TRANSITION_CONTEXT When defined, the sequence of actions that are called during a transition is relaxed. That is, its is no longer necessary that all states up to the innermost common context are exited before the transition action is called (as mandated by the UML standard). Instead, the transition action can be a member of either the transition source or any direct or indirect outer context and is called as soon as all possibly active inner states have been exited. Then all remaining active states up to the innermost common context are exited before entering all states down to the transition destination
如果被定義,則在一次轉換中調用各個動作的順序將是隨意的。即,在轉換動作被調用之前,不再需要直至最內層公共上下文的所有狀態都已退出(UML標準的要 求是嚴格有序的)。相反,轉換動作可以是轉換源狀態或其任意一個直接或間接的外層上下文的成員函數,一旦所有可能的內層活動狀態被退出,就可以調用它。然 後直至最內層公共上下文的所有剩餘的活動狀態在進入轉換目標的所有狀態之前被退出

Both macros need to be consistently defined or undefined for all translation units that are later linked into the same executable. Not doing so will inevitably lead to ODR violations. Depending on compiler and linker technology such violations may or may not manifest themselves in link-time errors.
這兩個宏必須對要鏈接到同一個可執行文件中的所有編譯單元統一地定義或去定義。如果不這麼做,將導致違反ODR。取決於編譯器和鏈接器所採用的技術,這種違反可能會也可能不會表現為鏈接錯誤。


Valid HTML 4.01 Transitional

Revised 05 January, 2008

Copyright c 2003-2008 Andreas Huber Donni

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)