[PDF] Introduction to the C/C++ to TTCN- 3 mapping





Previous PDF Next PDF



OBJECT ORIENTED PROGRAMMING DIGITAL NOTES

All program code of c can be executed in C++ but converse many not be possible. 4. Function overloading and operator overloading are not possible. 5. Local 



Object Oriented Programming Using C++

The types of the arguments with which the function or operator is called determines which definition will be used. Overloading may be operator overloading or 



Operator Overloading in C++ Questions:

you are using the overloaded definition of the '+' operator. 9. Page 10. While you will find overloaded operators in both C++ and Java you are not allowed to 



Object Oriented Programming With C++

Operator Overloading and Type Conversions. 7.1. 7.2. 7.3. Introduction. 171. Defining Operator Overloading 172. Overloading Unary Operators 173. 7.4 Overloading 



Object Oriented Programmimg with C++

- Operator Overloading - Overloading unary and binary operators – Overloading Using Friend functions – manipulation of Strings using Operators. Page 4. UNIT 



OPERATOR OVERLOADING

use with user-defined types. • Operators usually refer to C++ predefined operators: o arithmetic operators: + -



Object Oriented Programmimg with C++

- Operator Overloading - Overloading unary and binary operators – Overloading Using Friend functions – manipulation of Strings using Operators. Page 4. UNIT 



Pointer Dereferencing vs. Conversion Operators

If both operators are overloaded then the dereferencing operator has higher precedence. http://uvsc.freshsources.com/Operator_Overloading.ppt. Example Code.



COMPILER DESIGN LECTURE NOTES Bachelor of Technology

conversions Overloading of functions and operators



B.Sc COMPUTER SCIENCE

Making short presentations – Formal presentation with PPT analytical C++ streams



Lecture Topics • overloading – pitfalls of overloading & conversions

11 ????. 2010 ?. when overriding default memory management. • include C++ standard header. • #include <new>. • overloading operator new.



Object Oriented Programming Using C++

Lecture 22 & 23: Operator Overloading. Lecture 24: Type Conversion. Lecture 25: Class to Basic type. Lecture 26: Inheritance. Lecture 27:.



OPERATOR OVERLOADING

use with user-defined types. • Operators usually refer to C++ predefined operators: o arithmetic operators: + -



OBJECT ORIENTED PROGRAMMING DIGITAL NOTES

All program code of c can be executed in C++ but converse many not be possible. 4. Function overloading and operator overloading are not possible. 5. Local 



Operator Overloading in C++ Questions:

While you will find overloaded operators in both C++ and Java you are not allowed to create your own operator overloadings in Java.



Introduction to the C/C++ to TTCN- 3 mapping

T3UC2006.ppt / / ANy. Known problematic issues. Does NOT have. • Object-oriented concepts. • Overloading. • Generic constructs eq. C++ templates Java.



Operator Overloading in C++

Operator overloading function can be made friend function if it needs access to the private and protected members of class.



Object-Oriented Programming in C++ Fourth Edition

Operator Overloading 319. 9. Inheritance 371. 10. Pointers 429. 11. Virtual Functions 503. 12. Streams and Files 567. 13. Multifile Programs 633.



PDF File

Write a C++ program to read and display information about employees and managers. One special feature offered by C++ is operator overloading.



C++ Vectors Lists and Language Features - 2501ICT Nathan

C++ Language Features. Templates. Namespaces and Operator Overloading. René Hexel and Joel Fenwick. C++ Vectors Lists and Language Features 



Introduction to C++ Operator Overloading - Computer Action Team

Overloading operators as non-member functions is like defining regular C++ functions Since they are not part of a class' definition they can only access the public members Because of this non-member overloaded operators are often declared to be friends of the class



What is Overloading in C++ With Example?

Second operator overloading enables your code to interact correctly with template and library code For example you can overload the



[PPT] Operator Overloading

To use an operator on a class object it must be overloaded unless the assignment operator(=)or the address C++ Operators that cannot be overloaded



Operator Overloading - SlideShare

22 juil 2014 · Operator overloading • We can overload all C++ operator except the following: – Class member access operator (



[PPT] Chapter 8 - Operator Overloading

Two overloaded subscript operators for const and non-const objects 2003 Prentice Hall Inc All rights reserved Outline 42 string1 cpp (1 of 8)



[PPT] Operator Overloading

This chapter shows how to enable C++'s operators to work with objects—a process called operator overloading One example of an overloaded operator built into 



Operator Overloading - ppt download - SlidePlayer

Introduction Operator overloading Enabling C++'s operators to work with class objects Using traditional operators with user-defined objects Requires great 



Operator Overloading PDF Software Engineering - Scribd

Operator Overloading ppt - Free download as Powerpoint Presentation ( ppt / pptx) PDF File ( pdf ) C++ has the ability to provide the operator



(PPT) Function overloading(C++) - DOKUMENTIPS

Text of Function overloading(C++) Page 1 Page 1: Function overloading(C++) FUNCTIONOVERLOADING 1 Ritika sharma Page 2



Operator Overloading in C++ PowerPoint Presentation free download

Global Functions Overloading Stream Insertion and Stream Extraction Operators 2 Operator Overloading Uploaded on Jun 08 2012 Wilford Killian; + Follow



[PDF] 178 Object Oriented Programming using C++

We have already seen the meaning and uses of many such operators in previous lesson One special feature offered by C++ is operator overloading This feature is 



[PDF] OPERATOR OVERLOADING

use with user-defined types • Operators usually refer to C++ predefined operators: o arithmetic operators: + - * / o relational operators:

How to overload an operator in C++?

    The following is an example of how you can overload an assignment operator in C++. You can overload the function call operator on any object in the class. When you overload the function operator, you create a new way to call the function and create a new operator function using which you can pass numerous arbitrary parameters.

How to overload a binary operator for user-defined types?

    Here, + is a binary operator that works on the operands num and 9. When we overload the binary operator for user-defined types by using the code: The operator function is called using the obj1 object and obj2 is passed as an argument to the function. Instead of this, we also could have written this function like:

How many times can a function call operator be overloaded?

    In fact, the function call operator may be overloaded several times within the same scope with a different number (and/or type) of arguments. ?It is useful for accessing elements from a multi- dimensional array: matrix (row, col) where the [] operator cannot help out as it takes 2 operands always, never 3!

What operators can be used in prefix and postfix form?

    ?Two other operators that are useful are the increment and decrement operators (++ and --). ?Remember these operators can be used in both the prefix and postfix form, and have very different meanings. ?In the prefix form, the residual value is the post incremented or post decremented value.
1

Introduction to the C/C++ to TTCN-

3 mapping

(VTT/Oulu)

TTCN-3 User Conference

Berlin, 31 May-2 June 2006

2 ©2005 Nokia T3UC2006.ppt/ / ANy

Contents

•Background •Approach •Language constructs covered by the mapping •C mappings, "pointer handling" •C++ mappings, "object-orientation" •Conclusions

3 ©2005 Nokia T3UC2006.ppt/ / ANy

Background

•New test domains for TTCN-3 testing; based on procedural and object- oriented programming languages requires a mapping of the language under test in to TTCN-3 •Procedure-based communication can be used for direct interfacing to software modules •Testing can be applied in an earlier phase (unit testing) •One test language for testing of SUTs in different programming languages, same test suite, same test case •Combining traditional TTCN-3 testers with additional direct software interaction, stimulus, mock objects •Controlling/configuring SUTs, preamble/postamble

4 ©2005 Nokia T3UC2006.ppt/ / ANy

The need for a mapping

•Test architecture possibilities, many combinations •Internal interfaces •Many programming languages •Callable interface needs to be represented in TTCN-3 •Functions •Types •Mapping must provide same operational semantics as mapped language

SUTSUTTTCN-3 Tester

ABA) Control/

configuration/ interaction

B) Traditional

protocol testing

C++C++

JavaJava

SUTSUTTTCN-3

TesterTTCN-3

Tester

C E

DC) C++ interface,

mock object/ stimulus

D) Java interface,

mock object/ stimulus

E) Test case

interaction

5 ©2005 Nokia T3UC2006.ppt/ / ANy

Historical background

•Two independent projects at Nokia/Helsinki and VTT/Oulu. Outcomewas a combined mapping proposal, C/C++ to TTCN-3. •Test system architectures to verify mappings with where based onremote SUT, remote SA and a 'tight"IUT, all had different ways of handling memory access. •Procedure-based communication had not been frequently used. Immature TTCN-3 tools and non-existing or unsatisfying test system components.

TTCN-3 TesterTTCN-3 Tester

IUTIUT

SATRI

TTCN-3 TesterTTCN-3 Tester

SUTSUT

SATRI

TTCN-3 TesterTTCN-3 Tester

Remote SATRI

IUTIUT

SA

6 ©2005 Nokia T3UC2006.ppt/ / ANy

Choice of mapping languages

•C and C++ is together the largest preferred programming language in the world, ~28% www.tiobe.com/tpci.htm) •C / C++ suitable for software module testing/mapping exploration; strong typing,

OO-language, pointers

•C++ does not impose a single rooted inheritance hierarchy •Neither C or C++ can be mapped in full in an un-ambiguous way

7 ©2005 Nokia T3UC2006.ppt/ / ANy

Known problematic issues

Does NOThave

•Object-oriented concepts •Overloading •Generic constructs eq.

C++ templates, Java

generics •Inheritance •Polymorphism •Templates •Standard library items string, vector •Mapping input •Pointers int* •Pointer arithmetic ptr++ •Variadicfunctions printf( constchar *FORMAT, ... ) •Type casting int*)shortPtr •Address of value ( &)TTCN-3C/C++C++

8 ©2005 Nokia T3UC2006.ppt/ / ANy

What is covered by the mappings

Covered C/C++

•Built-in types, structured types •Enumerated types •Functions (inline, extern, volatile) •Global variables •Pointer types •Dereferencing/address of variable •Typedef

Covered C++

•Encapsulation •Inheritance •Polymorphism •Operators •References •Proposed mappings/Normative (C/C++) •Variadicparameter lists •Templates •Preprocessor directives •Not covered •Address of variable of built-in types •Type casting, built in types •Access specifiers

9 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping input

•Preferred mapping input complete translation unit i.e. preprocessed source file •Does not necessarily only have to be a preprocessed source file •Macro definitions ( #defineMAX_SZ 1024, #defineKEY "myKey") •Items looked for in the source code are items of the interface under test and additional items useful for test suite implementations •Functions •Type definitions •Enumerated types •Global variables

10 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping examples

•Pointers int* intPtr; •Address of variable void* ptr= &myObject; •Encapsulation classA {/* attributes & methods */}; •Inheritance classB: publicA {/*...*/};

11 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C/C++ to TTCN-3

•Majority of the types can be mapped in a rather straight forwardmanner •int->integer •float->float •struct->record •class->module •function->signature //intadd( intx, inty ); typeintegerCInt( c_CIntMin.. c_CIntMax); signatureadd( in CIntx, in CInty ) return CInt; pt_pb.call( add:{ 2,3 }, C_TIMEOUT ) { [] pt_pb. getreply( add:? value5 ) { setverdict( pass); } [] pt_pb. catch( timeout) { setverdict( fail); }

12 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C to TTCN-3 (pointers)

•Usefulness of an address to a memory location (!NULL)? •Minimally needed functionality, allocate, initialize, write, read, release •Pointer arithmetic •Dereferencing, *ptr •Address of variable, &inst // int* type integerCPtr; typeCPtrCIntPtr; type record ofCIntCIntArr;

13 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C to TTCN-3 contd. (pointer handling)

•External functions or signatures, depends on the test architecture •SUT and tester share the same memory space •Multiple SUTs •Both approaches are proposed in the mapping // malloc, set, get, free returnCIntPtr; inCIntArrp_CInts); returnCIntPtr; signature s_SetCInt(inCIntPtrp_Self, inCIntArrp_CInts);

14 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C to TTCN-3 contd. (pointer handling, by

example) // int* ptr= (int*)malloc( sizeof(int)*4 ); // ptr[0]=5;ptr[1]=4;ptr[2]=3;ptr[1]=2; // useIntArr(ptr); // if ( ptr[2]==c_oracle) { ...} varCIntPtrptr; varCIntArrintArr; ptr:= f_MallocCInt(4); // allocate f_SetCInt( ptr, {5,4,3,2} ); // initialize/dereferencing pt.call( s_useIntArr:{ptr}, c_TIMEOUT) { // use/write [] pt.getreply( s_useIntArr:? ) {} [] pt. catch( timeout) {} pt. call( s_GetCInt:{ptr,4}, c_TIMEOUT) { // read [] pt.getreply( s_GetCInt:? ) -> valueintArr{ /* if(ptr[2]...*/}

15 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C to TTCN-3 contd. (address of

variable/object) •Getting address of variable/object using operator & (not for built-in types) // structMyStructobj= retObject();// useObject( &obj); typerecordMyStruct{CPtrm_thisoptional, // instead of operator &// attributes ... }typeCPtrCMyStructPtr;signatureretObject() returnMyStruct;signatureuseObject( inCMyStructPtrptr);

varMyStructobj;pt.call( retObject:{}, c_TIMEOUT) { [] pt.getreply( retObject:? ) -> valueobj{...} // ...}if( obj.m_this!= omit) {pt.call( useObject:{ obj.m_this}, 2.0 ) {...} // operator &}

16 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C++ to TTCN-3 (encapsulation)

•struct, unionand classprovides encapsulation in C++ classMyClass{ // Attributes // Member functions voidMyFunction(); •A moduleprovides encapsulation of mapped attributes and member functions in TTCN-3 moduleMyClass{ typerecordMyClass_t{ // Attributes // Member functions signatureMyFunction( inCppPtrm_this);

17 ©2005 Nokia T3UC2006.ppt/ / ANy

BaseBase

Derived

Derived2

SubClass

Mapping C++ to TTCN-3 contd. (inheritance)

•Inheritance the C++ way

classBase {};classDerived : publicBase {};classDerived2 : publicBase {};classSubClass: publicDerived, Derived2 {};

•Using TTCN-3 import module

CppBase{ typerecordCppBase_t{} }

moduleCppDerived{import fromCppBaseall;typerecordCppDerived_t{CppPtrm_thisoptional,CppBase_tm_base}} moduleCppDerived2 { /* as above*/}

moduleSubClass{import fromCppDerivedall;import fromCppDerived2 all;typerecordCppDerived2_t {CppPtrm_thisoptional,CppDerived_tm_derived,CppDerived2_t m_derived2,}}

18 ©2005 Nokia T3UC2006.ppt/ / ANy

Conclusions

•Approaching new test domains, using the defined mappings we can: •directly interact with software interfaces in their native language, enabling a multitude of test system configurations •combine traditional TTCN-3 testers with direct internal interaction using procedure- based communication •C and C++ are very ambiguous languages and there can be alternative mappings to almost everything •Usage of mappings requires knowledge of mapping background •Usage will require additional tools, code generator C/C++ -> TTCN-3 •Other OO mappings, different approaches might be needed due to the single inheritance tree model of C++ •YES, some testing might be easier using native language of SUT, TTCN-3 adds additional capabilities

19 ©2005 Nokia T3UC2006.ppt/ / ANyQUESTIONS?

20 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C++ to TTCN-3 contd. (inheritance, methods) •Polymorphism, usage of virtual functions classRoot{ voidFunction(); classMySuperClass: Root{ virtualvoidVirtualFunction(); voidMemberFunction(); classMySuperClass2 : Root{ voidMemberFunction(); classMySubClass:

MySuperClass, MySuperClass2 {

virtualvoidVirtualFunction(); voidMyFunction(); •All inheritedmemberfunctionsare overridden moduleCppMySubClass{ signatures_VirtualFunction( inMySubClassPtrp_this); signatures_MyFunction( inMySubClassPtrp_this); // to resolveambiguity signatures_MySuperClass_MemberFunction inMySubClassPtrp_this); signatures_MySuperClass2_MemberFunction inMySubClassPtrp_this); signatures_Root_MySuperClass_Function inMySubClassPtrp_this); signatures_Root_MySuperClass2_Function inMySubClassPtrp_this); // obj.Root::MySuperClass::Function(); pt_pb.call( s_Root_MySuperClass_Function: {CppMySubClass.m_this} ) {

21 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C++ to TTCN-3 contd. (polymorphism,

overloading) voidprint(intvalue); voidprint(constchar* string); voidprint(intvalue, intdef=10); signatures_print_int( inCppIntp_value); signatures_print_constcharptr( inCppCharPtrp_string); signatures_print_int_def( inCppIntp_value); signatures_print_int_defint( inCppIntp_value, inCppIntp_def);

22 ©2005 Nokia T3UC2006.ppt/ / ANy

Mapping C++ to TTCN-3 contd. (polymorphism, virtual) // Base* base = getObj(); // base->print(); moduleBase { importfromCppBuiltInTypesall; signatureprint( inCppPtrm_this); // virtual function moduleDerived { importfromBase all; signatureBase_print( inCppPtrm_this); // Base::print(); signatureprint( inCppPtrm_this); // virtual function varCppPtrobjPtr:= f_getObj(); // polymorphism resolved in SUT pt.call( Derived.print:{objPtr}, 2.0 ) { [] pt. getreply( Derived.print:? ){/*...*/} [] pt. catch( timeout) {}quotesdbs_dbs10.pdfusesText_16
[PDF] operators and expressions in c language

[PDF] operators and precedence in c

[PDF] opers plop

[PDF] opinie o sanatorium marysie?ka cieplice

[PDF] opinion words list

[PDF] opinion writing transition words 2nd grade

[PDF] opinion writing transition words anchor chart

[PDF] öpnv berlin app android

[PDF] opportunities for american airlines swot

[PDF] opportunities of climate change for business

[PDF] opportunities upper intermediate workbook answer key

[PDF] opposite words in english asleep

[PDF] opt mst

[PDF] opt optimum

[PDF] optical rotation of sucrose