summaryrefslogtreecommitdiff
path: root/TAO/tao/Compression/Compression.pidl
blob: 0fed028ce7cd16ffcd37ad4b0f5c9526f986f6b6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
// -*- IDL -*-

/**
 * @file Compression.pidl
 *
 * $Id$
 */

#ifndef _COMPRESSION_PIDL_
#define _COMPRESSION_PIDL_

#include "tao/OctetSeq.pidl"

module Compression
{
    typeprefix Compression "omg.org";

    /**
     * Exception thrown when an error occurs during a compress or decompress
     * operation.
     */
    exception CompressionException
    {
        unsigned long reason;
        string description;
    };

    /**
     * Exception thrown if a CompressorFactory with the same CompressorId is
     * already registered with the CompressionManager.
     */
    exception FactoryAlreadyRegistered
    {
    };

    /**
     * Exception thrown if a CompressorId is not known.
     */
    exception UnknownCompressorId
    {
    };

    /**
     * CompressorId type.
     */
    typedef unsigned short CompressorId;
    const CompressorId COMPRESSORID_NONE = 0;
    const CompressorId COMPRESSORID_GZIP = 1;
    const CompressorId COMPRESSORID_PKZIP = 2;
    const CompressorId COMPRESSORID_BZIP2 = 3;
    const CompressorId COMPRESSORID_ZLIB = 4;
    const CompressorId COMPRESSORID_LZMA = 5;
    const CompressorId COMPRESSORID_LZO = 6;
    const CompressorId COMPRESSORID_RZIP = 7;
    const CompressorId COMPRESSORID_7X = 8;
    const CompressorId COMPRESSORID_XAR = 9;

    /**
     * CompressionLevel type.
     */
    typedef unsigned short CompressionLevel;

    /**
     * CompressionRatio type.
     */
    typedef long CompressionRatio;

    /**
     * CompressionLevelId struc.
     */
    struct CompressorIdLevel {
      CompressorId     compressor_id;
      CompressionLevel compression_level;
    };
    typedef sequence <CompressorIdLevel> CompressorIdLevelList;

    typedef CORBA::OctetSeq Buffer;

    local interface CompressorFactory;

    /**
     * Compressor - abstraction of a compressor and decompressor.
     */
    local interface Compressor
    {
        /**
         * Operation that compresses data contained in the source Buffer into
         * the target Buffer. If an error occurs during the compression, it
         * throws CompressionException
         */
        void compress(in Buffer source, inout Buffer target) raises (CompressionException);
        /**
         * Operation that decompresses data contained in the source Buffer into
         * the target Buffer. If an error occurs during the decompression, it
         * throws CompressionException
         */
        void decompress(in Buffer source, inout Buffer target) raises(CompressionException);
        /**
         * The CompressorFactory associated with this Compressor.
         */
        readonly attribute CompressorFactory compressor_factory;
        /**
         * The (implementation and algorithm specific) compression level
         * associated with this Compressor.
         */
        readonly attribute CompressionLevel compression_level;
        /**
         * The total number of compressed bytes read and written by Compressors
         * that were created by this CompressorFactory
         * (i.e. the "target" side of Compressor::compress and
         * the "source" side of Compressor::decompress operations).
         */
        readonly attribute unsigned long long compressed_bytes;
        /**
         * The total number of uncompressed bytes read and written by
         * Compressors that were created by this CompressorFactory
         * (i.e. the "source" side of Compressor::compress and
         * the "target" side of Compressor::decompress operations).
         */
        readonly attribute unsigned long long uncompressed_bytes;
        /**
         * The average compression achieved by Compressors that were created by
         * this CompressorFactory, usually a value between 0 and >=1.
         * (i.e. compressed_bytes divided by uncompressed_bytes).
         */
        readonly attribute CompressionRatio compression_ratio;
    };

    local interface CompressorFactory
    {
        /**
         * The CompressorId associated with this CompressorFactory
         */
        readonly attribute CompressorId compressor_id;
        /**
         * Create a Compressor instance with the given compression level.
         */
        Compressor get_compressor(in CompressionLevel compression_level);
    };

    typedef sequence<CompressorFactory> CompressorFactorySeq;

    /**
     * Per-ORB interface to register and unregister CompressorFactories.
     * Initial reference: "CompressionManager"
     */
    local interface CompressionManager
    {
        /**
         * Register a new CompressorFactory
         */
        void register_factory(in CompressorFactory compressor_factory) raises(FactoryAlreadyRegistered);
        /**
         * Unregister a CompressorFactory with the given CompressorId from the
         * CompressionManager
         */
        void unregister_factory(in CompressorId compressor_id) raises (UnknownCompressorId);
        /**
         * Retrieve a CompressorFactory with the given CompressorId from the
         * CompressionManager
         */
        CompressorFactory get_factory(in CompressorId compressor_id) raises(UnknownCompressorId);
        /**
         * Create a Compressor with the given compression_level from the
         * CompressorFactory with the given CompressorId
         */
        Compressor get_compressor(in CompressorId compressor_id, in CompressionLevel compression_level) raises(UnknownCompressorId);
        /**
         * Create a Compressor with the given CompressorIdLevel
         */
        //Compressor get_compressor(in CompressorIdLevel compressor_id_level) raises(UnknownCompressorId);
        /**
         * List all registered CompressorFactories
         */
        CompressorFactorySeq get_factories();
    };
};

#endif