Advanced Photon Source

Slides:



Advertisements
Similar presentations
Subprogram Control - Data sharing Mechanisms to exchange data Arguments - data objects sent to a subprogram to be processed. Obtained through  parameters.
Advertisements

AreaDetector: A module for EPICS area detector support New developments Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
 2006 Pearson Education, Inc. All rights reserved Introduction to Classes and Objects.
Honors Compilers Addressing of Local Variables Mar 19 th, 2002.
Server Architecture Models Operating Systems Hebrew University Spring 2004.
Classes and Class Members Chapter 3. 3 Public Interface Contract between class and its clients to fulfill certain responsibilities The client is an object.
AreaDetector: Recent Additions and Future Plans Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
C++ for Engineers and Scientists Second Edition Chapter 6 Modularity Using Functions.
AreaDetector: A module for EPICS area detector support Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
AreaDetector: A module for EPICS area detector support Mark Rivers GeoSoilEnviroCARS, Advanced Photon Source University of Chicago.
Nirmalya Roy School of Electrical Engineering and Computer Science Washington State University Cpt S 122 – Data Structures Classes: A Deeper Look Part.
Internet Software Development Controlling Threads Paul J Krause.
AreaDetector workshop Summary and notes…. Overview iocBuilder File Writer Changes areaDetector driver pattern shared vector Asyn client without an IOC.
Classes. Constructor A constructor is a special method whose purpose is to construct and initialize objects. Constructor name must be the same as the.
Chapter 3 (B) 3.5 – 3.7.  Variables declared in a function definition’s body are known as local variables and can be used only from the line of their.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Concurrency & Dynamic Programming.
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.
Threads. Readings r Silberschatz et al : Chapter 4.
JNI: Java Native Interface(1/32) Real Time Systems LAB. JNI: Java Native Interface October 31, 2001 Kyung-Yim, Kim.
Threads and Thread Synchronization. Introduction In windows the basic unit of execution is the thread. It is the smallest schedulable unit of execution.
Threads Some of these slides were originally made by Dr. Roger deBry. They include text, figures, and information from this class’s textbook, Operating.
CS703 - Advanced Operating Systems
EECE 310: Software Engineering
APPENDIX a WRITING SUBROUTINES IN C
Background on the need for Synchronization
areaDetector: Recent Developments and Future Ideas
OBJECT ORIENTED PROGRAMMING I LECTURE 12 GEORGE KOUTSOGIANNAKIS
Windows Programming Lecture 09.
HDF5 Metadata and Page Buffering
Hashing - Hash Maps and Hash Functions
Object-Oriented Programming & Design Lecture 18 Martin van Bommel
Divisibility Rules Practice 2, 5, or 10?
CS510 Operating System Foundations
Java Review: Reference Types
Memberwise Assignment / Initialization
The dirty secrets of objects
C++ for Engineers and Scientists Second Edition
Java Byte IPC: Part 6-Summary
C Passing arrays to a Function
Realizing Concurrency using Posix Threads (pthreads)
The Active Object Pattern
EPICS areaDetector Architecture
Machine Independent Features
Designing Parallel Algorithms (Synchronization)
Chapter 9 Classes: A Deeper Look, Part 1
The command invocation protocol
Lecture 22 Inheritance Richard Gesick.
Chapter 4 (part 2).
System Structure and Process Model
1. Reaching Definitions Definition d of variable v: a statement d that assigns a value to v. Use of variable v: reference to value of v in an expression.
Introduction to Classes and Objects
Objects with Functions and Arrays
Advanced Photon Source
Dr. Mustafa Cem Kasapbaşı
areaDetector: A module for EPICS area detector support
Realizing Concurrency using Posix Threads (pthreads)
Functions, Return Values, Parameters Getters and Setters
Realizing Concurrency using Posix Threads (pthreads)
Functions, Return Values, Parameters Getters and Setters
Data Structures and Algorithms Introduction to Pointers
NETWORK PROGRAMMING CNET 441
Programming in C Pointers and Arrays.
Chapter 9 Introduction To Classes
Lecture 7: RPC (exercises/questions)
What’s New and What’s Next
“The Little Book on Semaphores” Allen B. Downey
areaDetector: What’s New? Mark Rivers, Univ. of Chicago
More C++ Classes Systems Programming.
CMSC 202 Constructors Version 9/10.
Introduction to Classes and Objects
Presentation transcript:

Advanced Photon Source areaDetector Writing Plugins Mark Rivers University of Chicago Advanced Photon Source

Existing Plugins Plugin Generates new NDArrays Limitations NDPluginROI Yes None NDPluginStats No Centroid, Profiles limited to 2-D mono NDPluginProcess NDPluginTransform 2-D mono or color only NDPluginStdArrays NDPluginOverlay NDPluginROIStat NDPluginColorConvert NDPluginCircularBuff NDPluginFile HDF5, netCDF, Nexus: None JPEG, TIFF, Magick: 2-D mono or color only

Guidelines and Rules for Writing an areaDetector Plugin Plugins will almost always implement the processCallbacks() function. This function will be called with an NDArray pointer each time an NDArray callback occurs. This function will normally call the NDPluginDriver::processCallbacks() base class function, which handles tasks common to all plugins, including callbacks with information about the array, etc. Plugins will generally implement one or more of the writeInt32(), writeFloat64() or writeOctet() functions if they need to act immediately on a new value of a parameter. For many parameters it is normally sufficient to simply have them written to the parameter library, and not to handle them in the writeXXX() functions. The parameters are then retrieved from the parameter library with the getIntParam(), getDoubleParam(), or getStringParam() function calls when they are needed. If the writeInt32(), writeFloat64() or writeOctet() functions are implemented they must call the base class function for parameters that they do not handle and whose parameter index value is less than the first parameter of this class, i.e. parameters that belong to a base class.

Guidelines and Rules for Writing an areaDetector Plugin Plugins will need to call the createParam() function in their constructor if they have additional parameters beyond those in the asynPortDriver or NDPluginDriver base classes. Plugins may never modify the NDArray that they receive in the processCallbacks() function. The reason is that other plugins may be concurrently operating on the same NDArray, since each is passed the same pointer. This means also that when getting the attributes for this plugin that asynNDArrayDriver::getAttributes(pArray->pAttributeList) must not be called with the NDArray passed to processCallbacks(), because that will modify the NDArray attribute list, and hence the NDArray that other plugins are operating on. Plugins such as NDPluginROI and NDPluginColorConvert create new NDArrays via NDArrayPool::copy() or NDArrayPool::convert() (which copy the attributes to the new array) and then call getAttributes(pArray->pAttributeList) with the new array. The NDPluginFile makes a copy of the attribute list from the original NDArray before calling getAttributes(), but does not need to make a copy of the NDArray because it does not modify it.

Guidelines and Rules for Writing an areaDetector Plugin Plugins must release their mutex by calling this->unlock() when they do time-consuming operations. If they do not then they will not be able to queue new NDArrays callbacks or obtain new parameter values. Obviously they must not access memory locations that other threads could modify during this time, so they should only access local variables, not class variables (which includes the parameter library). If plugins generate new or modified NDArrays then they must call doCallbacksGenericPointer() so that registered clients can get the values of the new arrays.

Plugin examples Look in detail at 3 plugins NDPluginStdArrays NDPluginROI NDPluginStats