McStas Readout Master 0.3.3
Loading...
Searching...
No Matches
readout_orig.h
1#ifndef READOUT_WRAPPER
2#define READOUT_WRAPPER
3
4#include <stddef.h>
5#include "readout_structs.h"
6
7#ifdef WIN32
8// Export symbols if compile flags "READOUT_SHARED" and "READOUT_EXPORT" are set on Windows.
9 #ifdef READOUT_SHARED
10 #ifdef READOUT_EXPORT
11 #define RL_API __declspec(dllexport)
12 #else
13 #define RL_API __declspec(dllimport)
14 #endif
15 #else
16 // Disable definition if linking statically.
17 #define RL_API
18 #endif
19#else
20// Disable definition for non-Win32 systems.
21#define RL_API
22#endif
23
24#ifdef __cplusplus
25extern "C" {
26#endif
27
28struct readout;
29typedef struct readout readout_t;
30
31// Create a new Readout object
32// type == 0x34 for BIFROST, 0x41 for He3CSPEC
33RL_API readout_t * readout_create(const char* address, int port, int command_port, double source_frequency, int type);
34
35// Destroy an existing Readout object
36RL_API void readout_destroy(readout_t* r_ptr);
37
38// Add a readout value to the transmission buffer of the Readout object
39// Automatically transmits the packet if it is full.
40RL_API void readout_add(readout_t* r_ptr, uint8_t ring, uint8_t fen, double time_of_flight, double weight, const void* data);
41// Send the current data buffer for the Readout object
42RL_API void readout_send(readout_t* r_ptr);
43// Update the pulse and previous pulse times for the Readout object
44RL_API void readout_setPulseTime(readout_t* r_ptr);
45
46// Initialize a new packet with no readouts for the Readout object
47RL_API void readout_newPacket(readout_t* r_ptr);
48
49// Send the command-port of the Event Formation Unit the exit signal
50RL_API int readout_shutdown(readout_t* r_ptr);
51
52// Set the verbose level of the readout sender to emit nothing to standard output
53RL_API int readout_silent(readout_t* r_ptr);
54// Set the verbose level of the readout sender to emit extra error messages to standard output
55RL_API int readout_print_errors(readout_t* r_ptr);
56// Set the verbose level of the readout sender to emit warnings and extra error messages to standard output
57RL_API int readout_print_warnings(readout_t* r_ptr);
58// Set the verbose level of the readout sender to emit info, warnings and extra error messages to standard output
59RL_API int readout_print_info(readout_t* r_ptr);
60// Set the verbose level of the readout sender to emit extra detail messages to standard output
61RL_API int readout_print_details(readout_t* r_ptr);
62// Set the verbose level from an integer -- look at ReadoutClass.h
63RL_API int readout_verbose(readout_t* r_ptr, int);
64
65// Control file output for the Readout object
66RL_API void readout_dump_to(readout_t * r_ptr, const char * filename);
67
68// Combine multiple files into one for the Readout object -- each should have come from an equivalent Readout object
69RL_API void readout_merge_files(const char * out_filename, const char ** in_filenames, size_t count);
70
71// Allow disabling and enabling network communication (on by default)
72RL_API void readout_disable_network(readout_t * r_ptr);
73RL_API void readout_enable_network(readout_t * r_ptr);
74
75// Set the random seed for the readout random object
76RL_API void readout_rand_seed01(readout_t * r_ptr, double seed);
77RL_API void readout_rand_seed(readout_t * r_ptr, uint32_t seed);
78// Convert a probability to a discrete number of events
79RL_API int readout_rand_poisson(readout_t * r_ptr, double mean);
80
81#ifdef __cplusplus
82}
83#endif
84
85#endif