b68a824fbcfc05384fb307c55b090811d7094349
[debian/amanda] / device-src / null-device.h
1 /*
2  * Copyright (c) 2005 Zmanda, Inc.  All Rights Reserved.
3  * 
4  * This library is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU Lesser General Public License version 2.1 as 
6  * published by the Free Software Foundation.
7  * 
8  * This library is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10  * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
11  * License for more details.
12  * 
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this library; if not, write to the Free Software Foundation,
15  * Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA.
16  * 
17  * Contact information: Zmanda Inc., 505 N Mathlida Ave, Suite 120
18  * Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
19  */
20
21 /* The NULL device accepts data and sends it to the bit bucket. Like
22    /dev/null, you cannot read from the NULL device -- only
23    write. While useful for testing, the NULL device is incredibly
24    dangerous in practice (because it eats your data). So it will
25    generate warnings whenever you use it. */
26
27 #include <glib.h>
28 #include <glib-object.h>
29 #ifndef __NULL_DEVICE_H__
30 #define __NULL_DEVICE_H__
31
32 /* This header file is very boring, because the class just overrides
33    existing methods. */
34
35 /*
36  * Type checking and casting macros
37  */
38 #define TYPE_NULL_DEVICE        (null_device_get_type())
39 #define NULL_DEVICE(obj)        G_TYPE_CHECK_INSTANCE_CAST((obj), null_device_get_type(), NullDevice)
40 #define NULL_DEVICE_CONST(obj)  G_TYPE_CHECK_INSTANCE_CAST((obj), null_device_get_type(), NullDevice const)
41 #define NULL_DEVICE_CLASS(klass)        G_TYPE_CHECK_CLASS_CAST((klass), null_device_get_type(), NullDeviceClass)
42 #define IS_NULL_DEVICE(obj)     G_TYPE_CHECK_INSTANCE_TYPE((obj), null_device_get_type ())
43
44 #define NULL_DEVICE_GET_CLASS(obj)      G_TYPE_INSTANCE_GET_CLASS((obj), null_device_get_type(), NullDeviceClass)
45
46 /*
47  * Main object structure
48  */
49 #ifndef __TYPEDEF_NULL_DEVICE__
50 #define __TYPEDEF_NULL_DEVICE__
51 typedef struct _NullDevice NullDevice;
52 #endif
53 struct _NullDevice {
54         Device __parent__;
55 };
56
57 /*
58  * Class definition
59  */
60 typedef struct _NullDeviceClass NullDeviceClass;
61 struct _NullDeviceClass {
62     DeviceClass __parent__;
63     gboolean in_file;
64 };
65
66
67 /*
68  * Public methods
69  */
70 GType   null_device_get_type    (void);
71 void    null_device_register    (void);
72
73 #endif