00001 // -*- IDL -*- 00002 00003 /** 00004 * @file Compression.pidl 00005 * 00006 * $Id: Compression.pidl 78179 2007-04-24 18:36:03Z johnnyw $ 00007 */ 00008 00009 #ifndef _COMPRESSION_PIDL_ 00010 #define _COMPRESSION_PIDL_ 00011 00012 #include "tao/OctetSeq.pidl" 00013 00014 module Compression 00015 { 00016 typeprefix Compression "omg.org"; 00017 00018 /** 00019 * Exception thrown when an error occurs during a compress or decompress 00020 * operation. 00021 */ 00022 exception CompressionException 00023 { 00024 }; 00025 00026 /** 00027 * Exception thrown if a CompressorFactory with the same CompressorId is 00028 * already registered with the CompressionManager. 00029 */ 00030 exception FactoryAlreadyRegistered 00031 { 00032 }; 00033 00034 /** 00035 * Exception thrown if a CompressorId is not known. 00036 */ 00037 exception UnknownCompressorId 00038 { 00039 }; 00040 00041 /** 00042 * CompressorId type. 00043 */ 00044 typedef unsigned short CompressorId; 00045 const CompressorId COMPRESSORID_GZIP = 1; 00046 const CompressorId COMPRESSORID_PKZIP = 2; 00047 const CompressorId COMPRESSORID_BZIP2 = 3; 00048 const CompressorId COMPRESSORID_ZLIB = 4; 00049 00050 /** 00051 * CompressionLevel type. 00052 */ 00053 typedef unsigned long CompressionLevel; 00054 00055 local interface CompressorFactory; 00056 00057 /** 00058 * Compressor - abstraction of a compressor and decompressor. 00059 */ 00060 local interface Compressor 00061 { 00062 /** 00063 * Operation that compresses data contained in the source Buffer into 00064 * the target Buffer. If an error occurs during the compression, it 00065 * throws CompressionException 00066 */ 00067 void compress(in CORBA::OctetSeq source, inout CORBA::OctetSeq target) raises (CompressionException); 00068 /** 00069 * Operation that decompresses data contained in the source Buffer into 00070 * the target Buffer. If an error occurs during the decompression, it 00071 * throws CompressionException 00072 */ 00073 void decompress(in CORBA::OctetSeq source, inout CORBA::OctetSeq target) raises(CompressionException); 00074 /** 00075 * The CompressorFactory associated with this Compressor. 00076 */ 00077 readonly attribute CompressorFactory compressor_factory; 00078 /** 00079 * The (implementation and algorithm specific) compression level 00080 * associated with this Compressor. 00081 */ 00082 readonly attribute CompressionLevel compression_level; 00083 }; 00084 00085 local interface CompressorFactory 00086 { 00087 /** 00088 * The CompressorId associated with this CompressorFactory 00089 */ 00090 readonly attribute CompressorId compressor_id; 00091 /** 00092 * The total number of compressed bytes read and written by Compressors 00093 * that were created by this CompressorFactory 00094 * (i.e. the "target" side of Compressor::compress and 00095 * the "source" side of Compressor::decompress operations). 00096 */ 00097 readonly attribute unsigned long long compressed_bytes; 00098 /** 00099 * The total number of uncompressed bytes read and written by 00100 * Compressors that were created by this CompressorFactory 00101 * (i.e. the "source" side of Compressor::compress and 00102 * the "target" side of Compressor::decompress operations). 00103 */ 00104 readonly attribute unsigned long long uncompressed_bytes; 00105 /** 00106 * The average compression achieved by Compressors that were created by 00107 * this CompressorFactory, usually a value between 0 and >=1. 00108 * (i.e. compressed_bytes divided by uncompressed_bytes). 00109 */ 00110 readonly attribute double average_compression; 00111 /** 00112 * Create a Compressor instance with the given compression level. 00113 */ 00114 Compressor get_compressor(in CompressionLevel compression_level); 00115 /** 00116 * Add a sample of compressed and uncompressed bytes. 00117 */ 00118 void add_sample(in unsigned long long compressed_bytes, in unsigned long long uncompressed_bytes); 00119 }; 00120 00121 typedef sequence<CompressorFactory> CompressorFactorySeq; 00122 00123 /** 00124 * Per-ORB interface to register and unregister CompressorFactories. 00125 * Initial reference: "CompressionManager" 00126 */ 00127 local interface CompressionManager 00128 { 00129 /** 00130 * Register a new CompressorFactory 00131 */ 00132 void register_factory(in CompressorFactory compressor_factory) raises(FactoryAlreadyRegistered); 00133 /** 00134 * Unregister a CompressorFactory with the given CompressorId from the 00135 * CompressionManager 00136 */ 00137 void unregister_factory(in CompressorId compressor_id) raises (UnknownCompressorId); 00138 /** 00139 * Retrieve a CompressorFactory with the given CompressorId from the 00140 * CompressionManager 00141 */ 00142 CompressorFactory get_factory(in CompressorId compressor_id) raises(UnknownCompressorId); 00143 /** 00144 * Create a Compressor with the given compression_level from the 00145 * CompressorFactory with the given CompressorId 00146 */ 00147 Compressor get_compressor(in CompressorId compressor_id, in CompressionLevel compression_level) raises(UnknownCompressorId); 00148 /** 00149 * List all registered CompressorFactories 00150 */ 00151 CompressorFactorySeq get_factories(); 00152 }; 00153 }; 00154 00155 #endif