C++ Unleashed
(Publisher: Macmillan Computer Publishing)
Author(s): Jesse Liberty
ISBN: 0672312395
Publication Date: 11/01/98

Introduction
About the Authors

Part I—Object-Oriented Programming
Chapter 1—Object-Oriented Analysis and Design
Building Models
Software Design: The Modeling Language
Software Design: The Process
The Vision
Requirements Analysis
Use Cases
Identify the Actors
Determine the First Use Cases
Create the Domain Model
Generalization
Containment
Association
Establish Scenarios
Establish Guidelines
Interaction Diagrams
Create Packages
Application Analysis
Systems Analysis
Planning Documents
Visualizations
Artifacts
Design
What Are the Classes?
Transformations
Other Transformations
Data Manipulation
Views
Devices
Static Model
CRC Cards
How to Conduct a CRC Session
Focus on Responsibilities
Anthropomorphic and Use-Case Driven
Limitations of CRC Cards
Transforming CRC Cards to UML
Class Relationships
Multiple Inheritance Versus Containment
Discriminators and Powertypes
Dynamic Model
State Transition Diagrams
Super States
Summary
Chapter 2—Implementing Class Design in C++
Translating Class Diagrams into C++
Standard Classes
Template Classes
Utility Classes
Associations
1:1 Associations
N:1 and 1:N Associations
N:N Associations
Aggregations
Generalization
Translating Interaction Diagrams into C++
Implementing Collaboration Diagrams and Sequence Diagrams in C++
Translating State Transition Diagrams into C++
Translating Activity Diagrams into C++
Summary
Chapter 3—Inheritance, Polymorphism, and Code Reuse
Benefits of Inheritance
Object-Oriented Linked Lists
Designing the Linked List
Implementing the Linked List
Abstract Classes
Overriding Pure Virtual Methods
Virtual Destructors
Polymorphism Through Method Overloading
Memory Management
Issues in Overloading Other Operators
Assignment Operator
Overloading the Increment Operators
Virtual Copy Constructors
Multiple Inheritance
Problems in Multiple Inheritance
Multiple Inheritance Versus Containment
Summary

Part II—Implementation Issues
Chapter 4—Memory Management
Memory Management and Pointers
Memory Leaks
Allocating Arrays
Stray, Dangling, and Wild Pointers
const Pointers
const Pointers and const Member Functions
Passing By Reference
Passing a const Pointer
Don’t Return a Reference to an Object That Isn’t in Scope
Pointer, Pointer, Who Has the Pointer?
Pointers and Exceptions
Using Auto Pointers
Copying auto_ptrs
Reference Counting
Counted Rectangles
Summary
Chapter 5—How To Use Frameworks
The Microsoft Foundation Classes
Getting Started
Other Wizards
Gaining Perspective
Application Architecture
Multithreading
Cooperative Versus Preemptive Multithreading
Issues in Preemptive Multithreading
A Brief Case Study
Creating Threads
Using CWinThread Objects
Managing Messages
Managing Windows
The Alternative: Worker Threads
Synchronization
Critical Sections
Mutexes
Events
An Example
Utility Classes
String Manipulation Classes
Time Classes
Documents and Views
Views
Form Views
Getting Started with Form Views
Managing Data
Event-Driven Programming
Radio Buttons
Spin Controls
Property Sheets
Summary
Chapter 6—Standard Template Library Container Classes
Defining and Instantiating Templates
Defining and Instantiating Function Templates
Defining and Instantiating Class Templates
Understanding Sequence Containers
The Vector Container
Constructors
Size and Capacity
Element Access
Iterators
Modifiers
Vector Operations
The List Container
Splice Operations
Front Operations
The sort() and merge() Operations
Operations to Remove Elements
The Deque Container
Understanding Stacks
Understanding Queues
Priority Queues
Understanding Associative Containers
The Map Container
Constructors and Destructor
Sizes
Iterators
Element Access
Insertions and Deletions
Map Operations
The Multimap Container
The Set Container
The Multiset Container
Considering Performance Issues
Using the Standard C++ Library
Designing Element Types
Summary
Chapter 7—STL Iterators and Algorithms
Iterator Classes
Position Within a Container
Types of Iterators In and Out of Containers
Base Iterator Class
Input Iterators
Output Iterators
Forward Iterators
Bidirectional Iterators
Random Access Iterators
Iterator Operations
Standard Iterator Classes
Function Objects
Predicates
Arithmetic Functions
Algorithm Classes
Non-Mutating Sequence Operations
Mutating Sequence Algorithms
Sorting and Related Sequence Operations
Standard Function Compositions
Summary
Chapter 8—Avoiding Name Clashes by Using Namespaces
Functions and Classes Are Resolved by Name
Creating a Namespace
Declaring and Defining Types
Defining Functions Outside a Namespace
Adding New Members
Nesting Namespaces
Using a Namespace
The using Keyword
The using Directive
The using Declaration
The Namespace Alias
The Unnamed Namespace
The Standard Namespace std
Summary
Chapter 9—Manipulating Object Types at Runtime
The typeid() Operator
The type_info Class
The Constructor for the type_info Class
The Comparison Operators
The name() Member Function
The before() Member Function
The typeid() Operator in Constructors and Destructors
Misuses of typeid()
Dynamic Typecasting of Objects
The dynamic_cast() Operator
Using dynamic_cast()
Using dynamic_cast() with Virtual Base Classes
Using dynamic_cast() in Constructors and Destructors
The typeid() Versus the dynamic_cast Operator
Other Cast Operators
The static_cast() Operator
The reinterpret_cast() Operator
When to Use the dynamic_cast(), static_cast(), or reinterpret_cast() Operator
The const_cast() Operator
New Versus Old Typecasting
Summary
Chapter 10—Tuning Application Performance
Inline Functions Outside Class Definitions
Avoid Revealing Implementation Code in Distributed Header Files
Analyzing the Cost of Virtual Functions and Virtual Base Classes
Virtual Functions
Virtual Base Classes
RTTI Trade-Offs
Managing Memory for Temporary Objects
Summary

Part III—Manipulating Data
Chapter 11—Recursion and Recursive Data Structures
What Is Recursion?
Fibonacci Numbers: A Recursive Definition
Stopping the Recursion
Recursive Structures
Traversing a Recursive Structure with a Recursive Function
Recursion Versus Iteration and Tail Recursion
Tail Recursion
Indirect Recursion
Recursion and the Stack
Debugging Recursive Functions
Summary
Chapter 12—Designing Efficient Sorting Methods
Analyzing the Performance of Algorithms
Comparing the Average, Worst, and Best Cases
The Stability of Sorts
Using Additional Storage During Sorting
The Bubble Sort
Analysis of the Bubble Sort
The Insertion Sort
Analysis of the Insertion Sort
The Selection Sort
Analysis of the Selection Sort
The Quick Sort
Analysis of the Quick Sort
The Merge Sort
Analysis of the Merge Sort
The Shell Sort
Analysis of the Shell Sort
The Heap Sort
Analysis of the Heap Sort
Choosing a Sort Method
Generating Test Data
Summary
Chapter 13—Search Algorithms in C++
Linear Searches
Analysis of the Linear Search
Searching a Sorted Array
Pattern Matching
The Brute-Force Algorithm
Explanation of the Brute-Force Algorithm
Analysis of the Brute-Force Algorithm
Pattern Representations
Constructing Finite-State Machines
Graph Algorithms
Depth-First Search
Breadth-First Search
Comparing Depth-First and Breadth-First Searches
Best-First Search
Implementing Graph Objects
Representation of Tic-Tac-Toe
Applying Alpha-Beta Cutoffs
The Traveling Salesman Problem
External Searching
Indexed Sequential Access
Binary Trees
2-3-4 Trees
Summary
Chapter 14—Hashing and Parsing Techniques
Searching Versus Hashing
Hash Functions
Collision Resolution
Linear Rehashing
Nonlinear Rehashing
Load Factor (Alpha)
Chaining
Bucket Addressing
Hashing Character Strings
Open Addressing
Parsing
Parsing Numeric Expressions
Parsing String Expressions
Context-Free Grammar and Parsing
Using Top-Down Parsing to Validate Regular Expressions
Summary

Part IV—Object Persistence And Encryption
Chapter 15—Object Persistence
Creating Storable Objects
Manipulation of Files
What Is a B-Tree?
Writing It To Disk
Caching
Determining How Big Each Page Should Be
Determining How Many Pages Can Be in Memory at Once
Swapping to Disk
Implementing the B-Tree
How It Works
Walking the Code
Searching
Summary
Chapter 16—Relational Databases and Persistence
Basic Concepts of Relational Databases
Architecture of a Relational Database
Restrictions and Considerations
SQL: Defining and Querying the Database
Normalization
Joins
Persisting to a Relational Database
Swizzling with Object Identifiers
Using Blobs
Hiding the Details
Storing Objects Directly
Using Your Database’s API
Accessing ODBC Data Sources
The ODBC Cursor Model
Concurrency Control Using ODBC
Scrolling
Using MFC
Editing
Immediate Updates
Updating the Authors
Adding Records
Next Steps
SQL Statements
Setting Database Characteristics
Summary
Chapter 17—Object Persistence Using Relational Databases
Objects in Oracle8
Object Types
Object References
REFs in Columns
The REF Operator
The DEREF Operator
Collections
Using External Procedures Developed in C++
Mapping UML Diagrams to an Object-Relational Database
Database Design
C++ Generation
The Development Process
C++ Generation
Server Generation
Initialization
Querying an Object
Iterating Collections
Navigating Through Associations
Modifying Persistent Objects
Working with Transactions
Locking
The SQL Interface
The CURSOR Interface for Nested Tables
Accessing the Attributes of Objects
Transaction Control Statements
Case Study: Purchase Order System
System Description
Relational Model
Relationship Between Tables
Chapter 18—Object-Oriented Databases
Overview of ODBMS
The ODMG Standard
A C++ Invoicing Application
Data Persistence
Database Schemas and Schema Capture Tools
Collections
Iterators
Relationships
Unidirectional Relationships
Bidirectional Relationships
Databases and Transactions
ODBMS Technical Issues
Client/Server Architecture
Data Storage and Object Clustering
Data Transfer Granularity
Data Locking Granularity
Summary
Chapter 19—Protecting Applications Using Encryption
A Brief History of Encryption
The Role of the National Bureau of Standards
Understanding Encryption
Codes
Ciphers
Vernam Cipher
Private Key Cryptography
Private Key Algorithms
Mechanics of Secret Key Encryption
Using Exclusive OR (XOR) to Perform Block Encryption
Using Substitution Boxes
Using Expansion Permutation
Using Encryption Rounds
Using Key Distribution Centers
Public Key Cryptography
Ralph Merkle’s Puzzle Technique
Diffie-Hellman Multiuser Cryptographic Techniques
The RSA Technique
Using Pretty Good Privacy (PGP)
Choosing Prime Numbers in PGP
Using Random Numbers in Cryptography
File Encryption Using PGP
Limitations of Cryptography
Legal Restrictions on Cryptography
Cryptographic Attacks
Brute-Force Attack
Cryptanalysis
Hacking a PGP-Encrypted File
Digital Signatures
The Public Key Cryptography Standard (PKCS)
The Digital Signature Standard (DSS)
Nonrepudiation
Commercial Cryptographic Products
Secure Web Clients
Microsoft Internet Explorer
Netscape Communicator/Navigator
Secure Email Clients
Netscape Messenger
Microsoft Outlook and Outlook Express
Qualcomm Eudora and Eudora Light
Secure Desktop Products
RSA SecurPC v2.0
Pretty Good Privacy (PGP) for Personal Privacy 5.0
Symantec’s Norton Your Eyes Only
NSA’s Clipper Chip
Summary

Part V—Distributed Computing Topics
Chapter 20—CORBA
Theory and Justification
The Minimal CORBA Environment
A Framework for Object Technology
IIOP: The Object Glue
How IIOP Moves Data
A Component Model
IDL: The Binding Contract
The IDL Compared to a C++ Class Definition
Inheritance
The Object Request Broker
Object Lifetime
Development Environments
Comparing CORBA Environments
ORB Interoperability
Creating the C++ Client
Generating the StubÔ . .h). 0*0*0*°.°.. ÔŒ
Invoking Methods
The Completed C++ Client Application
Implementing the Server Methods
Loading the BOA into the ORB
Startup and Method Invocation Code
Testing Strategies
Tracing
Monitor and Logging Services
Exception Handling
Remote Debugging
The Naming Service and Interoperability
Interoperable Object Reference (IOR)
Naming Contexts
Interoperability Issues
Performance
ORB Memory Leaks
Granularity of Interface
Passing Object References
Summary
Chapter 21—COM
COM Fundamentals
COM Architecture
Interfaces
The IUnknown Interface
COM Objects
Type Libraries
Other COM Technologies
Memory Management
Connectable Objects
Enumeration
Structured Storage and Object Persistence
Automation
Using COM Objects in C++
Using Raw Interfaces
Using Smart Pointers
Using Type Libraries
Writing COM Objects in C++
Multiple Inheritance
Nested Classes
Using Tear-Off Classes
Summary
Further Reading
Chapter 22—Java and C++
Similarities Between C++ and Java
Comments
Data Types
Primitives Data Types
The char Data Type
The boolean Data Type
The byte Data Type
Reference Data Types
Operators
Control Flow Statements
Differences Between C++ and Java
Memory Management
No Pointers
No Preprocessor
No Destructor
Access Specifiers
Method Parameters
External Functions
Enumerations
Strings
Arrays
Object-Oriented Features of Java
Classes
Interface Classes
Abstract Classes
Member Initialization
The this Keyword
Constructors
The finalize() Method
Inheritance
Multiple Inheritance
Exception Handling
Summary
Index