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
|
#include "tao/Compression/Base_Compressor.h"
TAO_BEGIN_VERSIONED_NAMESPACE_DECL
namespace TAO
{
BaseCompressor::BaseCompressor (
::Compression::CompressorFactory_ptr compressor_factory,
::Compression::CompressionLevel compression_level)
: compression_level_ (compression_level),
compressor_factory_ (compressor_factory),
compressed_bytes_ (0),
uncompressed_bytes_ (0)
{
}
::Compression::CompressorFactory_ptr
BaseCompressor::compressor_factory (void)
{
return ::Compression::CompressorFactory::_duplicate (
compressor_factory_);
}
::Compression::CompressionLevel
BaseCompressor::compression_level (void)
{
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;
}
::Compression::CompressionRatio
BaseCompressor::compression_ratio (void)
{
::Compression::CompressionRatio return_value = 0;
{
ACE_GUARD_RETURN (TAO_SYNCH_MUTEX, ace_mon, this->mutex_, 0);
if (this->uncompressed_bytes_ > 0)
{
return_value =
static_cast< ::Compression::CompressionRatio>
((::Compression::CompressionRatio) this->compressed_bytes_ / this->uncompressed_bytes_);
}
}
return return_value;
}
void
BaseCompressor::update_stats (
::CORBA::ULongLong uncompressed_bytes,
::CORBA::ULongLong compressed_bytes)
{
ACE_GUARD (TAO_SYNCH_MUTEX, ace_mon, this->mutex_);
this->uncompressed_bytes_ += uncompressed_bytes;
this->compressed_bytes_ += compressed_bytes;
}
}
TAO_END_VERSIONED_NAMESPACE_DECL
|