CCReflect has a few interesting features that are quite desirable for DigiPen game projects:
|
|
- Cora Robbins
- 5 years ago
- Views:
Transcription
1 CCReflect v1.0 User Manual Contents Introduction... 2 Features... 2 Dependencies... 2 Compiler Dependencies... 2 Glossary... 2 Type Registration... 3 POD Registration... 3 Non-Pod Registration... 3 External Registration... 4 MetaData Instance... 4 Retrieving Type Information... 4 Serialization... 5 Deserialization... 5 Lua Function Registration... 6 Calling Member Functions from Lua... 6 Send Objects to Lua... 6 VariantFunction... 6 Calling a VariantFunction... 7 Binding a VariantFunction... 7 Run-Time Enumeration Editing... 7 LuaInterface... 7 Enumerations to Lua... 7 Lua Coroutines... 7 Setting an Object s Update as a Coroutine... 8 Zero Seconds Pause... 9 Threads Clocks and Timers... 9 Variant... 9 RefVariant... 9 Contact... 10
2 Introduction Reflection in C++ is a way of storing information available at compile-time. Usually, upon compilation, much information about the compiling code is lost. This information, if accessible during run-time, could be used for some desirable features. Features CCReflect has a few interesting features that are quite desirable for DigiPen game projects: Automated serialization of objects to a text file Automated registration of any C++ function to Lua Automated to Lua functionality for C++ objects Simple to implement generic messaging Generic functor object called VariantFunction o Bindable to object methods and object instances Run-time enumeration editor o Can add and remove C++ enumerations at run-time Enumerations to Lua and back Simple and easy to use Lua coroutine support o Great for running AI routines that can pause and resume Simple threading library with generic functor Threaded clock and timer Variant and RefVariant data type o Generic wrapper around any C++ type, for more generic programming Dependencies CCReflect comes with very little dependencies. Currently there are dependencies on: Lua; my own Containers Library; my own Utility Library. All three dependencies, along with source, are statically linked to the library. Overall CCReflect is self-contained. Compiler Dependencies Current CCReflect has only been compiled on Microsoft Visual Studio 2010 and Any other compiler versions will likely require minimal porting, but I myself will not do any porting. Glossary MetaData POD - Information about information. In general this means information stored by CCReflect about some sort of data type in C++. Also called meta data. - Plain old data type. No constructor, no heap memory. Just some bytes.
3 Type Registration In order for information about a specific type of data in C++ to be known to CCReflect, a small bit of registration code is required. The registration code is designed to look like simple C code. I have already registered most base types, and made a short list of types that come pre-registered with CCReflect: int float double bool char char * unsigned int int * void * std::string std::vector<int> std::vector<float> std::vector<double> std::vector<bool> std::vector<char> std::vector<unsigned int> std::vector<std:string> POD Registration Here is an example of registering some primitive types: NOTE: This macro is intended to be placed within a CPP file. This macro registers meta data information about a POD type. It is important to register POD types with the POD macro for optimization purposes. Non-Pod Registration Registering structures or classes that are not POD types is done like the following: NOTE: This macro is intended to be placed in a CPP file.
4 Registering a type with the DEFINE_META macro allows for reflection of private members. In order to support this feature a small META_DATA macro must be inserted into the public section of your type, like the following is placed within the Clock class: Once these two steps are performed, all initial registration is complete. External Registration To register a non-pod type to which you do not have source code access to the DEFINE_META_EXTERN macro is used: This macro does not allow private member access. MetaData Instance A meta data instance contains all the type information of a registered type, and provides access to interesting functionality. Serialization, to and from Lua, along with other useful methods are all packed into the MetaData class. The next section details how to access a particular MetaData object. Retrieving Type Information Retrieving the meta data of a type is a common task. There are three ways to retrieve this information. The first way is by explicitly saying what the type you re referring to is: The above code retrieves a pointer to the meta data for the type of integer. Another way to retrieve meta data is with an instance of an actual object. CCReflect uses decltype to deduce the type of an expression. Here is an example: The last way to retrieve meta information is by string, as shown here:
5 Serialization Any type can be serialized so long as it is registered within CCReflect. The syntax for serializing a type to a text file is as follows: In the above image o is just an object whose type has been registered within CCReflect. Note that the File class is used for serialization. The File class is my own utility class packaged with CCReflect, and it just a small wrapper around standard C file I/O. Here is a small example of an object serialized to stdout: Here is an example text file of the format for serializing a more complex object: The values are accurate: I was too lazy to set them :) Deserialization Similar to serialization, deserializing an object is done like so: Deserialized objects are returned via RefVariant. Please read the RefVariant section to find out more about the RefVariant. Deserialization of a file starts with the object at the top of the file. To deserialize the next object in the text file call Deserialize again and pass the same file to the Deserialize function. An empty RefVariant is returned if the entire text file has been read.
6 Lua Function Registration Registering a function to be used within Lua requires a single line of code: The REGISTER_FUNCTION macro is used. The first parameter of the REGISTER_FUNCTION macro is the name you wish to use for the function within Lua itself. The second parameter is the actual C++ function you wish to bind to Lua. Please note that binding member functions to Lua is not the same as binding a global function. Calling Member Functions from Lua In order to call a member function of an object from Lua, the first argument of the function call from Lua must be the this pointer. This is how Lua works. Here is an example: The above code uses the Lua colon syntax. The colon passes the cloud object itself as the first parameter to the bound C++ function called SetYVelocity. The actual call to C++ would have the cloud pointer be the first parameter, and 4 as the second. Send Objects to Lua Sending an object to Lua requires a single line of code, assuming the type of the object has been properly registered: In the above image o is the object itself, v is a RefVariant containing o, and L is the Lua state. Note: All objects sent to Lua are sent by a reference pointer! If you send stack memory to Lua it is your fault if that memory is reclaimed by the stack before the next time you access it. VariantFunction CCReflect offers a generic function pointer wrapper called the VariantFunction. The VariantFunction can wrap around any function in C++, and is called with the call operator ( ). This is very useful for setting up your own messaging system, or any other C++ construct that requires generic functor objects (like script binding). Here is an example of how to create a VariantFunction: In the above code the main function is bound. The first parameter is just a string to name the variant function. This is for internal usage, but can also be useful for debugging purposes. If you wish to not have any name just pass a NULL byte.
7 Calling a VariantFunction Any parameter can be passed to the VariantFunction upon call. Please note that the first parameter must be a RefVariant. This RefVariant will contain any return value from the VariantFunction s internal function pointer. The above example passes a temporary RefVariant, I suggest doing this if you know your VariantFunction does not have a return value. Binding a VariantFunction Binding a VariantFunction to a specific object in order to call member functions is done like so: The next time this VariantFunction is called, a this pointer referring to the object o will be used (assuming main is a valid member function of some class or struct). Run-Time Enumeration Editing CCReflect comes packaged with a run-time enumeration editor. Currently the editor is a WIP, but can live-edit C++ enumerations. LuaInterface Packaged within CCReflect comes a simple LuaInterface object. Only a single instance of the LuaInterface can exist. This interface provides access to all things Lua, such as creating your own coroutines, initializing Lua, loading Lua files, and calling functions within Lua. Please see LuaInterface.h for more details. Enumerations to Lua Enumerations can be freely sent to and from Lua. When sending an enumeration to Lua the enumeration is converted to a string. When sending an enumeration from Lua to C++, a much slower string comparison check is currently used to convert to an integral value. I suggest only sending enumerations to Lua from C++. Sending an enumeration to Lua is currently have an API re-write. Lua Coroutines One of the most attractive features of CCReflect is the usage of Lua coroutines. A coroutine in Lua is a function call that can be paused and resumed at will. The entire state of the function that had been called will be saved upon pause, and can be resumed to the previously paused state in perfect condition.
8 This allows for very simple and effective behavioral scripts to be written like so: As you can see, the WaitSeconds function is utilizing coroutine pausing in order to facilitate very readable and powerful script code. Setting an Object s Update as a Coroutine To setup an object s update function inside of Lua, a small LuaScript object needs to be placed within your object like so: When your object is constructed, you should initialize, in the object s constructor, the script like so: The line script.load will actually call the script that had been specified by the scriptname.c_str( ) portion. It is important to structure your coroutines such that the first few lines initialize your object followed by a pause, then a loop. A common setup for update functions with coroutines looks like the following: The first pause is important! This pause will pause your coroutine until it has been resumed. To resume a coroutine simply use this line of code in your object s update function:
9 You do not pass any parameters to resume. In GAM 200 and 250 every single object in our game had C++ update functions with one line of generic code, like above. The only thing that differed from object type to object type was the script s name in Lua. Zero Seconds Pause WaitSeconds performs floating point comparisons every time Resume is called, and will only un-pause the coroutine until that amount of time has passed. This can be unnecessary if you only want to wait for one game frame. Please use coroutine.yield to wait a single frame: Threads Clocks and Timers These are all newer additions to the CCReflect library, and this section will be written shortly. Variant The Variant type in CCReflect is an object that contains some heap memory. This heap memory is of a specific object type. In this way a Variant can contain any type of C++ type within itself. To retrieve the data from within a Variant, some internal typecasting is used. Here is an example: The above code creates a Variant of an integer that holds the value of 10 on the heap. The next line retrieves the internal data through pointer typecasting. RefVariant The RefVariant is the Variant s optimized counterpart. The RefVariant simply refers to another chunk of memory in C++ by pointer. In this sense a RefVariant is simply a generic reference to another object. This is ideal for many situations when the use of a heap-allocating Variant is not acceptable. Here is an example of creating and using a RefVariant: The above code snippet creates a RefVariant referring to the integer x. The next line of code then assigns the value of x to a new integer y.
10 In this way RefVariants are the perfect data type for implementing advanced type-safe and efficient messaging systems. RefVariants are the backbone of all Lua binding and VariantFunction functionality as well. Contact r.gaul at digipen.edu
Introduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationIndex. object lifetimes, and ownership, use after change by an alias errors, use after drop errors, BTreeMap, 309
A Arithmetic operation floating-point arithmetic, 11 12 integer numbers, 9 11 Arrays, 97 copying, 59 60 creation, 48 elements, 48 empty arrays and vectors, 57 58 executable program, 49 expressions, 48
More informationCSCI-1200 Data Structures Fall 2017 Test 1 Solutions
CSCI-1200 Data Structures Fall 2017 Test 1 Solutions 1 Searching for Symbols in ASCII Art [ /24] In this problem we will search a large ASCII Art canvas for matches to a target pattern. For example, given
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationPart XI. Algorithms and Templates. Philip Blakely (LSC) C++ Introduction 314 / 370
Part XI Algorithms and Templates Philip Blakely (LSC) C++ Introduction 314 / 370 STL Algorithms Outline 44 STL Algorithms 45 Templates 46 Summing an array 47 Templated classes Philip Blakely (LSC) C++
More informationFunction Binding. Special thanks to: John Edwards. Randy Gaul
Function Binding Special thanks to: John Edwards Randy Gaul Introspection Generic Variable Function Binding Simple Case Uses Demo Overview Function Binding Introspection Run-time knows little about types
More informationMotivation was to facilitate development of systems software, especially OS development.
A History Lesson C Basics 1 Development of language by Dennis Ritchie at Bell Labs culminated in the C language in 1972. Motivation was to facilitate development of systems software, especially OS development.
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationLectures 5-6: Introduction to C
Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most
More informationLectures 5-6: Introduction to C
Lectures 5-6: Introduction to C Motivation: C is both a high and a low-level language Very useful for systems programming Faster than Java This intro assumes knowledge of Java Focus is on differences Most
More informationObject-Oriented Programming for Scientific Computing
Object-Oriented Programming for Scientific Computing Dynamic Memory Management Ole Klein Interdisciplinary Center for Scientific Computing Heidelberg University ole.klein@iwr.uni-heidelberg.de 2. Mai 2017
More informationINITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS
INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS Pages 792 to 800 Anna Rakitianskaia, University of Pretoria INITIALISING POINTER VARIABLES Pointer variables are declared by putting
More informationC++\CLI. Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017
C++\CLI Jim Fawcett CSE687-OnLine Object Oriented Design Summer 2017 Comparison of Object Models Standard C++ Object Model All objects share a rich memory model: Static, stack, and heap Rich object life-time
More informationC++: Const Function Overloading Constructors and Destructors Enumerations Assertions
C++: Const Function Overloading Constructors and Destructors Enumerations Assertions Const const float pi=3.14159; const int* pheight; // defines pointer to // constant int value cannot be changed // pointer
More informationQuestion No: 1 ( Marks: 1 ) - Please choose one One difference LISP and PROLOG is. AI Puzzle Game All f the given
MUHAMMAD FAISAL MIT 4 th Semester Al-Barq Campus (VGJW01) Gujranwala faisalgrw123@gmail.com MEGA File Solved MCQ s For Final TERM EXAMS CS508- Modern Programming Languages Question No: 1 ( Marks: 1 ) -
More informationCS201 - Introduction to Programming Glossary By
CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with
More informationMARS MIDI Player - Technical Design Document
MARS MIDI Player - Technical Design Document Convert from *.mid to *.luke 1. Get a selection of MIDI files you wish to play 2. Open up MIDI to Text v17.exe and load in the MIDI files you want, making sure
More informationCSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community
CSCI-243 Exam 1 Review February 22, 2015 Presented by the RIT Computer Science Community http://csc.cs.rit.edu History and Evolution of Programming Languages 1. Explain the relationship between machine
More informationPointers II. Class 31
Pointers II Class 31 Compile Time all of the variables we have seen so far have been declared at compile time they are written into the program code you can see by looking at the program how many variables
More informationContents. Chapter 1 Overview of the JavaScript C Engine...1. Chapter 2 JavaScript API Reference...23
Contents Chapter 1 Overview of the JavaScript C Engine...1 Supported Versions of JavaScript...1 How Do You Use the Engine?...2 How Does the Engine Relate to Applications?...2 Building the Engine...6 What
More informationAdvanced Systems Programming
Advanced Systems Programming Introduction to C++ Martin Küttler September 19, 2017 1 / 18 About this presentation This presentation is not about learning programming or every C++ feature. It is a short
More informationC Review. MaxMSP Developers Workshop Summer 2009 CNMAT
C Review MaxMSP Developers Workshop Summer 2009 CNMAT C Syntax Program control (loops, branches): Function calls Math: +, -, *, /, ++, -- Variables, types, structures, assignment Pointers and memory (***
More informationChapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.
Chapter 1 GETTING STARTED SYS-ED/ Computer Education Techniques, Inc. Objectives You will learn: Java platform. Applets and applications. Java programming language: facilities and foundation. Memory management
More informationMultimedia-Programmierung Übung 3
Multimedia-Programmierung Übung 3 Ludwig-Maximilians-Universität München Sommersemester 2016 Ludwig-Maximilians-Universität München Multimedia-Programmierung 1-1 Today Ludwig-Maximilians-Universität München
More informationOutline. 1 About the course
Outline EDAF50 C++ Programming 1. Introduction 1 About the course Sven Gestegård Robertz Computer Science, LTH 2018 2 Presentation of C++ History Introduction Data types and variables 1. Introduction 2/1
More informationIn Java we have the keyword null, which is the value of an uninitialized reference type
+ More on Pointers + Null pointers In Java we have the keyword null, which is the value of an uninitialized reference type In C we sometimes use NULL, but its just a macro for the integer 0 Pointers are
More informationAssumptions. History
Assumptions A Brief Introduction to Java for C++ Programmers: Part 1 ENGI 5895: Software Design Faculty of Engineering & Applied Science Memorial University of Newfoundland You already know C++ You understand
More informationObject-Oriented Principles and Practice / C++
Object-Oriented Principles and Practice / C++ Alice E. Fischer May 13, 2013 OOPP / C++ Lecture 7... 1/27 Construction and Destruction Allocation and Deallocation Move Semantics Template Classes Example:
More informationShort Notes of CS201
#includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system
More informationCS24 Week 4 Lecture 1
CS24 Week 4 Lecture 1 Kyle Dewey Overview Additional use of const in C++ List ADT Array Lists Linked Lists Additional Use of const We ve seen const already in two positions: What is pointed to is constant
More informationChapter 1 Getting Started
Chapter 1 Getting Started The C# class Just like all object oriented programming languages, C# supports the concept of a class. A class is a little like a data structure in that it aggregates different
More informationG Programming Languages - Fall 2012
G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter
More informationArray. Prepared By - Rifat Shahriyar
Java More Details Array 2 Arrays A group of variables containing values that all have the same type Arrays are fixed length entities In Java, arrays are objects, so they are considered reference types
More information[0569] p 0318 garbage
A Pointer is a variable which contains the address of another variable. Declaration syntax: Pointer_type *pointer_name; This declaration will create a pointer of the pointer_name which will point to the
More informationA brief introduction to C programming for Java programmers
A brief introduction to C programming for Java programmers Sven Gestegård Robertz September 2017 There are many similarities between Java and C. The syntax in Java is basically
More informationUnderstand Computer Storage and Data Types
Understand Computer Storage and Data Types Lesson Overview Students will understand computer storage and data types. In this lesson, you will learn: How a computer stores programs and instructions in computer
More informationKurt Schmidt. October 30, 2018
to Structs Dept. of Computer Science, Drexel University October 30, 2018 Array Objectives to Structs Intended audience: Student who has working knowledge of Python To gain some experience with a statically-typed
More informationCommon Misunderstandings from Exam 1 Material
Common Misunderstandings from Exam 1 Material Kyle Dewey Stack and Heap Allocation with Pointers char c = c ; char* p1 = malloc(sizeof(char)); char** p2 = &p1; Where is c allocated? Where is p1 itself
More informationTechnical Support. Phone: Trademarks
USER MANUAL eprosima Proyectos y Sistemas de Mantenimiento SL Ronda del poniente 16 Bajo K 28760 Tres Cantos Madrid Tel: + 34 91 804 34 48 info@eprosima.com www.eprosima.com Trademarks eprosima is a trademark
More informationC Language Programming
Experiment 2 C Language Programming During the infancy years of microprocessor based systems, programs were developed using assemblers and fused into the EPROMs. There used to be no mechanism to find what
More informationAgenda. CSE P 501 Compilers. Java Implementation Overview. JVM Architecture. JVM Runtime Data Areas (1) JVM Data Types. CSE P 501 Su04 T-1
Agenda CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Summer 2004 Java virtual machine architecture.class files Class loading Execution engines Interpreters & JITs various strategies
More informationC and C++ 7. Exceptions Templates. Alan Mycroft
C and C++ 7. Exceptions Templates Alan Mycroft University of Cambridge (heavily based on previous years notes thanks to Alastair Beresford and Andrew Moore) Michaelmas Term 2013 2014 1 / 20 Exceptions
More informationChapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.
hapter 1 INTRODUTION SYS-ED/ OMPUTER EDUATION TEHNIQUES, IN. Objectives You will learn: Java features. Java and its associated components. Features of a Java application and applet. Java data types. Java
More informationSubprogram Concept. COMP3220 Principle of Programming Languages. Zhitao Gong Spring
Subprogram Concept COMP3220 Principle of Programming Languages Zhitao Gong 2016 Spring 1 / 30 Outline Introduction Closure Parameter Passing Summary 2 / 30 Introduction Tow fundamental abstractions process
More informationa data type is Types
Pointers Class 2 a data type is Types Types a data type is a set of values a set of operations defined on those values in C++ (and most languages) there are two flavors of types primitive or fundamental
More informationThis manual is for Libffi, a portable foreign-function interface library. Copyright c 2008, 2010, 2011 Red Hat, Inc. Permission is granted to copy,
Libffi This manual is for Libffi, a portable foreign-function interface library. Copyright c 2008, 2010, 2011 Red Hat, Inc. Permission is granted to copy, distribute and/or modify this document under the
More informationCS 261 Fall C Introduction. Variables, Memory Model, Pointers, and Debugging. Mike Lam, Professor
CS 261 Fall 2017 Mike Lam, Professor C Introduction Variables, Memory Model, Pointers, and Debugging The C Language Systems language originally developed for Unix Imperative, compiled language with static
More informationA506 / C201 Computer Programming II Placement Exam Sample Questions. For each of the following, choose the most appropriate answer (2pts each).
A506 / C201 Computer Programming II Placement Exam Sample Questions For each of the following, choose the most appropriate answer (2pts each). 1. Which of the following functions is causing a temporary
More informationCSE P 501 Compilers. Java Implementation JVMs, JITs &c Hal Perkins Winter /11/ Hal Perkins & UW CSE V-1
CSE P 501 Compilers Java Implementation JVMs, JITs &c Hal Perkins Winter 2008 3/11/2008 2002-08 Hal Perkins & UW CSE V-1 Agenda Java virtual machine architecture.class files Class loading Execution engines
More informationObject-Oriented Programming
iuliana@cs.ubbcluj.ro Babes-Bolyai University 2018 Overview 1 2 3 4 5 6 7 I No beard, no belly, no guru... Ken Thompson (B), Dennis Ritchie (C) - UNIX Bjarne Stroustrup (C++) James Gosling (Java) Figure:
More informationCSC 1600 Memory Layout for Unix Processes"
CSC 16 Memory Layout for Unix Processes" 1 Lecture Goals" Behind the scenes of running a program" Code, executable, and process" Memory layout for UNIX processes, and relationship to C" : code and constant
More information3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.
3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.
More informationCSCI-1200 Data Structures Fall 2018 Lecture 22 Hash Tables, part 2 & Priority Queues, part 1
Review from Lecture 21 CSCI-1200 Data Structures Fall 2018 Lecture 22 Hash Tables, part 2 & Priority Queues, part 1 the single most important data structure known to mankind Hash Tables, Hash Functions,
More informationStructure of Programming Languages Lecture 10
Structure of Programming Languages Lecture 10 CS 6636 4536 Spring 2017 CS 6636 4536 Lecture 10: Classes... 1/23 Spring 2017 1 / 23 Outline 1 1. Types Type Coercion and Conversion Type Classes, Generics,
More informationVector and Free Store (Pointers and Memory Allocation)
DM560 Introduction to Programming in C++ Vector and Free Store (Pointers and Memory Allocation) Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark [Based on slides
More informationData Structure Series
Data Structure Series This series is actually something I started back when I was part of the Sweet.Oblivion staff, but then some things happened and I was no longer able to complete it. So now, after
More informationProcesses. Johan Montelius KTH
Processes Johan Montelius KTH 2017 1 / 47 A process What is a process?... a computation a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other
More informationAIMS Embedded Systems Programming MT 2017
AIMS Embedded Systems Programming MT 2017 Object-Oriented Programming with C++ Daniel Kroening University of Oxford, Computer Science Department Version 1.0, 2014 Outline Classes and Objects Constructors
More informationProfessor Terje Haukaas University of British Columbia, Vancouver C++ Programming
C++ Programming C++ code is essentially a collection of statements terminated by a semicolon, such as (spaces not needed): a = b + c; Most C++ code is organized into header files and cpp files, i.e., C++
More informationA process. the stack
A process Processes Johan Montelius What is a process?... a computation KTH 2017 a program i.e. a sequence of operations a set of data structures a set of registers means to interact with other processes
More informationCSCI 2212: Intermediate Programming / C Review, Chapters 10 and 11
... 1/16 CSCI 2212: Intermediate Programming / C Review, Chapters 10 and 11 Alice E. Fischer February 3, 2016 ... 2/16 Outline Basic Types and Diagrams ... 3/16 Basic Types and Diagrams Types in C C has
More informationNOTE: Answer ANY FOUR of the following 6 sections:
A-PDF MERGER DEMO Philadelphia University Lecturer: Dr. Nadia Y. Yousif Coordinator: Dr. Nadia Y. Yousif Internal Examiner: Dr. Raad Fadhel Examination Paper... Programming Languages Paradigms (750321)
More informationZymkey App Utils: C++
Zymkey App Utils: C++ Generated by Doxygen 1.8.8 Tue Apr 3 2018 07:21:52 Contents 1 Intro 1 2 Hierarchical Index 5 2.1 Class Hierarchy............................................ 5 3 Class Index 7 3.1
More informationProgramming in Lua The Lua Implementation
Programming in Lua The Lua Implementation Fabio Mascarenhas http://www.dcc.ufrj.br/~fabiom/lua Navigating the source The source code for Lua 5.2 is online at http://www.lua.org/source/5.2/ Includes lists
More informationObject Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.
CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java
More informationG52CPP C++ Programming Lecture 7. Dr Jason Atkin
G52CPP C++ Programming Lecture 7 Dr Jason Atkin 1 This lecture classes (and C++ structs) Member functions inline functions 2 Last lecture: predict the sizes 3 #pragma pack(1) #include struct A
More informationProgramming Style and Optimisations - An Overview
Programming Style and Optimisations - An Overview Summary In this lesson we introduce some of the style and optimization features you may find useful to understand as a C++ Programmer. Note however this
More informationQUIZ. What is wrong with this code that uses default arguments?
QUIZ What is wrong with this code that uses default arguments? Solution The value of the default argument should be placed in either declaration or definition, not both! QUIZ What is wrong with this code
More informationStream Computing using Brook+
Stream Computing using Brook+ School of Electrical Engineering and Computer Science University of Central Florida Slides courtesy of P. Bhaniramka Outline Overview of Brook+ Brook+ Software Architecture
More informationC# and Java. C# and Java are both modern object-oriented languages
C# and Java C# and Java are both modern object-oriented languages C# came after Java and so it is more advanced in some ways C# has more functional characteristics (e.g., anonymous functions, closure,
More informationChapter 5 Names, Bindings, Type Checking, and Scopes
Chapter 5 Names, Bindings, Type Checking, and Scopes Names Variables The Concept of Binding Scope and Lifetime Type Checking Referencing Environments Named Constants Names Used for variables, subprograms
More informationOverview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory
SCRIPTING Overview Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Reflection Bindings Serialization Performance, memory Rationale C++ isn't the best choice
More informationJAVA An overview for C++ programmers
JAVA An overview for C++ programmers Wagner Truppel wagner@cs.ucr.edu edu March 1st, 2004 The early history James Gosling, Sun Microsystems Not the usual start for a prog.. language Consumer electronics,
More informationSection 3: File I/O, JSON, Generics. Meghan Cowan
Section 3: File I/O, JSON, Generics Meghan Cowan POSIX Family of standards specified by the IEEE Maintains compatibility across variants of Unix-like OS Defines API and standards for basic I/O: file, terminal
More informationPointers, Dynamic Data, and Reference Types
Pointers, Dynamic Data, and Reference Types Review on Pointers Reference Variables Dynamic Memory Allocation The new operator The delete operator Dynamic Memory Allocation for Arrays 1 C++ Data Types simple
More informationC++ for numerical computing - part 2
C++ for numerical computing - part 2 Rupert Nash r.nash@epcc.ed.ac.uk 1 / 36 Recap 2 / 36 Iterators std::vector data = GetData(n); // C style iteration - fully explicit for (auto i=0; i!= n; ++i)
More informationC The new standard
C++11 - The new standard Lars Kühne Institut für Informatik Lehrstuhl für theoretische Informatik II Friedrich-Schiller-Universität Jena January 16, 2013 Overview A little bit of history: C++ was initially
More informationMemory and Addresses. Pointers in C. Memory is just a sequence of byte-sized storage devices.
Memory and Addresses Memory is just a sequence of byte-sized storage devices. 1 The bytes are assigned numeric addresses, starting with zero, just like the indexing of the cells of an array. It is the
More informationCSC 533: Organization of Programming Languages. Spring 2005
CSC 533: Organization of Programming Languages Spring 2005 Language features and issues variables & bindings data types primitive complex/structured expressions & assignments control structures subprograms
More informationAlgorithms & Data Structures
GATE- 2016-17 Postal Correspondence 1 Algorithms & Data Structures Computer Science & Information Technology (CS) 20 Rank under AIR 100 Postal Correspondence Examination Oriented Theory, Practice Set Key
More informationC Programming. Course Outline. C Programming. Code: MBD101. Duration: 10 Hours. Prerequisites:
C Programming Code: MBD101 Duration: 10 Hours Prerequisites: You are a computer science Professional/ graduate student You can execute Linux/UNIX commands You know how to use a text-editing tool You should
More informationIT 374 C# and Applications/ IT695 C# Data Structures
IT 374 C# and Applications/ IT695 C# Data Structures Module 2.5: Methods A Deeper Look Xianrong (Shawn) Zheng Spring 2017 1 Outline static Methods, static Variables, and Class Math Methods with Multiple
More informationCPSC 3740 Programming Languages University of Lethbridge. Data Types
Data Types A data type defines a collection of data values and a set of predefined operations on those values Some languages allow user to define additional types Useful for error detection through type
More informationIntroduce C# as Object Oriented programming language. Explain, tokens,
Module 2 98 Assignment 1 Introduce C# as Object Oriented programming language. Explain, tokens, lexicals and control flow constructs. 99 The C# Family Tree C Platform Independence C++ Object Orientation
More informationBasic program The following is a basic program in C++; Basic C++ Source Code Compiler Object Code Linker (with libraries) Executable
Basic C++ Overview C++ is a version of the older C programming language. This is a language that is used for a wide variety of applications and which has a mature base of compilers and libraries. C++ is
More informationAppendix B Boost.Python
Financial Modelling in Python By S. Fletcher & C. Gardner 2009 John Wiley & Sons Ltd Appendix B Boost.Python The Boost.Python library provides a framework for seamlessly wrapping C++ classes, functions
More informationPRINCIPLES OF OPERATING SYSTEMS
PRINCIPLES OF OPERATING SYSTEMS Tutorial-1&2: C Review CPSC 457, Spring 2015 May 20-21, 2015 Department of Computer Science, University of Calgary Connecting to your VM Open a terminal (in your linux machine)
More informationOBJECT ORIENTED PROGRAMMING USING C++ CSCI Object Oriented Analysis and Design By Manali Torpe
OBJECT ORIENTED PROGRAMMING USING C++ CSCI 5448- Object Oriented Analysis and Design By Manali Torpe Fundamentals of OOP Class Object Encapsulation Abstraction Inheritance Polymorphism Reusability C++
More informationWhere We Are. Lexical Analysis. Syntax Analysis. IR Generation. IR Optimization. Code Generation. Machine Code. Optimization.
Where We Are Source Code Lexical Analysis Syntax Analysis Semantic Analysis IR Generation IR Optimization Code Generation Optimization Machine Code Where We Are Source Code Lexical Analysis Syntax Analysis
More informationCS 31: Intro to Systems Pointers and Memory. Kevin Webb Swarthmore College October 2, 2018
CS 31: Intro to Systems Pointers and Memory Kevin Webb Swarthmore College October 2, 2018 Overview How to reference the location of a variable in memory Where variables are placed in memory How to make
More informationProgramming refresher and intro to C programming
Applied mechatronics Programming refresher and intro to C programming Sven Gestegård Robertz sven.robertz@cs.lth.se Department of Computer Science, Lund University 2018 Outline 1 C programming intro 2
More informationMemory Management: The Details
Lecture 10 Memory Management: The Details Sizing Up Memory Primitive Data Types Complex Data Types byte: char: short: basic value (8 bits) 1 byte 2 bytes Pointer: platform dependent 4 bytes on 32 bit machine
More informationCS 240 Final Exam Review
CS 240 Final Exam Review Linux I/O redirection Pipelines Standard commands C++ Pointers How to declare How to use Pointer arithmetic new, delete Memory leaks C++ Parameter Passing modes value pointer reference
More informationA brief introduction to C++
A brief introduction to C++ Rupert Nash r.nash@epcc.ed.ac.uk 13 June 2018 1 References Bjarne Stroustrup, Programming: Principles and Practice Using C++ (2nd Ed.). Assumes very little but it s long Bjarne
More informationCprE 288 Introduction to Embedded Systems Exam 1 Review. 1
CprE 288 Introduction to Embedded Systems Exam 1 Review http://class.ece.iastate.edu/cpre288 1 Overview of Today s Lecture Announcements Exam 1 Review http://class.ece.iastate.edu/cpre288 2 Announcements
More informationEND TERM EXAMINATION
END TERM EXAMINATION THIRD SEMESTER [BCA] DECEMBER 2007 Paper Code: BCA 209 Subject: Object Oriented Programming Time: 3 hours Maximum Marks: 75 Note: Attempt all questions. Internal choice is indicated.
More informationThe issues. Programming in C++ Common storage modes. Static storage in C++ Session 8 Memory Management
Session 8 Memory Management The issues Dr Christos Kloukinas City, UoL http://staff.city.ac.uk/c.kloukinas/cpp (slides originally produced by Dr Ross Paterson) Programs manipulate data, which must be stored
More informationFunctions in C C Programming and Software Tools
Functions in C C Programming and Software Tools N.C. State Department of Computer Science Functions in C Functions are also called subroutines or procedures One part of a program calls (or invokes the
More informationMPATE-GE 2618: C Programming for Music Technology. Syllabus
MPATE-GE 2618: C Programming for Music Technology Instructor Dr. Schuyler Quackenbush schuyler.quackenbush@nyu.edu Lab Teaching Assistant TBD Description Syllabus MPATE-GE 2618: C Programming for Music
More informationExceptions. CandC++ 7. Exceptions Templates. Throwing exceptions. Conveying information
Exceptions CandC++ 7. Exceptions Templates Stephen Clark University of Cambridge (heavily based on last year s notes (Andrew Moore) with thanks to Alastair R. Beresford and Bjarne Stroustrup) Michaelmas
More information