1 #include "tao/Compression/Base_Compressor.h"
3 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
7 BaseCompressor::BaseCompressor (
8 ::Compression::CompressorFactory_ptr compressor_factory
,
9 ::Compression::CompressionLevel compression_level
)
10 : compression_level_ (compression_level
),
11 compressor_factory_ (compressor_factory
),
12 compressed_bytes_ (0),
13 uncompressed_bytes_ (0)
17 ::Compression::CompressorFactory_ptr
18 BaseCompressor::compressor_factory ()
20 return ::Compression::CompressorFactory::_duplicate (
24 ::Compression::CompressionLevel
25 BaseCompressor::compression_level ()
27 return compression_level_
;
31 BaseCompressor::compressed_bytes ()
33 ::CORBA::ULongLong return_value
= 0;
35 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->mutex_
, 0);
36 return_value
= compressed_bytes_
;
42 BaseCompressor::uncompressed_bytes ()
44 ::CORBA::ULongLong return_value
= 0;
46 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->mutex_
, 0);
47 return_value
= uncompressed_bytes_
;
52 ::Compression::CompressionRatio
53 BaseCompressor::compression_ratio ()
55 ::Compression::CompressionRatio return_value
= 0;
57 ACE_GUARD_RETURN (TAO_SYNCH_MUTEX
, ace_mon
, this->mutex_
, 0);
58 if (this->uncompressed_bytes_
> 0)
61 static_cast< ::Compression::CompressionRatio
>
62 ((::Compression::CompressionRatio
) this->compressed_bytes_
/ this->uncompressed_bytes_
);
69 BaseCompressor::update_stats (
70 ::CORBA::ULongLong uncompressed_bytes
,
71 ::CORBA::ULongLong compressed_bytes
)
73 ACE_GUARD (TAO_SYNCH_MUTEX
, ace_mon
, this->mutex_
);
74 this->uncompressed_bytes_
+= uncompressed_bytes
;
75 this->compressed_bytes_
+= compressed_bytes
;
79 TAO_END_VERSIONED_NAMESPACE_DECL