summaryrefslogtreecommitdiff
path: root/TAO/tao/Compression/Compression.pidl
blob: 76404daf6d98419d92001424f478b15321c85992 (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
// -*- 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
    {
    };

    /**
     * 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 long CompressorId;

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

    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 CORBA::OctetSeq source, inout CORBA::OctetSeq 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 CORBA::OctetSeq source, inout CORBA::OctetSeq 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;
    };

    local interface CompressorFactory
    {
        /**
         * The CompressorId associated with this CompressorFactory
         */
        readonly attribute CompressorId compressor_id;
        /**
         * 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 double average_compression;
        /**
         * Create a Compressor instance with the given compression level.
         */
        Compressor get_compressor(in CompressionLevel compression_level);
        /**
         * Add a sample of compressed and uncompressed bytes.
         */
        void add_sample(in unsigned long long compressed_bytes, in unsigned long long uncompressed_bytes);
    };

    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);
        /**
         * List all registered CompressorFactories
         */
        CompressorFactorySeq get_factories();
    };
};

#endif