Duke CPS 108 13. 1 Problem: commands with state and undo support l How do applications with “undo” options (e.g., formatting in word processors) support.

Slides:



Advertisements
Similar presentations
Introduction to C++ An object-oriented language Unit - 01.
Advertisements

Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 15 Introduction to Rails.
TEMPLATES Lecture Presented By SHERY KHAN Object Orienting Programming.
C/c++ 4 Yeting Ge.
Chapter 3 Loaders and Linkers. Purpose and Function Places object program in memory Linking – Combines 2 or more obj programs Relocation – Allows loading.
Separate compilation Large programs are generally separated into multiple files, e.g. tuples.h, ray.h, ray.c, tuples.c main.c With several files, we can.
Drives, Directories and Files. A computer file is a block of arbitrary information, or resource for storing information. Computer files can be considered.
Binghamton University CS-220 Spring 2015 Binghamton University CS-220 Spring 2015 The CS-220 Development Environment.
VBA Modules, Functions, Variables, and Constants
CS Lecture 03 Outline Sed and awk from previous lecture Writing simple bash script Assignment 1 discussion 1CS 311 Operating SystemsLecture 03.
Copyright © 2008 Pearson Addison-Wesley. All rights reserved. Chapter 12 Separate Compilation Namespaces Simple Make Files (Ignore all class references.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
 2006 Pearson Education, Inc. All rights reserved. Templates (again)CS-2303, C-Term Templates (again) CS-2303 System Programming Concepts (Slides.
Other Features Index and table of contents Macros and VBA.
OOP Languages: Java vs C++
Unit 5 School of Information Systems & Technology1 School of Information Systems and Technology (IST)
Advanced File Processing
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
CCA Port, Component & Application Build Skeleton Templates “A new script toolkit for generating CCA build skeletons” Torsten Wilde and James Kohl Oak Ridge.
July 29, 2003Serguei Mokhov, 1 Makefile Brief Reference COMP 229, 346, 444, 5201 Revision 1.2 Date: July 18, 2004.
Chapter 6 Generating Form Letters, Mailing Labels, and a Directory
chap13 Chapter 13 Programming in the Large.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Introduction Use of makefiles to manage the build process Declarative, imperative and relational rules Environment variables, phony targets, automatic.
The introduction of CMT Version v1r14. General index 1.presentation 2.how to install CMT 3.how to write a requirements file 4.how to use CMT.
Introduction to C Programming CE Lecture 7 Compiler options and makefiles.
Tutorial build Main ideas –Reuse as much previously obtained configuration information as possible: from Babel, cca-spec-babel, etc. –Extract all irrelevant.
Advanced File Processing. 2 Objectives Use the pipe operator to redirect the output of one command to another command Use the grep command to search for.
Chapter Five Advanced File Processing Guide To UNIX Using Linux Fourth Edition Chapter 5 Unix (34 slides)1 CTEC 110.
Copyright 2004 Scott/Jones Publishing Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 7 Structured Data and Classes.
Data Structures Using C++ 2E1 Inheritance An “is-a” relationship –Example: “every employee is a person” Allows new class creation from existing classes.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Command Pattern.
Chapter Five Advanced File Processing. 2 Lesson A Selecting, Manipulating, and Formatting Information.
Chapter 7 Templates. Objectives Introduction Function Templates Class Templates Standard Template Library.
Slide Advanced Programming 2004, based on LY Stefanus's slides Native Methods.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
CPS120: Introduction to Computer Science Compiling a C++ Program From The Command Line.
S11-1 ADM , Section 11, August 2005 Copyright  2005 MSC.Software Corporation SECTION 11 MACROS: OVERVIEW.
Makefiles CARYL RAHN. Separate compilation Large programs are generally separated into multiple files, e.g. main.c addmoney.c removemoney.c money.h With.
Build Tools 1. Building a program for a large project is usually managed by a build tool that controls the various steps involved. These steps may include:
LECTURE 3 Translation. PROCESS MEMORY There are four general areas of memory in a process. The text area contains the instructions for the application.
Linux Tutorial Lesson Two *Getting Help in Linux *Data movement and manipulation *Relative and Absolute path *Processes Note: see chapter 1,2,3 from Linux.
Debugging Lab Antonio Gómez-Iglesias Texas Advanced Computing Center.
김민수 Cortex-M4 Processor - Getting Started with the GNU Compiler Collection(gcc)
C++ How to Program, 7/e.  There are cases in which it’s useful to define classes from which you never intend to instantiate any objects.  Such classes.
Command Pattern. Intent encapsulate a request as an object  can parameterize clients with different requests, queue or log requests, support undoable.
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
Lecture 3 Translation.
COM S 326X Deep C Programming for the 21st Century Prof. Rozier
Automatic Documentation Systems
Prof: Dr. Shu-Ching Chen TA: Hsin-Yu Ha Fall 2015
Compilation and Debugging
Makefiles Caryl Rahn.
Guide To UNIX Using Linux Third Edition
SECTION 3 MACROS: OVERVIEW.
Chapter 14: Protection.
Guide To UNIX Using Linux Third Edition
Packages and Interfaces
Building Web Applications
C Preprocessor(CPP).
Exploring the Power of EPDM Tasks - Working with and Developing Tasks in EPDM By: Marc Young XLM Solutions
Chapter 15 Introduction to Rails.
Templates (again) Professor Hugh C. Lauer CS-2303, System Programming Concepts (Slides include materials from The C Programming Language, 2nd edition,
Overview Unit testing Building Version control.
CSE 303 Concepts and Tools for Software Development
Chapter 11: Inheritance and Composition
Lab 4: Introduction to Scripting
Computer Organization & Compilation Process
C++ Object Oriented 1.
SPL – PS1 Introduction to C++.
Presentation transcript:

Duke CPS Problem: commands with state and undo support l How do applications with “undo” options (e.g., formatting in word processors) support the undo? l How can a command, e.g., load files, find line numbers, be encapsulated into a class/object? l How can commands be combined into macro-commands or command-sequences (e.g., load files, find occurrences of str)? ä use the Command pattern: an abstract class with a receiver that knows how to execute the command and, when necessary, has state to support undo operations ReadCommand rc(myController); rc.execute();  macro command’s execute iterates over all commands in Vector myCommands; ä This is a command that contains commands: Composite

Duke CPS Lots of command classes, what to do? Store command classes in a subdirectory (for the project), then use #include “commands/readcommand.h” l Use templated commands when possible to factor out common, simple commands, e.g., that invoke certain member functions l In small programs, using the Command pattern may not make sense, but it will pay off in larger programs and when porting code to a new language or environment ä often pattern payoff is not immediately apparent, but the rewards wil com

Duke CPS What about libraries? l for both static and dynamic/shared libraries you need to specify where the library is located and what library is used  -L, link/load option, takes directory as “argument” ä -L. -L/afs/acpub/users/o/l/ola/cps108/lib  also specify -lscandir, -ltapestry, these refer to either libscandir.a or libscandir.so (similarly libtapestry.*) ä on Solaris, shared libraries linked by default if they exist, can override with -static option ä what about libiberty.a? You can supply both.a and.so libraries, let the user have an option. Header files must be supplied as well, typically these are in path/lib and path/include directories.

Duke CPS Some Qt info All slot/signal and otherwise Q-able classes must include a macro Q_OBJECT at the top of the class declaration, before public: ä macro/preprocessor flag is changed by CPP, the C-pre- processor (e.g., #define)  any foo.h file with Q_OBJECT needs to be run through MOC to generate a MOCfoo.cc file (or fooMOC.cc ), this is in addition to the normal foo.cc file  the mocdepend.perl script automatically generates the MOCfoo.cc files by grepping for Q_OBJECT l If you have trouble, remove all.o files, especially MOC*.o files and recompile examples in ~ola/cps108/qtlink/examples on acpub