SCA Framework User’s Guide 2010

  • Published on
    07-Nov-2014

  • View
    51

  • Download
    3

Embed Size (px)

DESCRIPTION

The Simulation Component Architecture, or SCA, is designed to enable the delivery of MSCs simulation technology as reusable software components. With this framework, engineers can develop integrated high-performance computing (HPC) applications more quickly and efficiently, while also making the technology more accessible to MSC clients applications. It also provides a framework that allows clients to build extensions or customizations that can easily be plugged into MSC applications or reuse components that are delivered my MSC.

Transcript

<p>SCA Framework Users Guide 2010</p> <p>CorporateMSC.Software Corporation 2 MacArthur Place Santa Ana, CA 92707 USA Telephone: (800) 345-2078 Fax: (714) 784-4056</p> <p>EuropeMSC.Software GmbH Am Moosfeld 13 81829 Munich, Germany Telephone: (49) (89) 43 19 87 0 Fax: (49) (89) 43 61 71 6</p> <p>Asia PacificMSC.Software Japan Ltd. Shinjuku First West 8F 23-7 Nishi Shinjuku 1-Chome, Shinjyku-Ku Tokyo 160-0023, JAPAN Telephone: (03)-6911-1200 Fax: (03)-6911-1201</p> <p>Worldwide Webwww.mscsoftware.com</p> <p>DisclaimerMSC.Software Corporation reserves the right to make changes in specifications and other information contained in this document without prior notice. The concepts, methods, and examples presented in this text are for illustrative and educational purposes only, and are not intended to be exhaustive or to apply to any particular engineering problem or design. MSC.Software Corporation assumes no liability or responsibility to any person or company for direct or indirect damages resulting from the use of any information contained herein. User Documentation: Copyright 2008 MSC.Software Corporation. Printed in U.S.A. All Rights Reserved. This notice shall be marked on any reproduction of this documentation, in whole or in part. Any reproduction or distribution of this document, in whole or in part, without the prior written consent of MSC.Software Corporation is prohibited. This software may contain certain third-party software that is protected by copyright and licensed from MSC.Software suppliers. MSC, MD, Dytran, Marc, MSC Nastran, MD Nastran, Patran, MD Patran, the MSC.Software corporate logo, and Simulating Reality are trademarks or registered trademarks of the MSC.Software Corporation in the United States and/or other countries. NASTRAN is a registered trademark of NASA. PAMCRASH is a trademark or registered trademark of ESI Group. SAMCEF is a trademark or registered trademark of Samtech SA. LS-DYNA is a trademark or registered trademark of Livermore Software Technology Corporation. All other brand names, product names or trademarks belong to their respective owners. PCGLSS 6.0, Copyright 1992-2005, Computational Applications and System Integration Inc. All rights reserved. PCGLSS 6.0 is licensed from Computational Applications and System Integration Inc.</p> <p>Revision 0. May 11, 2010 MDNA:2010:Z:SCA:Z:DC-USR-PDF</p> <p>ContentsSCA Framework Users Guide (DEV)</p> <p>1</p> <p>IntroductionIntroduction 2 3 Organization of this manual Source Code Examples 4</p> <p>2</p> <p>SCA OverviewIntroduction 6 7 11 Interface Based Programming</p> <p>SCA Interfaces and the IDL language SCA Services 12 13 14 15 16</p> <p>SCA Components 13 What is the SCA Kernel The SCA Framework Language support Platform support Summary 17</p> <p>3</p> <p>A SCA Hello World ApplicationIntroduction 20 Defining the Interfaces 21 Include guard 21 Include declarations 22 Module declarations 22 Interface declarations 23 Defining the Service 24</p> <p>2 SCA Framework Users Guide (DEV)</p> <p>Include guard 24 Include declarations Module declarations Service declaration</p> <p>24 25 25</p> <p>Defining the Component 26 Include guard 26 Include declarations 26 Component declaration 27 Generating the Code Skeletons 28 The genskeleton command 28 Adding the required functionality to the skeletons Implementing the service in C++ 29 Implementing the service in java 30 Implementing the service in C# 31 Implementing the service in visual basic 32 Building the Component 34</p> <p>28</p> <p>Creating a Client for the Service 35 Implementing the Application in C++ 35 Implementing the Application in Java 38 Implementing the Application in C# 39 Implementing the Application in Visual Basic Implementing the Application in Python 43 Intra-language Support Summary 46 45</p> <p>41</p> <p>4</p> <p>The IDL LanguageIntroduction Source Files IDL 49 SDL 49 CDL 49 48 49</p> <p>Lexical Rules 51 Comments 51 Identifiers 51 Keywords 51 Escaped identifiers Literals 52</p> <p>52</p> <p>Contents 3</p> <p>Constant expressions Preprocessing 56</p> <p>55</p> <p>IDL Specification for Interfaces and Types Grammar notation 57 IDL specification 57 Basic IDL Types 58 User-defined Types 62 Template Types 66 Constants 70 74</p> <p>57</p> <p>Modules, Names and Scoping Name lookup rules 74 Qualified names 75 Scoping rules 76 Interfaces and Operations 78 Interface header 78 Interface inheritance specification Interface body 79 Operation declaration 79 Forward declarations 81 Interface inheritance 82 SCAIService interface 83 Exceptions 85 86</p> <p>79</p> <p>SDL Specifications</p> <p>CDL Specifications 89 Service Options 92 SCA Component Declaration Component Options 95 94</p> <p>Using the SCA-IDL Compiler 96 The IDL compiler command 96 Compiler processing modes 97 Location for compiler generated files The genskeleton command 99 Summary 100</p> <p>98</p> <p>4 SCA Framework Users Guide (DEV)</p> <p>5</p> <p>IDL to C++ Language MappingIntroduction 102 104 105 106 107 108 Mapping for Identifiers Mapping for Modules Mapping for Basic Types Mapping for String Types</p> <p>Mapping for Enumerated Types Mapping for Structures Mapping for Arrays 110 Fixed size arrays 110 Dynamic arrays 111 Mapping for Sequences Mapping for Type Aliases Mapping for SCATypeCode 116 119 120 109</p> <p>Mapping for SCAAny 121 The SCAAny class definition 121 Creating new SCAAny values 123 Inserting values into exiting SCAAny values 123 Extracting the value contained in a SCAAny 124 Assigning SCAAny values 124 Interrogating the value contained in a SCAAny 125 Miscellaneous SCAAny methods 125 Special SCAAny methods for Dynamic Arrays 126 Limitations in the SCAAny 126 Mapping for SCAResult 127 SCAResult class definition 127 Creating new SCAResult values 128 Resetting the error code in a SCAResult value 128 Adding parameters to a SCAResult value 128 Interrogating the contents of a SCAResult 129 Miscellaneous SCAResult methods 129 Mapping for Constants 130 132</p> <p>Mapping for Interfaces 131 Mapping for Interface Smart Pointer Definition</p> <p>Contents 5</p> <p>Mapping for Interface Abstract Base Class Definition Mapping for Interface Operations 133 Mapping Interface Operation Parameters 134 Using Smart Pointers 135 Mapping for Exceptions 137 SCAException class 137 SCAUserException class 137 SCASystemException class 138 Mapping for IDL defined user exceptions 138 Special Rules for using SCA Exceptions in C++ Mapping for SCA Services 141 The inheritance form of implementation The ServiceAccess interface 145 The delegation form of implementation Singleton Services 148 Aggregation 149 Mapping for SCA Components Embedded Components 150 150 142 147</p> <p>133</p> <p>139</p> <p>6</p> <p>IDL to Java Language MappingIntroduction 152 154 155 156 157 Mapping for Identifiers Mapping for Modules Mapping for Basic Types</p> <p>Mapping for Unsigned Data Types Mapping for String Types 158</p> <p>Mapping for Enumerated Types Mapping for Structures Mapping for Arrays 161 Fixed size arrays 161 Dynamic Arrays 163 Mapping for Sequences Mapping for Type Aliases 164 166 160</p> <p>159</p> <p>6 SCA Framework Users Guide (DEV)</p> <p>Mapping for SCATypeCode</p> <p>167</p> <p>Mapping for SCAAny 168 The SCAAny class definition 168 Creating new SCAAny values 169 Inserting values into exiting SCAAny values Extracting the value contained in a SCAAny Miscellaneous SCAAny methods 172</p> <p>170 171</p> <p>Mapping for SCAResult 173 SCAResult class definition 173 Creating new SCAResult values 174 Resetting the error code in a SCAResult value 174 Adding parameters to a SCAResult value 175 Interrogating the contents of a SCAResult 175 Miscellaneous SCAResult methods 175 Mapping for Constants 177 178 178</p> <p>Mapping for Interfaces 178 Mapping for Interface Operations Mapping for Interface Parameters</p> <p>Mapping for Exceptions 180 SCAException interface 180 SCAUserException class 180 SCASystemException class 181 Mapping for IDL defined user exceptions The IDL raises clause 182 Mapping for SCA Services 184 The inheritance form of implementation The ServiceAccess interface 188 The delegation form of implementation Singleton Services 188 Aggregation 188 Mapping for SCA Components Embedded Components 189 SCA Framework / JVM Interaction Java Virtual Machine Initialization The IDLTypes.jar archive 190 189 190 190</p> <p>181</p> <p>185 188</p> <p>Contents 7</p> <p>7</p> <p>IDL to .Net Languages MappingIntroduction 192 194 195 196 198 199 Mapping for Identifiers Mapping for Modules Mapping for Basic Types Mapping for String Types</p> <p>Mapping for Enumerated Types Mapping for Structures Mapping for Arrays 201 Fixed size arrays 201 Dynamic Arrays 202 Mapping for Sequences Mapping for Type Aliases Mapping for SCATypeCode 203 204 205 200</p> <p>Mapping for SCAAny 206 The SCAAny class definition 206 Creating new SCAAny values 207 Inserting values into existing SCAAny value Extracting the value contained in a SCAAny Miscellaneous SCAAny methods 210</p> <p>208 209</p> <p>Mapping for SCAResult 211 SCAResult class definition 211 Creating new SCAResult values 212 Resetting the error code in a SCAResult value 212 Adding parameters to a SCAResult value 213 Interrogating the contents of a SCAResult 213 Miscellaneous SCAResult methods 214 Mapping for Constants 215 216 216</p> <p>Mapping for Interfaces 216 Mapping for Interface Operations Mapping for Interface Parameters Mapping for Exceptions SCAException interface 217 217</p> <p>8 SCA Framework Users Guide (DEV)</p> <p>SCAUserException class 217 SCASystemException class 217 Mapping for IDL defined user exceptions The IDL raises clause 218</p> <p>218</p> <p>Mapping for SCA Services 220 The inheritance form of implementation 221 Implementation for subservice classes 222 Creating instances of subservice classes 223 The ServiceAccess interface 224 The delegation form of implementation 224 Singleton Services 226 Aggregation 226 Mapping for SCA Components Embedded Components 227 227</p> <p>8</p> <p>IDL to Python Language MappingIntroduction 230 232 233 234 237 Mapping for Identifiers Mapping for Modules Mapping for Basic Types</p> <p>Mapping for Enumerated Types Mapping for Structures Mapping for Arrays 240 241 242 243 238</p> <p>Mapping for Sequences Mapping for Type Aliases Mapping for TypeCode</p> <p>Mapping for SCAAny 244 The SCAAny class definition 244 Creating new SCAAny values 245 Inserting values into existing SCAAny values Extracting the value contained in a SCAAny Miscellaneous SCAAny methods 247 Mapping for SCAResult 248 SCAResult class definition 248</p> <p>246 247</p> <p>Contents 9</p> <p>Creating new SCAResult values 249 Resetting the error code in a SCAResult value 249 Adding parameters to a SCAResult value 250 Interrogating the contents of a SCAResult 250 Mapping for Constants 252</p> <p>Mapping for Interfaces 253 Mapping for Interface Operations 253 Special Interface Attributes 253 Mapping for Interface Parameters 254 Use of getInterface in Python 255 Implementing SCA Interfaces 256 Mapping for Exceptions 258 SCAException exception 258 Mapping for other exception types The IDL raises clause 260 Mapping for SCA Services 261 262</p> <p>258</p> <p>Mapping for SCA Components The SCA Module 263</p> <p>Accessing IDL Type Definitions from Python Running Python Scripts 267 Running Scripts with the ScriptBroker Running Scripts from the command line 267 267</p> <p>264</p> <p>9</p> <p>Messages and InternationalizationIntroduction 270 Message Files 271 Locale String 271 Message File Naming Convention File Search Order 271 Message File Format 272 Text Formatting 273 Currency Format ($) 273 Date/Time Format (#) 273 All other Formats (%) 274 Text Translation Service 278</p> <p>271</p> <p>10 SCA Framework Users Guide (DEV)</p> <p>SCA::Framework::SCAITextTranslationFactory Interface 278 SCA::Framework::SCAITextTranslationSettings Interface 279 SCA::Framework::SCAITextTranslationTable Interface 281</p> <p>10</p> <p>Error ProcessingIntroduction 292 Using SCA Exceptions for Error Handling 294 SCA Exception Hierarchy 295 SCA Framework provided Exceptions 295 Exception API 298 Exception Propagation Rules 298 Recommended usage of SCA Exceptions 300 Complete Exception Error Handling Example for a SCA Service Using SCAResult for Error Handling 305 Introduction 305 The SCAResult data contents 306 Overview of using the SCAResult for Error Handling 307 Registering Message Tables 307 Formatting a SCAResult value 308 Complete SCAResult Error Handling Example for a SCA Service Use of SCAResult values in the client 312</p> <p>301</p> <p>310</p> <p>MessageDispatcher Service 316 SCA::Framework::SCAIMsgTableManager Interface 316 SCA::Framework::SCAIMsgListenerManager Interface 318 SCA::Framework::SCAIMessageDispatcher Interface 319 SCA::Framework::SCAIMessageListener Interface 322 Message Listener example using SCAServiceObjectImpl template 324 Message Listener example using a Logger Service Example 325</p> <p>11</p> <p>Multi-Threaded ApplicationsIntroduction 332 333 337 Thread Safety 333 SCA Framework Synchronization Primitives Kernel Thread Safety Configuration Options Threading Infrastructure 338 339</p> <p>Testing Multi-Threaded Services 339 SCA::Framework::SCAIMultiThreadBatchTest Interface Reference</p> <p>Contents 11</p> <p>Sample Multi-Threaded Application</p> <p>341</p> <p>12</p> <p>VersioningIntroduction 350 351 Component Metadata</p> <p>13</p> <p>Configuring and Using the SCA KernelIntroduction 354 355 Initializing and Terminating the Kernel SCA Kernel Initialization API 355 SCA Kernel Termination API 355 Examples of Configuring the SCA Kernel Kernel Configuration Variables Kernel Configuration File 361 Default Configuration File Location 359 363 364 365</p> <p>356</p> <p>Runtime Access to Configuration Variables</p> <p>Changing the Prefix for Environement Variable Names Building Applications using the SCA Kernel Running Applications using the SCA Kernel 366 367</p> <p>The SCA Services Catalog 370 SCASCons Build options for catalog processing 370 Catalog Configuration Options 370 Service Catalog Precedence Rule for Duplicate Entries Sample Service Catalog File 371 Other Configuration Files IDL Type Definitions Files Message Files 372 Language Support Files 372 372 372</p> <p>370</p> <p>Service Manager 373 SCA::Framework::SCAIServiceProvider Interface Reference SCA::Framework::SCAIKernelInfo Interface 374 SCA::Framework::SCAIServiceCatalog Interface 375</p> <p>373</p> <p>12 SCA Framework Users Guide (DEV)</p> <p>Shared Library Manager 377 SCA::Framework::SCAISharedLibraryManager Interface Reference Library loading logic 379 Library Release Queue 380 SharedLibraryManager example 381</p> <p>377</p> <p>14</p> <p>Utility ServicesIntroduction XML Parser 384 385</p> <p>15</p> <p>SCA Utility Program and Testing ComponentsIntroduction 388 The SCA Utility Program 389 Print the help message 389 Testing Kernel Initialization 390 Running a Batch Test 390 Run a Script 390 Test Loading of a Shared Library 390 Query SCA Kernel Information 391 Query Shared Library Build Information</p> <p>391</p> <p>Testing of SCA components 393 SCA::Framework::SCAIBatchTest Interface Reference 393 Running Tests Manual 393 Running Tests with the Build System 394 Setting up Test Aliases 395 Specifying when Tests run by Default 396 Running Test Using a SCA Test Component 396 Testing Using a Program 396 Testing Using Python Script 397 Using a fixup Routine 398 Using the Preprocessor on the Baseline Text 399 Performing Setup and Clean Operations 399 Spe...</p>