C++ for System Developers with Design Pattern Introduction: This course introduces the C++ language for use on real time and embedded applications. The first part of the course focuses on the language itself, highlighting areas of concern for real-time and embedded development. The latter part covers the application of C++ to real-time systems including interrupt handling and concurrency issues. If a C++ course does not cover these fundamental issues you may find you still have a lot to learn after the training. Attendees perform hands on Advance programming, on Linux and GC++ for the labs. Approximately 50% of the course is given over to practical work. Course Overview: C++ is not used generally for embedded projects, until recently most C++ cross compilers were actually Embedded C++ (EC++) compilers or were typically inefficient in the more advanced areas of the language. To date, a high proportion of programmers using C++ for embedded development have either been unable or have chosen not to use certain features of C++ due to fear of bloated, slow code with poor performance. Pre-requisites: Experience of programming with C++ or C Programming Duration: 5 Days Embedded C++ Why Embedded C++ was developed Embedded C++ features Introduction to Object Oriented Principles Introduction to the key characteristics of object oriented software development
Why object oriented techniques can improve the real time software development process Introduction to Classes Classes, class instances, methods, constructors and destructors How to structure code separating interface from implementation C++ stream I/O Inheritance Using inheritance to build class hierarchies Dynamic binding for class methods, virtual functions C++ dynamic memory allocation Polymorphism Functions and Operators References Class defined conversions Overloading and function selection Friend functions Overloading operators unary operator overloading binary operator overloading Dynamic memory allocation revisited Assignment Copy constructors Class Members Singleton Classes Virtual Functions Internals Dual Dispatching Casting Internals
Object Slicing Virtual Inheritance Exception Handling What are exceptions Throwing an exception The try block Catching an exception Rethrowing exceptions Catch all handlers Exception specifications Exceptions models and Overheads Runtime type identification Introduction Structure Of This Chapter Making Do Without RTTI RTTI constituents The Cost of Runtime Type Information Templates: Introduce parameterised types and functions: Function templates Class templates Performance implications The Standard Library: Introduction to the Standard Library. Template with friend, inheritance Optimizing code: Introduction Before Optimizing Your Software Declaration Placement Inline Functions
Optimizing Memory Usage Speed Optimizations A Last Resort Software Structuring How large scale software systems may be structured Separate implementation from interface header files Dealing with name conflicts Linking with other languages Real-Time Specifics Introduce the low level facilities of C++ including: Accessing hardware Manipulating information at the bit level Synchronizing I/O with CPU via Polling Interrupts Examine Runtime Application's memory layout Code Segment Data Segment Stack, Heap, BSS, data CPU Registers Static link library v/s Dynamic link library Object Initialization & Cleanup Compiler Synthesized Constructor & Destructor Deep copy v/s Shallow copy explicit constructor Copy Constructor v/s Assignment operator Initialization v/s Assignment Order of Initialization Dynamic Memory Management Types of Storage
POD (Plain Old Data) and non-pod Objects The Lifetime of a POD Object The Lifetime of a non-pod Object Allocation and De allocation Functions malloc() and free() Versus new and delete Exceptions during Object Construction Alignment Considerations The Size Of A Complete Object Can Never Be Zero Overloading new and delete in a Class Guidelines for Effective Memory Usage Explicit Initializations of POD Object Data Pointers Versus Function Pointers The const and volatile Properties of an Object Interrupt Programming Introduction to writing Interrupt Service Routines in C++ Functional approach Class approach Target Specific Considerations Data types Language features affecting portability Non-standard C++ language features Assembly language interfacing Designing ROMable objects Concurrency Concurrency Scheduling strategies Sharing resources in multi-tasking systems Synchronizing tasks Transferring data between tasks Signal Handling in C++ Exceptions
Day 5 Design Patterns Creational Patterns: Abstract Factory, Builder, Factory Type, Prototype, Singleton Structural Patterns: Adapter, Bridge, Composite, Decorator, Façade Flyweight, Proxy Behavioral Patterns : Chain of Resp, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template Method, Visitor.