Dr. Miro Samek is the founder and president of Quantum Leaps, an open source company providing lightweight, state machine-based, event-driven application frameworks for embedded systems. He is the author of Practical Statecharts in C/C++ (CMP Books, 2002), has written numerous articles for magazines, including a column for C/C++ Users Journal, is a regular speaker at the Embedded Systems Conferences, and serves on the editorial review board of the Embedded Systems Design magazine. For a number of years, he worked in various Silicon Valley companies as an embedded software architect and before that he worked as an embedded software engineer at GE Medical Systems (now GE Healthcare). Dr. Samek earned his Ph.D. in nuclear physics at GSI (Darmstadt, Germany).
目录
Preface
PART I STATECHARTS
Chapter 1 Whirlwind Tour of Programming with Statecharts
1.1 Why Bother?
1.2 The Traditional Event-Action Paradigm
1.3 State Machines ? A Better Way of Programming
1.3.1 The Time Bomb Example
1.3.2 The Calculator Example
1.5 Object-Oriented Analogy
1.6 The Event-driven Framework
1.6 Summary
Chapter 2 A Crash Course in Statecharts
2.1 The Essence of Finite State Machines
2.2 The Essence of UML Statecharts
2.3 Examples of State Models
2.4 Summary
Chapter 3 Standard State Machine Implementations
3.1 State Machine Interface
3.2 Nested switch Statement
3.3 State Table
3.4 State Design Pattern
3.5 Optimal FSM Implementation
3.6 State Machines and C++ Exception Handling
3.7 Role of Pointer-to-Member Functions
3.8 Implementing Guards, Junctions, and Choice Points
3.9 Implementing Entry and Exit Actions
3.10 Dealing with State Hierarchy
3.11 Summary
Chapter 4 QEP: A Minimal Hierarchical Event Processor
4.1 General Structure of the QEP Event Processor
4.2 An Annotated Example (QHsm)
4.3 QEP Structure
4.3.1 QEP Source Code Structure
4.3.2 Internal Representation of a State Machine
4.3.3 Initialization of a State Machine
4.3.4 Dispatching Events to a FSM
4.3.5 Executing a Transition in a FSM
4.3.6 Dispatching Events to a HSM
4.3.7 Executing a Transition in a HSM
4.3.8 Static Transition Optimization in a HSM
4.4 Porting and Configuring QEP
4.5 Caveats
4.6 Summary
Chapter 5 Implementing State Machines with QEP
5.1 Implementing a HSM with QEP
5.1.1 Step 1: Enumerating Signals
5.1.2 Step 2: Defining Events
5.1.3 Step 3: Defining the QCalc State Machine
5.1.4 Step 4: Declaring the QCalc States
5.1.5 Step 5: Initializing the HSM
5.1.6 Step 6: Implementing the State Handler Functions
5.2 Implementing a FSM with QEP
2.5 Pitfalls to Avoid While Coding State Machines with QEP
2.5.1 Incomplete State Handlers2-37
2.5.2 Confusing Statecharts with Flowcharts2-38
2.5.3 Ill-Formed State Handlers2-39
2.5.4 Suboptimal Signal Granularity2-42
2.5.5 Violating the Run To Completion Semantics2-42
4.6 Summary
Chapter 6 State Patterns
6.1 Ultimate Hook
6.2 Reminder
6.3 Deferred Event
6.4 Orthogonal Component
6.5 Transition to History
6.6 Summary
PART II EVENT-DRIVEN FRAMEWORK
Chapter 7 QF: A Minimal Event-Driven Embedded Framework
7.1 Conventional Approach to Multithreading
7.2 Computing Model of QF
7.3 Annotated Example
7.3.1 The ?Airplane in the Tunnel? Game
7.3.2 The Active Object Design
7.3.3 The Implementation
7.3.4 The Port for ARM Cortex-M3
7.3.5 Testing
7.4 Summary
Chapter 8 Design of QF
8.1 Handling Errors and Exceptional Conditions
8.2 Memory Management
8.3 Mutual Exclusion and Blocking
8.4 Active Objects
8.5 Event Management in QF
8.6 Event Delivery Mechanisms in QF
8.9 Deferring and Recalling Events in QF
8.7 Time Events
8.8 Summary
Chapter 9 Implementation of QF
9.1 Code Organization
9.2 Critical Section in QF
9.3 General QF Policies Enforced by Assertions
9.4 Active Object class
9.5 Native QF Event Queue
9.6 Native QF Memory Pool
9.7 Native QF Priority Set
9.8 Native QF Scheduler
Chapter 10 Porting QF
10.1 QF Porting Guide
10.2 QF on Bare-Metal Targets (the Vanilla Port)
10.3 Using QF with a preemptive Real-Time Kernel (?μC/OS-II)
10.4 QF port to a POSIX-Compliant OS (Linux)
10.5 Summary
Chapter 11 Conclusion
11.2 Rules for Developing Event-Driven Embedded Applications
11.3 Heuristics
11.4 Sizing Event Queues and Event Pools
11.5 System Integration
11.6 Summary of Key Elements
11.7 An Invitation
Appendix A QK: A Single-Stack Preemptive Kernel
A.2 Run-to-Completion Processing
A.3 Synchronous and Asynchronous Preemptions
A.4 Stack Utilization
A.4 Comparison with a Traditional RTOS
A.5 Summary
Appendix B QS: Software Tracing for Event Driven Systems
B.1 Software Tracing Concepts
B.2 Structure of QS Trace Records
B.3 QS Filters
B.4 QS Data Protocol
B.5 QS Trace Buffer
B.6 Configuring and Porting QS
B.7 Summary
Appendix C Inheriting Entire State Models in C++
C.1 Statechart Refinement Example in C++
C.3 Caveats
C.4 Summary
Appendix D Guide to Notation
D.1 Class Diagrams
D.2 Statechart Diagrams
D.3 Sequence Diagrams
D.4 Timing Diagrams
Appendix E CD-ROM
E.1 Source Code Structure
E.2 Installation
E.3 Licensing
E.4 Answers to the Exercises
E.5 QP Reference Guide (Doxygen)
E.6 Resources
Bibliography
Index
网友对Practical UML Statecharts in C/C++, Second Edition: Event-Driven Programming for Embedded Systems的评论
等了很久,第二版仍然没有中文版出版,年初要做个讲座,需要重新写PPT,虽然已经有电子版,但还是买了英文版。
07年买过第一版的中文版,虽然翻译不怎么样,但研读后如醍醐灌顶,惊叹于层次状态机的强大,以及调度内核的简洁高效。对我们这种基于裸片直接开发,不使用操作系统的中小型工业实时控制系统,非常实用。此后大力推广,三年后,公司的所有产品都已经改为量子状态机平台,并推广到了几个朋友所在的公司。徒弟曾经说过,学会状态机之后,不用状态机都不知道怎么写程序了。就是因为设计思想和手段提高了,如果再要写那种无数标志和变量的Main Loop程序,已经无法接受了。
使用UML状态图,顺序图,及其他图来对软件系统建模,可以把系统逻辑架构方面的需求分析的非常清楚,大大减少了开发时间,还易于调试,并提高了健壮性、扩展性、维护性等等。使用量子状态机,手工就可以把图转换为代码,而不需要重量级的工具支持。画图的过程,就是分析理解需求的过程,也是设计过程,同时还完成了部分文档工作,真是一举多得。
第二版比第一版内容增加了很多,第一版以QP 2.x为蓝本,QK,QS,QP-Nano这些内容在第一版书中不存在,且第一版以C++为描述语言,C版也是用一些规则来模拟C++的别扭。第二版针对QP 4.x,增加了QK,QS,QP-Nano(QS和QP-Nano在3.x版本中加入),且直接以C为描"rest":"述语言,也抛弃了模拟C++的做法。而且第二版章节更合理,例子也更有代表性,讲解也更清晰,第6章和第7章分别讲解量子框架的设计思想和具体实现,尽管我已经算是很精通量子状态机,但读后仍然受益匪浅。和传统RTOS不同,QF不再需要Mutes, Semaphore, block等机制支持,开发起来轻松自如,得心应手。<br />现在在新公司,继续推广UML建模设计,基于量子状态机实现,让软件开发人员能跳出全局标志、变量的泥潭,提高设计思想和手段,更短的时间,设计出更可靠稳定的产品。这都要感谢作者的高屋建瓴。"
影印版质量太差,里面的大多代码很模糊,严重影响阅读。不值这个价
买过第一版的中文翻译,翻译得太差了,看不懂。只好买原版的了。
看了一个章节,感觉好多了。
好好一本技术书籍,让国内的翻译给糟蹋了。
三百多,进口原版,printed in the USA,貌似影印,印刷还不如国内,代码严重看不清。还是看电子版吧。
书是好书,但印刷的太差了!好多部分直接看不清字了。500元一本的书就这幅样子、、、确认这是正品吗?
喜欢Practical UML Statecharts in C/C++, Second Edition: Event-Driven Programming for Embedded Systems请与您的朋友分享,由于版权原因,读书人网不提供图书下载服务