Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

spectrodaq client application framework

0.2

Author:
Ron Fox

Eric Kasten (Spectrodaq)

Jason Venema

Introduction

This documentation describes an application framework which simplifies the process of writing clients to spectrodaq, the NSCL data acquisition and distribution system. This set of web pages provides general documenation as well as reference information for this class library.

Getting Started

To write programs under the client application framework you will need to know:
  1. How to subclass the DAQROCNode class.
  2. How to Write a Makefile to build your program.

Writing a subclass of DAQROCNode

DAQROCNode (DAQ Readout Controller Node) is the base class from which all spectrodaq clients are derived.
#include <iostream.h>
#include <spectrodaq.h>
#include <SpectroFramework.h>

class MyClass : public DAQROCNode
{
protected:
  int operator()(int argc, char** pargv);
};

int
MyClass::operator()(int argc, char** pargv)
{
  cout << "Hello World." << endl;
}

MyClass theApp;
is a minimal sample Spectrodaq client which uses the framework.

This example includes the following headers:

The bulk of the program is the definition of a class: MyClass which extends DAQROCNode, definining and implementing the operator() member function. This member function is called when Spectrodaq has initialized and is ready to run application code. The implementation of that function simply puts the message "Hello World" to stdout.

The final line of the example declares an instance of MyClass. This instance is the application object which will actually be run by spectrodaq.

This example shows the general pattern which you must follow to write Spectrodaq clients:

Writing a Makefile for framework programs.

Writing a Makefile to build your application requires:

For the example in the previous section, the resulting Makefile might look like

SPECTRO_FLAGS=$(shell /opt/spectrodaq/bin/spectrodaq-conf --cflags)
SPECTRO_LDFLAGS=$(shell /opt/spectrodaq/bin/spectrodaq-conf --libs)

CXXFLAGS=$(SPECTRO_FLAGS) -I/opt/daq/Include -I/usr/X11/include
LDFLAGS = $(SPECTRO_LDFLAGS) -L /opt/daq/Lib -L/usr/X11/lib \
         -lEventFramework -ltk -ltcl -lm -lXm -lXt

minimal: minimal.o
        g++ -o minimal $< $(LDFLAGS)

minimal.o: minimal.cpp
        g++ -c $< $(CXXFLAGS) -ltcl 
The first four macro definitions group together the compilation and load flags needed by spectrodaq and the framework into two macros CXXFLAGS (compile flags), and LDFLAGS (loader flags).

Two dependencies describe how to build the object from the source, and the executable from the object. Note that it may also be wise to include the -ggdb flag in LDFLAGS so that you can use the gdb debugger.

General concepts.

The following is a list of general concepts which are used by the event framework and should be understood.

Guest event loops including:

  1. Synchronization of guest event loops with other framework code.
  2. Tcl/Tk guest event loops
  3. X11/Xt guest event loops

The Configuration subsystem.


Generated on Thu Jan 6 16:58:34 2005 for Spectrodaq External Event Framework by  doxygen 1.3.9.1