libdas2
das2 core C utilities
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
processor.h
Go to the documentation of this file.
1 /* Copyright (C) 2015-2017 Chris Piker <chris-piker@uiowa.edu>
2  *
3  * This file is part of libdas2, the Core Das2 C Library.
4  *
5  * Libdas2 is free software; you can redistribute it and/or modify it under
6  * the terms of the GNU Lesser General Public License version 2.1 as published
7  * by the Free Software Foundation.
8  *
9  * Libdas2 is distributed in the hope that it will be useful, but WITHOUT ANY
10  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public License
15  * version 2.1 along with libdas2; if not, see <http://www.gnu.org/licenses/>.
16  */
17 
24 #ifndef _das_processor_h_
25 #define _das_processor_h_
26 
27 #include <das2/stream.h>
28 #include <das2/oob.h>
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 
41 typedef DasErrCode (*StreamDescHandler)(StreamDesc* sd, void* ud);
42 
50 typedef DasErrCode (*PktDescHandler)(StreamDesc* sd, PktDesc* pd, void* ud);
51 
60 typedef DasErrCode (*PktRedefHandler)(StreamDesc* sd, PktDesc* pd, void* ud);
61 
67 typedef DasErrCode (*PktDataHandler)(PktDesc* pd, void* ud);
68 
75 typedef DasErrCode (*CloseHandler)(StreamDesc* sd, void* ud);
76 
82 typedef DasErrCode (*ExceptionHandler)(OobExcept* se, void* ud);
83 
89 typedef DasErrCode (*CommentHandler)(OobComment* se, void* ud);
90 
91 
96 typedef struct _streamHandler {
102 
107 
111 
115 
121 
134 
138 
142  void* userData;
143 
144 } StreamHandler;
145 
158 void StreamHandler_init(StreamHandler* pThis, void* pUserData);
159 
172 StreamHandler* new_StreamHandler(void* pUserData);
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif /* _das_processor_h_ */
PktRedefHandler pktRedefHandler
Sets the function to be called when a packet ID is about to be re-defined before the old pkt descript...
Definition: processor.h:110
DasErrCode(* PktDataHandler)(PktDesc *pd, void *ud)
Callback function invoked when a data packet is encountered in the input.
Definition: processor.h:67
int DasErrCode
return code type 0 indicates success, negative integer indicates failure
Definition: util.h:117
Defines the &quot;Out of Band&quot; objects in a stream.
Holds information for a single packet type in a Das2 stream.
Definition: packet.h:138
PktDescHandler pktDescHandler
Sets the function to be called when each &lt;packet&gt;&lt;/packet&gt; element is read in.
Definition: processor.h:106
DasErrCode(* PktRedefHandler)(StreamDesc *sd, PktDesc *pd, void *ud)
Definition of the callback function invoked when a packet header is going to be deleted.
Definition: processor.h:60
PktDataHandler pktDataHandler
Sets the function to be called when each data packet is read in.
Definition: processor.h:114
void * userData
An optional User-data pointer that is passed along to all callbacks.
Definition: processor.h:142
Objects representing a Das2 Stream as a whole.
StreamHandler * new_StreamHandler(void *pUserData)
Create a new stream processor with default callbacks.
DasErrCode(* CloseHandler)(StreamDesc *sd, void *ud)
Callback functions that invoked on Stream Close callback function that is called at the end of the st...
Definition: processor.h:75
CommentHandler commentHandler
StreamCommentHandler receives stream annotations.
Definition: processor.h:133
DasErrCode(* ExceptionHandler)(OobExcept *se, void *ud)
Callback functions that handle exceptions.
Definition: processor.h:82
Describes the stream itself, in particular the compression used, current packetDescriptors, etc.
Definition: stream.h:46
void StreamHandler_init(StreamHandler *pThis, void *pUserData)
Initialize a stream processor with default callbacks.
DasErrCode(* CommentHandler)(OobComment *se, void *ud)
Callback functions that handle comments.
Definition: processor.h:89
describes an exception that can live in a stream.
Definition: oob.h:80
describes human-consumable messages that exist on the stream.
Definition: oob.h:134
A set of callbacks used for input and output stream processing.
Definition: processor.h:96
DasErrCode(* PktDescHandler)(StreamDesc *sd, PktDesc *pd, void *ud)
Definition of the callback function invoked when a packet header is encountered in the input...
Definition: processor.h:50
StreamDescHandler streamDescHandler
The function to be called when the stream header is read in.
Definition: processor.h:101
ExceptionHandler exceptionHandler
Sets the function to be called when a stream exception is read in.
Definition: processor.h:120
DasErrCode(* StreamDescHandler)(StreamDesc *sd, void *ud)
Definition of the callback function invoked when a stream header is encountered in the input...
Definition: processor.h:41
CloseHandler closeHandler
Sets the function to be called the reading of the stream is completed.
Definition: processor.h:137