#include <stdint.h>
#include <stdio.h>
Go to the source code of this file.
Namespaces | |
namespace | ioc |
Typedefs | |
typedef uint16_t | count_t |
Variables | |
const count_t | max_count_t = (count_t)(-1) |
This module implements the Input/Output operations with disk for saving and restoring the counts in count buffers of channels. The aim is to allow for the saving the night-time count series in a binary file and for the off-line playback the recorded series of input channel counts to repeat their processing and displaying the output parameters.
The counts from all channels of the device are written in binary format by the utility ioc::write() which returns the start-position address of the written series. This address is saved somewhere else (e.g. in main MASS output file). Then, upon reading that file, the address is fed to ioc::read() which restores the counts from the file in the channel buffers. After this, the processing may go on as if the count data were just received from counters.
The binary count file should be opened with an attribute "a+b" and closed upon completion of reading/writing externally. On error (bad input address for ioc::read() or low-level I/O problem), the error is set by utilities to be detected by nr::erget() and nr::ermessage().
The buffers are made of the type count_t which should be specified externally. All the bytes of count numbers are written to the disk. Thus, the two-byte unsigned or signed integers are seemed to be best suited for MASS, for which we do in this module:
#include <stdint.h> // or <sys/types.h> ... typedef count_t uint16_t ; // or int16_t
|
The count type will be unsigned 16-bit integer type |
|
Maximal count_t (implementation works for unsigned integral types) |