diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-07-22 08:15:32 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2008-07-22 08:15:32 +0000 |
commit | 20afaa92757c6f8cc3bb06e49c5cf75631c4fa42 (patch) | |
tree | d6e197bc79a6a5b9425db4d93baad858a1efde41 /TAO/tao | |
parent | c70e9b0a04b7b6612b45f91e1fbfffcbe363fe2e (diff) | |
download | ATCD-20afaa92757c6f8cc3bb06e49c5cf75631c4fa42.tar.gz |
Tue Jul 22 08:14:28 UTC 2008 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao')
22 files changed, 462 insertions, 118 deletions
diff --git a/TAO/tao/Bzip2Compressor.mpc b/TAO/tao/Bzip2Compressor.mpc new file mode 100644 index 00000000000..5fa58ac44fb --- /dev/null +++ b/TAO/tao/Bzip2Compressor.mpc @@ -0,0 +1,38 @@ +//$Id$ +project(Bzip2Compressor) : taolib, tao_output, install, compression, tao_versioning_idl_defaults, ace_zlib { + requires += bzip2 + sharedname = TAO_Bzip2Compressor + dynamicflags = TAO_BZIP2COMPRESSOR_BUILD_DLL + + Source_Files { + Compression/bzip2 + } + + Header_Files { + Compression/bzip2 + } + + Inline_Files { + Compression/bzip2 + } + + Template_Files { + Compression/bzip2 + } + + Resource_Files { + Compression/bzip2 + } + + PIDL_Files { + Compression/bzip2 + } + + IDL_Files { + Compression/bzip2 + } + + Pkgconfig_Files { + Compression/zlib/TAO_Bzip2Compressor.pc.in + } +} diff --git a/TAO/tao/Compression.mpc b/TAO/tao/Compression.mpc index 223eedf56ee..9a99872462a 100644 --- a/TAO/tao/Compression.mpc +++ b/TAO/tao/Compression.mpc @@ -1,8 +1,8 @@ //$Id$ -project(Compression) : taolib, tao_output, install, tao_versioning_idl_defaults { +project(Compression) : taolib, tao_output, install, tao_versioning_idl_defaults, core_anytypecode { sharedname = TAO_Compression dynamicflags = TAO_COMPRESSION_BUILD_DLL - idlflags += -SS -Sorb -Sci -Sa \ + idlflags += -SS -Sorb -Sci \ -Wb,export_macro=TAO_Compression_Export \ -o Compression @@ -31,7 +31,7 @@ project(Compression) : taolib, tao_output, install, tao_versioning_idl_defaults } IDL_Files { - idlflags += -Gp -Gd -St \ + idlflags += -Gp -Gd -Sal \ -Wb,export_macro=TAO_Compression_Export \ -Wb,export_include=tao/Compression/compression_export.h \ -Wb,include_guard=TAO_COMPRESSION_SAFE_INCLUDE \ diff --git a/TAO/tao/Compression/Base_Compressor.cpp b/TAO/tao/Compression/Base_Compressor.cpp index 217c159b9ac..c88d281f0c5 100644 --- a/TAO/tao/Compression/Base_Compressor.cpp +++ b/TAO/tao/Compression/Base_Compressor.cpp @@ -14,7 +14,9 @@ namespace TAO compressor_factory) : compression_level_ (compression_level), compressor_factory_ (::Compression::CompressorFactory::_duplicate ( - compressor_factory)) + compressor_factory)), + compressed_bytes_ (0), + uncompressed_bytes_ (0) { } @@ -30,6 +32,52 @@ namespace TAO { return compression_level_; } + + ::CORBA::ULongLong + BaseCompressor::compressed_bytes (void) + { + ::CORBA::ULongLong return_value = 0; + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); + return_value = compressed_bytes_; + } + return return_value; + } + + ::CORBA::ULongLong + BaseCompressor::uncompressed_bytes (void) + { + ::CORBA::ULongLong return_value = 0; + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); + return_value = uncompressed_bytes_; + } + return return_value; + } + + ::CORBA::ULong + BaseCompressor::compression_ratio (void) + { + ::CORBA::ULong return_value = 0; + { + ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); + if (this->uncompressed_bytes_ > 0) + { + return_value = 100 - (this->compressed_bytes_ / this->uncompressed_bytes_) * 100; + } + } + return return_value; + } + + void + BaseCompressor::update_stats ( + ::CORBA::ULongLong compressed_bytes, + ::CORBA::ULongLong uncompressed_bytes) + { + ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); + this->compressed_bytes_ += compressed_bytes; + this->uncompressed_bytes_ += uncompressed_bytes; + } } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/Base_Compressor.h b/TAO/tao/Compression/Base_Compressor.h index d8e113a57a2..083b3352176 100644 --- a/TAO/tao/Compression/Base_Compressor.h +++ b/TAO/tao/Compression/Base_Compressor.h @@ -39,19 +39,31 @@ namespace TAO BaseCompressor (::Compression::CompressionLevel compression_level, ::Compression::CompressorFactory_ptr compressor_factory); - virtual void compress (const ::CORBA::OctetSeq &source, - ::CORBA::OctetSeq &target) = 0; + virtual void compress (const ::Compression::Buffer &source, + ::Compression::Buffer &target) = 0; - virtual void decompress (const ::CORBA::OctetSeq &source, - ::CORBA::OctetSeq &target) = 0; + virtual void decompress (const ::Compression::Buffer &source, + ::Compression::Buffer &target) = 0; virtual ::Compression::CompressorFactory_ptr compressor_factory (void); virtual ::Compression::CompressionLevel compression_level (void); + virtual ::CORBA::ULongLong compressed_bytes (void); + + virtual ::CORBA::ULongLong uncompressed_bytes (void); + + virtual ::CORBA::ULong compression_ratio (void); + protected: + void update_stats (::CORBA::ULongLong compressed_bytes, + ::CORBA::ULongLong uncompressed_bytes); + + TAO_SYNCH_MUTEX mutex_; ::Compression::CompressionLevel compression_level_; ::Compression::CompressorFactory_var compressor_factory_; + ::CORBA::ULongLong compressed_bytes_; + ::CORBA::ULongLong uncompressed_bytes_; }; } diff --git a/TAO/tao/Compression/Compression.cpp b/TAO/tao/Compression/Compression.cpp index a70e27186da..eb6a5ca34f9 100644 --- a/TAO/tao/Compression/Compression.cpp +++ b/TAO/tao/Compression/Compression.cpp @@ -13,8 +13,8 @@ TAO_Compression_Loader::create_object (CORBA::ORB_ptr, int, ACE_TCHAR *[]) { CORBA::Object_ptr obj = CORBA::Object::_nil (); ACE_NEW_RETURN (obj, - TAO::CompressionManager (), - CORBA::Object::_nil ()); + TAO::CompressionManager (), + CORBA::Object::_nil ()); return obj; } diff --git a/TAO/tao/Compression/Compression.h b/TAO/tao/Compression/Compression.h index ec6de71bb89..605de8554dd 100644 --- a/TAO/tao/Compression/Compression.h +++ b/TAO/tao/Compression/Compression.h @@ -34,8 +34,7 @@ TAO_BEGIN_VERSIONED_NAMESPACE_DECL * @brief Class that loads the Compression library. */ -class TAO_Compression_Export TAO_Compression_Loader - : public TAO_Object_Loader +class TAO_Compression_Export TAO_Compression_Loader : public TAO_Object_Loader { public: /// Creates a Compression Manager and returns it. @@ -47,7 +46,8 @@ public: }; static int - TAO_Requires_Compression_Initializer = TAO_Compression_Loader::Initializer (); + TAO_Requires_Compression_Initializer = TAO_Compression_Loader::Initializer + (); TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/Compression.pidl b/TAO/tao/Compression/Compression.pidl index d5796bf839f..ebb7c0e76e7 100644 --- a/TAO/tao/Compression/Compression.pidl +++ b/TAO/tao/Compression/Compression.pidl @@ -21,6 +21,7 @@ module Compression */ exception CompressionException { + unsigned long reason; }; /** @@ -41,11 +42,17 @@ module Compression /** * CompressorId type. */ - typedef unsigned short CompressorId; + typedef unsigned long 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_LZOP = 6; + const CompressorId COMPRESSORID_RZIP = 7; + const CompressorId COMPRESSORID_7X = 8; + const CompressorId COMPRESSORID_XAR = 9; /** * CompressorId list @@ -59,6 +66,14 @@ module Compression local interface CompressorFactory; + struct CompressorIdLevel { + CompressorId compressor_id; + CompressionLevel compression_level; + }; + typedef sequence <CompressorIdLevel> CompressorIdLevelList; + + typedef CORBA::OctetSeq Buffer; + /** * Compressor - abstraction of a compressor and decompressor. */ @@ -69,13 +84,13 @@ module Compression * 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); + 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 CORBA::OctetSeq source, inout CORBA::OctetSeq target) raises(CompressionException); + void decompress(in Buffer source, inout Buffer target) raises(CompressionException); /** * The CompressorFactory associated with this Compressor. */ @@ -85,14 +100,6 @@ module Compression * 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 @@ -112,15 +119,19 @@ module Compression * this CompressorFactory, usually a value between 0 and >=1. * (i.e. compressed_bytes divided by uncompressed_bytes). */ - readonly attribute double average_compression; + readonly attribute unsigned long compression_ratio; + }; + + local interface CompressorFactory + { /** - * Create a Compressor instance with the given compression level. + * The CompressorId associated with this CompressorFactory */ - Compressor get_compressor(in CompressionLevel compression_level); + readonly attribute CompressorId compressor_id; /** - * Add a sample of compressed and uncompressed bytes. + * Create a Compressor instance with the given compression level. */ - void add_sample(in unsigned long long compressed_bytes, in unsigned long long uncompressed_bytes); + Compressor get_compressor(in CompressionLevel compression_level); }; typedef sequence<CompressorFactory> CompressorFactorySeq; @@ -151,6 +162,10 @@ module Compression */ 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(); diff --git a/TAO/tao/Compression/Compression_Manager.cpp b/TAO/tao/Compression/Compression_Manager.cpp index 1d39880f451..d9ea7e2dbfc 100644 --- a/TAO/tao/Compression/Compression_Manager.cpp +++ b/TAO/tao/Compression/Compression_Manager.cpp @@ -74,7 +74,7 @@ namespace TAO CompressionManager::get_factory (::Compression::CompressorId compressor_id) { ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, - ::Compression::CompressorFactory::_nil ()); + ::Compression::CompressorFactory::_nil ()); CORBA::ULong const length = this->factories_.length (); diff --git a/TAO/tao/Compression/Compressor_Factory.cpp b/TAO/tao/Compression/Compressor_Factory.cpp index 27982f4f12a..e43aab8be09 100644 --- a/TAO/tao/Compression/Compressor_Factory.cpp +++ b/TAO/tao/Compression/Compressor_Factory.cpp @@ -10,9 +10,7 @@ namespace TAO { CompressorFactory::CompressorFactory (::Compression::CompressorId compressor_id) - : compressor_id_ (compressor_id), - compressed_bytes_ (0), - uncompressed_bytes_ (0) + : compressor_id_ (compressor_id) { } @@ -21,53 +19,6 @@ namespace TAO { return compressor_id_; } - - ::CORBA::ULongLong - CompressorFactory::compressed_bytes (void) - { - ::CORBA::ULongLong return_value; - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); - return_value = compressed_bytes_; - } - return return_value; - } - - ::CORBA::ULongLong - CompressorFactory::uncompressed_bytes (void) - { - ::CORBA::ULongLong return_value; - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); - return_value = uncompressed_bytes_; - } - return return_value; - } - - ::CORBA::Double - CompressorFactory::average_compression (void) - { - ::CORBA::Double return_value = 0.0; - { - ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0); - if (this->uncompressed_bytes_ > 0) - { - return_value = static_cast < ::CORBA::Double>( - (this->uncompressed_bytes_ - this->compressed_bytes_) / - this->uncompressed_bytes_); - } - } - return return_value; - } - - void - CompressorFactory::add_sample (::CORBA::ULongLong compressed_bytes, - ::CORBA::ULongLong uncompressed_bytes) - { - ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_); - this->compressed_bytes_ += compressed_bytes; - this->uncompressed_bytes_ += uncompressed_bytes; - } } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/Compressor_Factory.h b/TAO/tao/Compression/Compressor_Factory.h index 173cf67a681..fe2d0a8d05b 100644 --- a/TAO/tao/Compression/Compressor_Factory.h +++ b/TAO/tao/Compression/Compressor_Factory.h @@ -37,24 +37,11 @@ namespace TAO virtual ::Compression::CompressorId compressor_id (void); - virtual ::CORBA::ULongLong compressed_bytes (void); - - virtual ::CORBA::ULongLong uncompressed_bytes (void); - - virtual ::CORBA::Double average_compression (void); - virtual ::Compression::Compressor_ptr get_compressor - (::Compression::CompressionLevel compression_level) - = 0; - - virtual void add_sample (::CORBA::ULongLong compressed_bytes, - ::CORBA::ULongLong uncompressed_bytes); + (::Compression::CompressionLevel compression_level) = 0; private: - TAO_SYNCH_MUTEX mutex_; ::Compression::CompressorId const compressor_id_; - ::CORBA::ULongLong compressed_bytes_; - ::CORBA::ULongLong uncompressed_bytes_; }; } diff --git a/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp b/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp new file mode 100644 index 00000000000..357e4eaf4ff --- /dev/null +++ b/TAO/tao/Compression/bzip2/Bzip2Compressor.cpp @@ -0,0 +1,76 @@ +#include "Bzip2Compressor.h" + +ACE_RCSID (BZIP2, + Bzip2Compressor, + "$Id$") + +#include "bzlib.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ +Bzip2Compressor::Bzip2Compressor ( + ::Compression::CompressionLevel compression_level, + ::Compression::CompressorFactory_ptr compressor_factory) : + BaseCompressor (compression_level, compressor_factory) +{ +} + +void +Bzip2Compressor::compress ( + const ::Compression::Buffer & source, + ::Compression::Buffer & target + ) +{ + unsigned int max_length = static_cast <unsigned int> (source.length () * 1.1) + 12; + target.length (static_cast <CORBA::ULong> (max_length)); + + // todo, check 0,1 values + int const retval = ::BZ2_bzBuffToBuffCompress (reinterpret_cast <char*>(target.get_buffer ()), + &max_length, + reinterpret_cast <char*>(const_cast<CORBA::Octet*>(source.get_buffer ())), + source.length (), + 0, + 1, + this->compression_level ()); + + if (retval != BZ_OK) + { + throw ::Compression::CompressionException (retval); + } + else + { + target.length (static_cast <CORBA::ULong> (max_length)); + } + + // Update statistics for this compressor + this->update_stats (source.length (), target.length ()); +} + +void +Bzip2Compressor::decompress ( + const ::Compression::Buffer & source, + ::Compression::Buffer & target) +{ + unsigned int max_length = static_cast <unsigned int> (target.length ()); + // todo, check 0,1 values + int const retval = ::BZ2_bzBuffToBuffDecompress (reinterpret_cast <char*>(target.get_buffer ()), + &max_length, + reinterpret_cast <char*>(const_cast<CORBA::Octet*>(source.get_buffer ())), + source.length (), + 0, + 1); + + if (retval != BZ_OK) + { + throw ::Compression::CompressionException (retval); + } + else + { + target.length (static_cast <CORBA::ULong> (max_length)); + } +} +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/bzip2/Bzip2Compressor.h b/TAO/tao/Compression/bzip2/Bzip2Compressor.h new file mode 100644 index 00000000000..a6f652030a0 --- /dev/null +++ b/TAO/tao/Compression/bzip2/Bzip2Compressor.h @@ -0,0 +1,53 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file Bzip2Compressor.h + * + * $Id$ + * + * See http://www.zlib.net/manual.html for the zlib interface itself + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_BZIP2COMPRESSOR_H +#define TAO_BZIP2COMPRESSOR_H + +#include /**/ "ace/pre.h" + +#include "tao/Compression/bzip2/Bzip2Compressor_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Compression/Compression.h" +#include "tao/Compression/Base_Compressor.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + class TAO_BZIP2COMPRESSOR_Export Bzip2Compressor : public BaseCompressor + { + public: + Bzip2Compressor (::Compression::CompressionLevel compression_level, + ::Compression::CompressorFactory_ptr compressor_factory); + + virtual void compress ( + const ::Compression::Buffer & source, + ::Compression::Buffer & target); + + virtual void decompress ( + const ::Compression::Buffer & source, + ::Compression::Buffer & target); + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_BZIP2COMPRESSOR_H */ diff --git a/TAO/tao/Compression/bzip2/Bzip2Compressor_Factory.cpp b/TAO/tao/Compression/bzip2/Bzip2Compressor_Factory.cpp new file mode 100644 index 00000000000..ee57dc00310 --- /dev/null +++ b/TAO/tao/Compression/bzip2/Bzip2Compressor_Factory.cpp @@ -0,0 +1,33 @@ +#include "tao/Compression/bzip2/Bzip2Compressor_Factory.h" +#include "tao/Compression/bzip2/Bzip2Compressor.h" + +ACE_RCSID (BZIP2, + Bzip2_Compressor_Factory, + "$Id$") + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + +Bzip2_CompressorFactory::Bzip2_CompressorFactory (void) : + ::TAO::CompressorFactory (::Compression::COMPRESSORID_BZIP2), + compressor_ (::Compression::Compressor::_nil ()) +{ +} + +::Compression::Compressor_ptr +Bzip2_CompressorFactory::get_compressor ( + ::Compression::CompressionLevel compression_level) +{ + // @todo, make a array based on compression level + if (CORBA::is_nil (compressor_.in ())) + { + compressor_ = new Bzip2Compressor (compression_level, this); + } + + return ::Compression::Compressor::_duplicate (compressor_.in ()); +} +} + +TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/Compression/bzip2/Bzip2Compressor_Factory.h b/TAO/tao/Compression/bzip2/Bzip2Compressor_Factory.h new file mode 100644 index 00000000000..930226d949b --- /dev/null +++ b/TAO/tao/Compression/bzip2/Bzip2Compressor_Factory.h @@ -0,0 +1,48 @@ +// -*- C++ -*- + +// =================================================================== +/** + * @file Bzip2Compressor_Factory.h + * + * $Id$ + * + * @author Johnny Willemsen <jwillemsen@remedy.nl> + */ +// =================================================================== + +#ifndef TAO_BZIP2COMPRESSOR_FACTORY_H +#define TAO_BZIP2COMPRESSOR_FACTORY_H + +#include /**/ "ace/pre.h" + +#include "tao/Compression/bzip2/Bzip2Compressor_export.h" + +#if !defined (ACE_LACKS_PRAGMA_ONCE) +# pragma once +#endif /* ACE_LACKS_PRAGMA_ONCE */ + +#include "tao/Compression/Compression.h" +#include "tao/Compression/Compressor_Factory.h" + +TAO_BEGIN_VERSIONED_NAMESPACE_DECL + +namespace TAO +{ + class TAO_BZIP2COMPRESSOR_Export Bzip2_CompressorFactory : + public ::TAO::CompressorFactory + { + public: + Bzip2_CompressorFactory (void); + + virtual ::Compression::Compressor_ptr get_compressor ( + ::Compression::CompressionLevel compression_level); + private: + ::Compression::Compressor_var compressor_; + }; +} + +TAO_END_VERSIONED_NAMESPACE_DECL + +#include /**/ "ace/post.h" + +#endif /* TAO_BZIP2COMPRESSOR_FACTORY_H */ diff --git a/TAO/tao/Compression/bzip2/Bzip2Compressor_export.h b/TAO/tao/Compression/bzip2/Bzip2Compressor_export.h new file mode 100644 index 00000000000..258daeea878 --- /dev/null +++ b/TAO/tao/Compression/bzip2/Bzip2Compressor_export.h @@ -0,0 +1,40 @@ + +// -*- C++ -*- +// $Id$ +// Definition for Win32 Export directives. +// This file is generated automatically by generate_export_file.pl +// ------------------------------ +#ifndef TAO_BZIP2COMPRESSOR_EXPORT_H +#define TAO_BZIP2COMPRESSOR_EXPORT_H + +#include "ace/config-all.h" + +#if defined (TAO_AS_STATIC_LIBS) +# if !defined (TAO_BZIP2COMPRESSOR_HAS_DLL) +# define TAO_BZIP2COMPRESSOR_HAS_DLL 0 +# endif /* ! TAO_BZIP2COMPRESSOR_HAS_DLL */ +#else +# if !defined (TAO_BZIP2COMPRESSOR_HAS_DLL) +# define TAO_BZIP2COMPRESSOR_HAS_DLL 1 +# endif /* ! TAO_BZIP2COMPRESSOR_HAS_DLL */ +#endif + +#if defined (TAO_BZIP2COMPRESSOR_HAS_DLL) && (TAO_BZIP2COMPRESSOR_HAS_DLL == 1) +# if defined (TAO_BZIP2COMPRESSOR_BUILD_DLL) +# define TAO_BZIP2COMPRESSOR_Export ACE_Proper_Export_Flag +# define TAO_BZIP2COMPRESSOR_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T) +# define TAO_BZIP2COMPRESSOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# else /* TAO_BZIP2COMPRESSOR_BUILD_DLL */ +# define TAO_BZIP2COMPRESSOR_Export ACE_Proper_Import_Flag +# define TAO_BZIP2COMPRESSOR_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T) +# define TAO_BZIP2COMPRESSOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +# endif /* TAO_BZIP2COMPRESSOR_BUILD_DLL */ +#else /* TAO_BZIP2COMPRESSOR_HAS_DLL == 1 */ +# define TAO_BZIP2COMPRESSOR_Export +# define TAO_BZIP2COMPRESSOR_SINGLETON_DECLARATION(T) +# define TAO_BZIP2COMPRESSOR_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) +#endif /* TAO_BZIP2COMPRESSOR_HAS_DLL == 1 */ + +#endif /* TAO_BZIP2COMPRESSOR_EXPORT_H */ + +// End of auto generated file. diff --git a/TAO/tao/Compression/bzip2/TAO_Bzip2Compressor.pc.in b/TAO/tao/Compression/bzip2/TAO_Bzip2Compressor.pc.in new file mode 100644 index 00000000000..5ccd544d7c3 --- /dev/null +++ b/TAO/tao/Compression/bzip2/TAO_Bzip2Compressor.pc.in @@ -0,0 +1,11 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: TAO_BZIP2_COMPRESSOR +Description: TAO Bzip2 Compression Library +Requires: TAO_Compression +Version: @VERSION@ +Libs: -L${libdir} -lTAO_BZIP2_Compressor +Cflags: -I${includedir} diff --git a/TAO/tao/Compression/bzip2/TAO_Bzip2Compressor.rc b/TAO/tao/Compression/bzip2/TAO_Bzip2Compressor.rc new file mode 100644 index 00000000000..9b8c03bec79 --- /dev/null +++ b/TAO/tao/Compression/bzip2/TAO_Bzip2Compressor.rc @@ -0,0 +1,30 @@ +#include "..\..\Version.h" + +1 VERSIONINFO + FILEVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0 + PRODUCTVERSION TAO_MAJOR_VERSION,TAO_MINOR_VERSION,TAO_BETA_VERSION,0 + FILEFLAGSMASK 0x3fL + FILEFLAGS 0x0L + FILEOS 0x4L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904B0" + BEGIN + VALUE "FileDescription", "BZIP2COMPRESSOR\0" + VALUE "FileVersion", TAO_VERSION "\0" + VALUE "InternalName", "TAO_BZIP2COMPRESSORDLL\0" + VALUE "LegalCopyright", "\0" + VALUE "LegalTrademarks", "\0" + VALUE "OriginalFilename", "TAO_BZIP2COMPRESSOR.DLL\0" + VALUE "ProductName", "TAO\0" + VALUE "ProductVersion", TAO_VERSION "\0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END diff --git a/TAO/tao/Compression/zlib/ZlibCompressor.cpp b/TAO/tao/Compression/zlib/ZlibCompressor.cpp index 6feddcc7ec5..4a22a0f5fe5 100644 --- a/TAO/tao/Compression/zlib/ZlibCompressor.cpp +++ b/TAO/tao/Compression/zlib/ZlibCompressor.cpp @@ -19,8 +19,8 @@ ZlibCompressor::ZlibCompressor ( void ZlibCompressor::compress ( - const ::CORBA::OctetSeq & source, - ::CORBA::OctetSeq & target + const ::Compression::Buffer & source, + ::Compression::Buffer & target ) { uLongf max_length = static_cast <uLongf> (source.length () * 1.1) + 12; @@ -34,18 +34,21 @@ ZlibCompressor::compress ( if (retval != Z_OK) { - throw ::Compression::CompressionException (); + throw ::Compression::CompressionException (retval); } else { target.length (static_cast <CORBA::ULong> (max_length)); } + + // Update statistics for this compressor + this->update_stats (source.length (), target.length ()); } void ZlibCompressor::decompress ( - const ::CORBA::OctetSeq & source, - ::CORBA::OctetSeq & target) + const ::Compression::Buffer & source, + ::Compression::Buffer & target) { uLongf max_length = static_cast <uLongf> (target.length ()); int const retval = uncompress (reinterpret_cast <Bytef*>(target.get_buffer ()), @@ -55,7 +58,7 @@ ZlibCompressor::decompress ( if (retval != Z_OK) { - throw ::Compression::CompressionException (); + throw ::Compression::CompressionException (retval); } else { diff --git a/TAO/tao/Compression/zlib/ZlibCompressor.h b/TAO/tao/Compression/zlib/ZlibCompressor.h index 01ed0fd2f51..3bb36f5b897 100644 --- a/TAO/tao/Compression/zlib/ZlibCompressor.h +++ b/TAO/tao/Compression/zlib/ZlibCompressor.h @@ -37,12 +37,12 @@ namespace TAO ::Compression::CompressorFactory_ptr compressor_factory); virtual void compress ( - const ::CORBA::OctetSeq & source, - ::CORBA::OctetSeq & target); + const ::Compression::Buffer & source, + ::Compression::Buffer & target); virtual void decompress ( - const ::CORBA::OctetSeq & source, - ::CORBA::OctetSeq & target); + const ::Compression::Buffer & source, + ::Compression::Buffer & target); }; } diff --git a/TAO/tao/PortableServer/Key_Adapters.cpp b/TAO/tao/PortableServer/Key_Adapters.cpp index 9263e4470fc..bd9fae695d4 100644 --- a/TAO/tao/PortableServer/Key_Adapters.cpp +++ b/TAO/tao/PortableServer/Key_Adapters.cpp @@ -46,14 +46,12 @@ TAO_ObjectId_Hash::operator () (const PortableServer::ObjectId &id) const //////////////////////////////////////////////////////////////////////////////// int -TAO_Ignore_Original_Key_Adapter::encode (const PortableServer::ObjectId &original_key, +TAO_Ignore_Original_Key_Adapter::encode (const PortableServer::ObjectId &, const ACE_Active_Map_Manager_Key &active_key, PortableServer::ObjectId &modified_key) { - ACE_UNUSED_ARG (original_key); - // Size of active key. - size_t active_key_size = active_key.size (); + size_t const active_key_size = active_key.size (); // Resize to accommodate both the original data and the new active key. modified_key.length (static_cast <CORBA::ULong> (active_key_size)); @@ -99,7 +97,7 @@ TAO_Preserve_Original_Key_Adapter::encode (const PortableServer::ObjectId &origi PortableServer::ObjectId &modified_key) { // Size of active key. - size_t active_key_size = active_key.size (); + size_t const active_key_size = active_key.size (); // Resize to accommodate both the original data and the new active key. modified_key.length (static_cast <CORBA::ULong> (active_key_size) @@ -133,7 +131,7 @@ TAO_Preserve_Original_Key_Adapter::decode (const PortableServer::ObjectId &modif PortableServer::ObjectId &original_key) { // Size of active key. - size_t active_key_size = ACE_Active_Map_Manager_Key::size (); + size_t const active_key_size = ACE_Active_Map_Manager_Key::size (); // Smartly copy all the data; <original_key does not own the data>. original_key.replace (static_cast <CORBA::ULong> diff --git a/TAO/tao/TAO_Server_Request.h b/TAO/tao/TAO_Server_Request.h index c2d9be81238..254e721897c 100644 --- a/TAO/tao/TAO_Server_Request.h +++ b/TAO/tao/TAO_Server_Request.h @@ -298,6 +298,7 @@ private: /// Incoming stream. TAO_InputCDR *incoming_; + /// Outgoing stream. TAO_OutputCDR *outgoing_; diff --git a/TAO/tao/Transport_Cache_Manager.cpp b/TAO/tao/Transport_Cache_Manager.cpp index 12664ab3ced..eb797b9ea1a 100644 --- a/TAO/tao/Transport_Cache_Manager.cpp +++ b/TAO/tao/Transport_Cache_Manager.cpp @@ -52,16 +52,16 @@ namespace TAO ACE::Monitor_Control::Size_Monitor); ACE_NEW (this->size_monitor_, ACE::Monitor_Control::Size_Monitor); - + ACE_CString purge_name ("Connection_Cache_Purge_"); ACE_CString size_name ("Connection_Cache_Size_"); - + purge_name += orb_core.orbid (); size_name += orb_core.orbid (); - + this->purge_monitor_->name (purge_name.c_str ()); this->size_monitor_->name (size_name.c_str ()); - + this->purge_monitor_->add_to_registry (); this->size_monitor_->add_to_registry (); #endif /* TAO_HAS_MONITOR_POINTS==1 */ @@ -462,8 +462,8 @@ namespace TAO { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::is_entry_available:") - ACE_TEXT ("returns %s state is [%d]\n"), - (result?"True":"False"), + ACE_TEXT ("returns %C state is [%d]\n"), + (result ? "true" : "false"), entry_state)); } @@ -487,8 +487,8 @@ namespace TAO { ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("TAO (%P|%t) - Transport_Cache_Manager::is_entry_connecting: ") - ACE_TEXT ("Returns %s, state is [%d]\n"), - (result?"True":"False"), + ACE_TEXT ("returns %C, state is [%d]\n"), + (result ? "true" : "false"), entry_state)); } |