The ADTB Library N.Leclercq – J.Malik – INF/ICA. ADTB – What is this? C++ toolbox for TANGO device impl. dependencies: Tango.lib & omnithread.lib dependencies:

Slides:



Advertisements
Similar presentations
Lecture Computer Science I - Martin Hardwick The Programming Process rUse an editor to create a program file (source file). l contains the text of.
Advertisements

The C ++ Language BY Shery khan. The C++ Language Bjarne Stroupstrup, the language’s creator C++ was designed to provide Simula’s facilities for program.
What's new in Microsoft Visual C Preview
Resource management and Synchronization Akos Ledeczi EECE 354, Fall 2010 Vanderbilt University.
C++ Basics Variables, Identifiers, Assignments, Input/Output.
Exception Handling Introduction Exception handling is a mechanism to handle exceptions. Exceptions are error like situations. It is difficult to decide.
Revealing the Man Behind the Curtain Designing a Runtime Library for D.
CS 4800 By Brandon Andrews.  Specifications  Goals  Applications  Design Steps  Testing.
Common mistakes Basic Design Principles David Rabinowitz.
C Programming Basics Lecture 5 Engineering H192 Winter 2005 Lecture 05
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
KEAN UNIVERSITY Visual C++ Dr. K. Shahrabi. Developer studio Is a self-contain environment for creating, compiling, linking and testing windows program.
Introduction to C++ Templates and Exceptions l C++ Function Templates l C++ Class Templates l Exception and Exception Handler.
CS 192 Lecture 3 Winter 2003 December 5, 2003 Dr. Shafay Shamail.
Real-time Systems Lab, Computer Science and Engineering, ASU Linux Input Systems (ESP – Fall 2014) Computer Science & Engineering Department Arizona State.
CS212: Object Oriented Analysis and Design Lecture 6: Friends, Constructor and destructors.
1 Documenting with Javadoc. 2 Motivation  Why document programs? To make it easy to understand, e.g., for reuse and maintenance  What to document? Interface:
1 Cisco Unified Application Environment Developers Conference 2008© 2008 Cisco Systems, Inc. All rights reserved.Cisco Public Introduction to Etch Scott.
Operating Systems Lecture 7 OS Potpourri Adapted from Operating Systems Lecture Notes, Copyright 1997 Martin C. Rinard. Zhiqing Liu School of Software.
Writing a Subsystem Manager Device Server using YAT some feedback about the design and implementation of a system supervisor involving hundreds of heterogeneous.
Best Practices. Contents Bad Practices Good Practices.
Copyright © Curt Hill Generic Classes Template Classes or Container Classes.
Area Detector Drivers Towards A Pattern Jon Thompson.
OSes: 3. OS Structs 1 Operating Systems v Objectives –summarise OSes from several perspectives Certificate Program in Software Development CSE-TC and CSIM,
C# Classes and Inheritance CNS 3260 C#.NET Software Development.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
Writing a Channel Access Client in EPICS Bob Dalesio, April 5, 2000.
RELIABILITY ENGINEERING 28 March 2013 William W. McMillan.
Variables and Data Types.  Variable: Portion of memory for storing a determined value.  Could be numerical, could be character or sequence of characters.
Property interfacing to Hardware: DevIO ACS Development Team.
NetNumen T31 Common Operations. Objectives Master Basic Configurations of T31 Master Common Operations of T31.
Engineering H192 - Computer Programming Gateway Engineering Education Coalition Lect 5P. 1Winter Quarter C Programming Basics Lecture 5.
ICOM 4035 – Data Structures Dr. Manuel Rodríguez Martínez Electrical and Computer Engineering Department.
EPICS Release 3.15 Bob Dalesio May 19, Features for 3.15 Support for large arrays - done for rsrv in 3.14 Channel access priorities - planned to.
How to write a MSGQ Transport (MQT) Overview Nov 29, 2005 Todd Mullanix.
1 Chapter 17 Templates and Exceptions Dale/Weems.
Copyright © GENIVI Alliance 2015
Cs423-cotter1 Windows Operating Environment. cs423-cotter2 Windows Operating Environment 32 bit operating environment – Windows XP Microsoft Visual Studio.net,.net2005,
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
C++ Basics Programming. COMP104 Lecture 5 / Slide 2 Introduction to C++ l C is a programming language developed in the 1970s with the UNIX operating system.
1 Remote Procedure Calls External Data Representation (Ch 19) RPC Concept (Ch 20)
1 CSC 1111 Introduction to Computing using C++ C++ Basics (Part 1)
Fall 2015CISC/CMPE320 - Prof. McLeod1 CISC/CMPE320 Assignment 4 is due Nov. 20 (this Friday). Today: –Templates. –STL –Smart Pointers.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Tuning Threaded Code with Intel® Parallel Amplifier.
CHAPTER 18 C – C++ Section 1: Exceptions. Error Handling with Exceptions Forces you to defend yourself Separates error handling code from the source.
Chapter 2 Objects and Classes
C++ Lesson 1.
Asst.Prof.Dr. Tayfun ÖZGÜR
Variables, Identifiers, Assignments, Input/Output
Data types Data types Basic types
Advanced Topics in Concurrency and Reactive Programming: Asynchronous Programming Majeed Kassis.
Object-Oriented Programming (OOP) Lecture No. 45
Review: Two Programming Paradigms
Object-Orientated Programming
Threads and Cooperation
Reserved Words.
CS212: Object Oriented Analysis and Design
درس برنامه‌سازي کامپيوتر
CS703 - Advanced Operating Systems
Variables, Identifiers, Assignments, Input/Output
Units with – James tedder
Units with – James tedder
Introduction C is a general-purpose, high-level language that was originally developed by Dennis M. Ritchie to develop the UNIX operating system at Bell.
Prof. Bhushan Trivedi Director GLS Institute of Computer Technology
Interrupts Hardware Software.
Combining Compile-Time and Run-Time Components
Programming Language C Language.
CSE 451 Section 1/27/2000.
Presentation transcript:

The ADTB Library N.Leclercq – J.Malik – INF/ICA

ADTB – What is this? C++ toolbox for TANGO device impl. dependencies: Tango.lib & omnithread.lib dependencies: Tango.lib & omnithread.lib but… should be independent but… should be independent Aggregation of software tools recurrent needs >> ! reinvent the wheel recurrent needs >> ! reinvent the wheel code factorization >> maintenance code factorization >> maintenance impl. harmonization >> maintenance impl. harmonization >> maintenance

ADTB – Features Threading support La classe adtb::DeviceTask La classe adtb::DeviceTask a task = a thread + messageQ consumes messages [passive approach] periodic activity and/or stimulated by “external” messages interface… go (size_t tmo_ms) [sync.] [!!! no auto start !!!] go (size_t tmo_ms) [sync.] [!!! no auto start !!!] post (Message * m) [async.] post (Message * m) [async.] wait_msg_handled (Message * m, size_t tmo_ms) [sync.] wait_msg_handled (Message * m, size_t tmo_ms) [sync.] abort (bool join, size_t tmo_ms) [sync.] [!!! self delete !!!] abort (bool join, size_t tmo_ms) [sync.] [!!! self delete !!!]

ADTB – Features Threading support The adtb::Message class The adtb::Message class inherits from adtb::SharedObject a message can be posted to several tasks a message can be posted to several tasks reference counter (release - not delete) reference counter (release - not delete) message has a type [user defined] can carry any kind of data user : msg->attach_data(any_data_type[& ou *]) user : msg->attach_data(any_data_type[& ou *]) task : ExpectedDataType* d = msg- >dettach_data();…; delete msg; task : ExpectedDataType* d = msg- >dettach_data();…; delete msg; hidden generic container + template method hidden generic container + template method runtime error on data extraction [!!! programming error !!!] runtime error on data extraction [!!! programming error !!!] dynamic_cast >> std::bad_cast

ADTB – Feature Threading support go back to adtb::DeviceTask go back to adtb::DeviceTask message handling : predefined messages class MyTask : public adtb::DeviceTask { protected:... void handle_message (const adtb::Message& _msg) throw (Tango::DevFailed) { //- !!! you may be under critical section !!! switch ( _msg.type() ) { //- THREAD_INIT case adtb::THREAD_INIT: //- "initialization" code goes here break; //- THREAD_EXIT case adtb::THREAD_EXIT: //- "release" code goes here break;

ADTB – Feature Threading support go back to adtb::DeviceTask go back to adtb::DeviceTask message handling : periodic & user defined messages //- THREAD_PERIODIC case adtb::THREAD_PERIODIC: //- task's periodic job break; //- USER_DEFINED_MSG case kMY_DOUBLE_MSG: //- get msg data... double * double_value = 0; _msg.dettach_data(double_value); //- do somthing with double_value then... delete double_value; break; } // - switch } // - handle_message }; // class MyTask

ADTB – Feature Threading support The adtb::DeviceMutex class The adtb::DeviceMutex class omni_mutex interface + … int try_lock (DeviceMutexStatus & status); return 0 : ok, locked (status = MTX_LOCKED) return 0 : ok, locked (status = MTX_LOCKED) return -1 : ko, could not be locked (status = MTX_BUSY or MTX_ERROR) return -1 : ko, could not be locked (status = MTX_BUSY or MTX_ERROR) may be helpful to avoid deadlock The adtb::DummyMutex class The adtb::DummyMutex class empty/do nothing impl. of the DeviceMutex interface optional ‘ThreadSafety’ [locking overhead] template class MyClass template class MyClass exemple : galil::HwIO [1 shared connection + 1 private] exemple : galil::HwIO [1 shared connection + 1 private] The adtb::DeviceMutexLock class The adtb::DeviceMutexLock class omni_mutex_lock interface default template arg. = DeviceMutex The adtb::DeviceCondition class The adtb::DeviceCondition class same as omni_condition but… maintains «signaled» state [alarm clock rings before sleeping syndrom] maintains «signaled» state [alarm clock rings before sleeping syndrom] required for DeviceTask impl. required for DeviceTask impl. may not be adapted to any situation >> an other class required? may not be adapted to any situation >> an other class required?

ADTB – Features Bit fields support [adtb::BitsStream] Application fields… Application fields… management of composite data structures in which the data is coded on 1 to 32 bits (*) mostly hardware I/O Principle… Principle… using the provided “user description”, the BitsStream extracts each field, does some byte-swapping (if required) then stores the value into the “explicitly associated” C++ data type Example… Example… (*) could support >32 bits fields

ADTB – Features adtb::BitsStream : struct description BEGIN_BITS_RECORD(BR_MotorState) MEMBER(moving,1, bool); IGNORE_MEMBER(reserved_1, 1, bool); MEMBER(forward_ls, 1, bool); MEMBER(backward_ls, 1, bool); IGNORE_MEMBER(reserved_2, 4, unsigned char); MEMBER(error_code, 8, unsigned char); END_BITS_RECORD(BR_MotorState)

ADTB – Features adtb::BitsStream : data extractor discribes how to extract the data discribes how to extract the data BEGIN_BITS_RECORD_EXTRACTOR(BR_MotorState)EXTRACT_MEMBER(moving);SKIP_BITS(1);EXTRACT_MEMBER(forward_ls);EXTRACT_MEMBER(backward_ls);SKIP_BITS(4);EXTRACT_MEMBER(error_code);END_BITS_RECORD_EXTRACTOR(BR_MotorState)

ADTB – Features adtb::BitsStream : logging… useful for debugging… useful for debugging… BEGIN_BITS_RECORD_DUMP(BR_MotorState)DUMP_MEMBER(moving);DUMP_SKIP_BITS(1);DUMP_MEMBER(forward_ls);DUMP_MEMBER(backward_ls);DUMP_SKIP_BITS(4);DUMP_MEMBER(error_code); END_BITS_RECORD_DUMP(BR_MotorState) END_BITS_RECORD_DUMP (BR_MotorState)

ADTB – Features adtb::BitsStream : class specialization… providing semantically powerful interface providing semantically powerful interface note the () operator note the () operator class MotorState : public BR_MotorState {public: inline bool any_limit_switch_detected () inline bool any_limit_switch_detected () { return this->forward_ls() || this->backward_ls() return this->forward_ls() || this->backward_ls(); }}

ADTB – Features Data buffers… (generic containers) adtb::DataBuffer adtb::DataBuffer template: generic container adtb::SharedBuffer adtb::SharedBuffer : public Buffer, private SharedObject adtb::CircularBuffer adtb::CircularBuffer data historic [ex : post mortem] const adtb::Buffer & ordered_data (void) const

ADTB – Features Other classes… adtb::ThreadSafeDeviceProxy adtb::ThreadSafeDeviceProxy should be provided by the Tango core lib! adtb::ThreadSafeDeviceProxyHelper adtb::ThreadSafeDeviceProxyHelper thread safe version of DeviceProxyHelper adtb::XString adtb::XString bidirectional numeric to string conversion adtb::PluginManager & related classes adtb::PluginManager & related classes provided the basics for plugin support ultimate hardware abstraction behind a Tango dev. Interface ex.: SOLEIL image grabber

ADTB – Features Other classes… adtb::Work & Workers (in progress – 90% done) adtb::Work & Workers (in progress – 90% done) data stream model impl. each node is a Worker having a Work to do uses the adtb::DeviceTask from data propagation

ADTB – Features Other small stuffs… Inline Inline inline control: release but not for debug Developer logging Developer loggingDEBUG_TRACEDEBUG_LOG generates logs in DEBUG mode only

ADTB – Near Future Client socket class platform abstraction platform abstraction Criteria & Filter generic [composite] filters for data treatment generic [composite] filters for data treatment