C___Programming_with_CORBA.pdf

(1433 KB) Pobierz
CORBA
Page i
C++ Programming with CORBA ®
Andreas Vogel
Bhaskar Vasudevan
Maira Benjamin
Ted Villalba
Page ii
Publisher: Robert Ipsen
Editor: Robert Elliott
Assistant Editor: Pam Sobotka
Managing Editor: Angela Murphy
Electronic Products, Associate Editor: Mike Sosa
Text Design & Composition: North Market Street Graphics
Designations used by companies to distinguish their products are often claimed as trademarks.
In all instances where John Wiley & Sons, Inc., is aware of a claim, the product names appear
in initial capital or ALL CAPITAL LETTERS. Readers, however, should contact the
appropriate companies for more complete information regarding trademarks and registration.
104465692.003.png 104465692.004.png
This book is printed on acid-free paper.
Copyright © 1999 by Andreas Vogel, Bhaskar Vasudevan, Maira Benjamin, Ted Villalba • All
rights reserved.
Published by John Wiley & Sons, Inc.
Published simultaneously in Canada.
No part of this publication may be reproduced, stored in a retrieval system or transmitted in
any form or by any means, electronic, mechanical, photocopying, recording, scanning or
otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright
Act, without either the prior written permission of the Publisher, or authorization through
payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood
Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 750-4744. Requests to the Publisher
for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc.,
605 Third Avenue, New York, NY 10158-0012, (212) 850-6011, fax (212) 850-6008, E-Mail:
PERMREQ @ WILEY.COM.
This publication is designed to provide accurate and authoritative information in regard to the
subject matter covered. It is sold with the understanding that the publisher is not engaged in
professional services. If professional advice or other expert assistance is required, the
services of a competent professional person should be sought.
Library of Congress Cataloging-in-Publication Data:
ISBN 0-471-28306-1
Printed in the United States of America.
10 9 8 7 6 5 4 3 2 1break
Page iii
Contents
Chapter 1
Introduction
1
1 Benefits of C++ Programming with CORBA
1
1.1 What Does CORBA Offer C++ Programmers?
2
1.2 What Does C++ Offer CORBA Programmers?
5
2 C++ Overview
6
104465692.005.png
2 C++ Overview
6
2.1 Objects and Classes
7
2.2 Encapsulation
7
2.3 Modularity and Scoping
8
2.4 Inheritance
8
2.5 Method Overloading
8
2.6 Exceptions
9
2.7 Hello World Example
9
3 Overview of C++ ORBs
11
3.1 Terminology
11
3.2 Clients and Servers as C++ Applications
12
3.3 Clients and Servers Implemented with Non-C++ ORBs
15
4 Building a First C++ ORB Application
17
4.1 Summary of the CORBA Development Process
18
4.2 Environment Setup
19
4.3 Interface Specification
19
4.4 Compiling the IDL
20
4.5 A Client as a C++ Application
21
4.6 Object Implementation
23
4.7 A Server as a C++ Application
24
4.8 Compiling the Server and the Client
26
4.9 Running the Application
27
Chapter 2
CORBA Overview
29
1 The Object Management Group
30
104465692.006.png
1 The Object Management Group
30
1.1 OMG's Goals
30
Page iv
1.2 The Organizational Structure of the OMG
30
1.3 OMG Technology Adoption Process
34
2 The Object Management Architecture
35
2.1 Overview of the OMA
36
2.2 Core Object Model
36
2.3 The Reference Model
41
3 Common Object Request Broker Architecture
44
3.1 Overview
44
3.2 Object Model
46
3.3 ORB Structure
49
3.4 OMG Interface Definition Language (IDL)
52
3.5 ORB and Object Interfaces
63
3.6 Basic Object Adapter
71
3.7 The Portable Object Adapter
75
3.8 Language Mappings
84
3.9 Interoperability
85
3.10 TypeCode, Any, and DynAny
87
3.11 Dynamic Invocation and Dynamic Skeleton Interfaces
92
3.12 Interface Repository
94
104465692.001.png
3.12 Interface Repository
94
Chapter 3
OMG IDL to C++ Mapping
107
1 Mapping Modules
107
2 Mapping Basic DataTypes
108
3 Mapping Strings
109
4 Mapping Constants
111
5 Mapping Enumerations
112
6 Mapping for Structured Types
112
6.1 Mapping for Struct Types
114
6.2 Mapping Union Types
116
6.3 Mapping Sequence Types
118
6.4 Mapping for Arrays
121
6.5 Mapping Typedefs
123
6.6 Mapping the Type Any
124
7 Mapping for the Exception Types
130
8 Mapping Operations and Attributes
131
9 Argument Passing
133
9.1 Examples
136
10 Mapping of Interfaces
163
10.1 Client-Side Mapping
163
10.2 Server-Side Mapping
163
Page v
104465692.002.png
Zgłoś jeśli naruszono regulamin