Directory Structure [step 1]: moving files

working on #672

NOTE: This commit can't be compiled!!
This commit is contained in:
Yehonal
2017-10-12 20:00:52 +02:00
parent 4df28fd29c
commit f06f32849f
2508 changed files with 0 additions and 1325 deletions
+24
View File
@@ -0,0 +1,24 @@
// -*- MPC -*-
project(ACE_Compression) : acelib, install, ace_output {
sharedname = *
dynamicflags += ACE_COMPRESSION_BUILD_DLL
//prebuild = perl $(ACE_ROOT)/bin/generate_export_file.pl ACE_Compression > ACE_Compression_export.h
Source_Files {
Compressor.cpp
}
Header_Files {
Compressor.h
ACE_Compression_export.h
}
Inline_Files {
Compressor.inl
}
specific {
install_dir = ace/Compression
}
}
+57
View File
@@ -0,0 +1,57 @@
// -*- C++ -*-
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl ACE_Compression
// ------------------------------
#ifndef ACE_COMPRESSION_EXPORT_H
#define ACE_COMPRESSION_EXPORT_H
#include "ace/config-all.h"
#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_COMPRESSION_HAS_DLL)
# define ACE_COMPRESSION_HAS_DLL 0
#endif /* ACE_AS_STATIC_LIBS && ACE_COMPRESSION_HAS_DLL */
#if !defined (ACE_COMPRESSION_HAS_DLL)
# define ACE_COMPRESSION_HAS_DLL 1
#endif /* ! ACE_COMPRESSION_HAS_DLL */
#if defined (ACE_COMPRESSION_HAS_DLL) && (ACE_COMPRESSION_HAS_DLL == 1)
# if defined (ACE_COMPRESSION_BUILD_DLL)
# define ACE_Compression_Export ACE_Proper_Export_Flag
# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# else /* ACE_COMPRESSION_BUILD_DLL */
# define ACE_Compression_Export ACE_Proper_Import_Flag
# define ACE_COMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* ACE_COMPRESSION_BUILD_DLL */
#else /* ACE_COMPRESSION_HAS_DLL == 1 */
# define ACE_Compression_Export
# define ACE_COMPRESSION_SINGLETON_DECLARATION(T)
# define ACE_COMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_COMPRESSION_HAS_DLL == 1 */
// Set ACE_COMPRESSION_NTRACE = 0 to turn on library specific tracing even if
// tracing is turned off for ACE.
#if !defined (ACE_COMPRESSION_NTRACE)
# if (ACE_NTRACE == 1)
# define ACE_COMPRESSION_NTRACE 1
# else /* (ACE_NTRACE == 1) */
# define ACE_COMPRESSION_NTRACE 0
# endif /* (ACE_NTRACE == 1) */
#endif /* !ACE_COMPRESSION_NTRACE */
#if (ACE_COMPRESSION_NTRACE == 1)
# define ACE_COMPRESSION_TRACE(X)
#else /* (ACE_COMPRESSION_NTRACE == 1) */
# if !defined (ACE_HAS_TRACE)
# define ACE_HAS_TRACE
# endif /* ACE_HAS_TRACE */
# define ACE_COMPRESSION_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* (ACE_COMPRESSION_NTRACE == 1) */
#endif /* ACE_COMPRESSION_EXPORT_H */
// End of auto generated file.
+61
View File
@@ -0,0 +1,61 @@
#include "Compressor.h"
#if !defined (__ACE_INLINE__)
#include "Compressor.inl"
#endif /* __ACE_INLINE__ */
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_Compressor::ACE_Compressor( ACE_CompressorId compressor_id,
ACE_UINT32 compression_level )
: compressor_id_ (compressor_id)
, compression_level_ (compression_level)
, compressed_bytes_ (0)
, uncompressed_bytes_ (0)
{}
ACE_Compressor::~ACE_Compressor ()
{
}
ACE_UINT64
ACE_Compressor::compressed_bytes(void) const
{
ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 );
return this->compressed_bytes_;
}
ACE_UINT64
ACE_Compressor::uncompressed_bytes(void) const
{
ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0 );
return this->uncompressed_bytes_;
}
void
ACE_Compressor::reset_stats(void)
{
ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ );
this->compressed_bytes_ = 0;
this->uncompressed_bytes_ = 0;
}
void
ACE_Compressor::update_stats(ACE_UINT64 uncompressed_bytes, ACE_UINT64 compressed_bytes)
{
ACE_GUARD( ACE_SYNCH_MUTEX, ace_mon, this->mutex_ );
this->compressed_bytes_ += compressed_bytes;
this->uncompressed_bytes_ += uncompressed_bytes;
}
float
ACE_Compressor::compression_ratio(void) const
{
ACE_GUARD_RETURN( ACE_SYNCH_MUTEX, ace_mon, this->mutex_, 0.0f );
if (this->uncompressed_bytes_ > 0) {
return static_cast<float>(this->compressed_bytes_) / this->uncompressed_bytes_;
}
return 0.0f;
}
ACE_END_VERSIONED_NAMESPACE_DECL
+138
View File
@@ -0,0 +1,138 @@
// -*- C++ -*-
//=============================================================================
/**
* @file Compressor.h
*
* @author ACE version by
* @author Derek Dominish <derek.dominish@dsto.defence.gov.au>
*/
//=============================================================================
#ifndef ACE_COMPRESSOR_H
#define ACE_COMPRESSOR_H
#include /**/ "ace/pre.h"
#include /**/ "ACE_Compression_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Guard_T.h"
#include "ace/Thread_Mutex.h"
#include "ace/Synch_Traits.h"
#include "ace/Copy_Disabled.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
/**
* CompressorId from OMG Compression::CompressorId
* see $(TAO_ROOT)/tao/Compression.pidl
*/
enum ACE_CompressorId
{
ACE_COMPRESSORID_NONE = 0,
ACE_COMPRESSORID_GZIP = 1,
ACE_COMPRESSORID_PKZIP = 2,
ACE_COMPRESSORID_BZIP2 = 3,
ACE_COMPRESSORID_ZLIB = 4,
ACE_COMPRESSORID_LZMA = 5,
ACE_COMPRESSORID_LZO = 6,
ACE_COMPRESSORID_RZIP = 7,
ACE_COMPRESSORID_7X = 8,
ACE_COMPRESSORID_XAR = 9,
ACE_COMPRESSORID_RLE = 10
};
class ACE_Compression_Export ACE_Compressor
{
public:
ACE_CompressorId get_compressor_id(void) const;
ACE_UINT32 get_compression_level(void) const;
/**
* Compress the @a in_ptr buffer for @a in_len into the
* @a dest_ptr buffer with a maximum @a max_out_len. If the
* @a max_out_len is exhausted through the compress process
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr compressed buffer length.
*
* NOTE: it is advisable that the @max_out_len be slightly
* larger of the input @a in_len (i.e. x 1.1F) to cater
* for the possibility that a reduced compressed length
* is not possible.
*/
virtual ACE_UINT64 compress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len ) = 0;
/**
* DeCompress the @a in_ptr buffer for @a in_len into the
* @a out_ptr buffer with a maximum @a max_out_len. If the
* @a max_out_len is exhausted during decompression
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr decompressed buffer length.
*/
virtual ACE_UINT64 decompress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len ) = 0;
/**
* Return the current compressed bytes statistics counter.
*/
virtual ACE_UINT64 compressed_bytes(void) const;
/**
* Return the current uncompressed bytes statistics counter.
*/
virtual ACE_UINT64 uncompressed_bytes(void) const;
/**
* Return the current compression ratio statistics.
*/
virtual float compression_ratio(void) const;
/**
* Reset the statistics to zero.
*/
virtual void reset_stats(void);
virtual ~ACE_Compressor (void);
protected:
ACE_Compressor(ACE_CompressorId compressor_id,
ACE_UINT32 compression_level = 0); // Must be inherited.
virtual void update_stats( ACE_UINT64 uncompressed_bytes,
ACE_UINT64 compressed_bytes );
private:
ACE_CompressorId compressor_id_;
ACE_UINT32 compression_level_;
// Ensure we can lock with imutability (i.e. const)
mutable ACE_SYNCH_MUTEX mutex_;
ACE_UINT64 compressed_bytes_;
ACE_UINT64 uncompressed_bytes_;
ACE_UNIMPLEMENTED_FUNC (ACE_Compressor (const ACE_Compressor&))
ACE_UNIMPLEMENTED_FUNC (ACE_Compressor& operator= (const ACE_Compressor&))
};
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__ACE_INLINE__)
#include "Compressor.inl"
#endif /* __ACE_INLINE__ */
#include /**/ "ace/post.h"
#endif // ACE_COMPRESSOR_H
+16
View File
@@ -0,0 +1,16 @@
// -*- C++ -*-
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_INLINE ACE_CompressorId
ACE_Compressor::get_compressor_id(void) const
{
return this->compressor_id_;
}
ACE_INLINE ACE_UINT32
ACE_Compressor::get_compression_level(void) const
{
return this->compression_level_;
}
ACE_END_VERSIONED_NAMESPACE_DECL
+18
View File
@@ -0,0 +1,18 @@
// -*- MPC -*-
project(ACE_RLECompression) : ace_compressionlib, install, ace_output {
sharedname = *
dynamicflags += ACE_RLECOMPRESSION_BUILD_DLL
Source_Files {
RLECompressor.cpp
}
Header_Files {
RLECompressor.h
ACE_RLECompression_export.h
}
specific {
install_dir = ace/Compression/rle
}
}
@@ -0,0 +1,56 @@
// -*- C++ -*-
// Definition for Win32 Export directives.
// This file is generated automatically by generate_export_file.pl ACE_RLECompression
// ------------------------------
#ifndef ACE_RLECOMPRESSION_EXPORT_H
#define ACE_RLECOMPRESSION_EXPORT_H
#include "ace/config-all.h"
#if defined (ACE_AS_STATIC_LIBS) && !defined (ACE_RLECOMPRESSION_HAS_DLL)
# define ACE_RLECOMPRESSION_HAS_DLL 0
#endif /* ACE_AS_STATIC_LIBS && ACE_RLECOMPRESSION_HAS_DLL */
#if !defined (ACE_RLECOMPRESSION_HAS_DLL)
# define ACE_RLECOMPRESSION_HAS_DLL 1
#endif /* ! ACE_RLECOMPRESSION_HAS_DLL */
#if defined (ACE_RLECOMPRESSION_HAS_DLL) && (ACE_RLECOMPRESSION_HAS_DLL == 1)
# if defined (ACE_RLECOMPRESSION_BUILD_DLL)
# define ACE_RLECompression_Export ACE_Proper_Export_Flag
# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_EXPORT_SINGLETON_DECLARATION (T)
# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_EXPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# else /* ACE_RLECOMPRESSION_BUILD_DLL */
# define ACE_RLECompression_Export ACE_Proper_Import_Flag
# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T) ACE_IMPORT_SINGLETON_DECLARATION (T)
# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK) ACE_IMPORT_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
# endif /* ACE_RLECOMPRESSION_BUILD_DLL */
#else /* ACE_RLECOMPRESSION_HAS_DLL == 1 */
# define ACE_RLECompression_Export
# define ACE_RLECOMPRESSION_SINGLETON_DECLARATION(T)
# define ACE_RLECOMPRESSION_SINGLETON_DECLARE(SINGLETON_TYPE, CLASS, LOCK)
#endif /* ACE_RLECOMPRESSION_HAS_DLL == 1 */
// Set ACE_RLECOMPRESSION_NTRACE = 0 to turn on library specific tracing even if
// tracing is turned off for ACE.
#if !defined (ACE_RLECOMPRESSION_NTRACE)
# if (ACE_NTRACE == 1)
# define ACE_RLECOMPRESSION_NTRACE 1
# else /* (ACE_NTRACE == 1) */
# define ACE_RLECOMPRESSION_NTRACE 0
# endif /* (ACE_NTRACE == 1) */
#endif /* !ACE_RLECOMPRESSION_NTRACE */
#if (ACE_RLECOMPRESSION_NTRACE == 1)
# define ACE_RLECOMPRESSION_TRACE(X)
#else /* (ACE_RLECOMPRESSION_NTRACE == 1) */
# if !defined (ACE_HAS_TRACE)
# define ACE_HAS_TRACE
# endif /* ACE_HAS_TRACE */
# define ACE_RLECOMPRESSION_TRACE(X) ACE_TRACE_IMPL(X)
# include "ace/Trace.h"
#endif /* (ACE_RLECOMPRESSION_NTRACE == 1) */
#endif /* ACE_RLECOMPRESSION_EXPORT_H */
// End of auto generated file.
+145
View File
@@ -0,0 +1,145 @@
#include "RLECompressor.h"
#include "ace/OS_NS_string.h"
#if defined (__BORLANDC__) && (__BORLANDC__ >= 0x660) && (__BORLANDC__ <= 0x680)
# pragma option push -w-8072
#endif
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_RLECompressor::ACE_RLECompressor(void)
: ACE_Compressor(ACE_COMPRESSORID_RLE)
{
}
ACE_RLECompressor::~ACE_RLECompressor(void)
{
}
// Compress using Run Length Encoding (RLE)
ACE_UINT64
ACE_RLECompressor::compress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len )
{
const ACE_Byte *in_p = static_cast<const ACE_Byte *>(in_ptr);
ACE_Byte *out_p = static_cast<ACE_Byte *>(out_ptr);
ACE_UINT64 src_len = in_len; // Save for stats
ACE_UINT64 out_index = 0;
ACE_UINT64 out_base = 0;
size_t run_count = 0;
bool run_code = false;
if (in_p && out_p && in_len) {
while (in_len-- > 0) {
ACE_Byte cur_byte = *in_p++;
switch (out_index ? run_count : 128U) { // BootStrap to 128
case 128:
if ((out_base = out_index++) >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
}
run_code = false;
run_count = 0; // Switch off compressing
// Fall Through
default:
// Fix problem where input exhaused but maybe compressing
if (in_len ? cur_byte == *in_p : run_code) {
if (run_code) { // In Compression?
out_p[out_base] = ACE_Byte(run_count++ | 0x80);
continue; // Stay in Compression
} else if (run_count) { // Xfering to Compression
if ((out_base = out_index++) >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
}
run_count = 0;
}
run_code = true; // We Are Now Compressing
} else if (run_code) { // Are we in Compression?
// Finalise the Compression Run Length
out_p[out_base] = ACE_Byte(run_count | 0x80);
// Reset for Uncmpressed
if (in_len && (out_base = out_index++) >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
}
run_code = false;
run_count = 0;
continue; // Now restart Uncompressed
}
break;
}
out_p[out_base] = ACE_Byte(run_count++ | (run_code ? 0x80 : 0));
if (out_index >= max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
}
out_p[out_index++] = cur_byte;
}
this->update_stats(src_len, out_index);
}
return out_index; // return as our output length
}
// Decompress using Run Length Encoding (RLE)
ACE_UINT64
ACE_RLECompressor::decompress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len )
{
ACE_UINT64 out_len = 0;
const ACE_Byte *in_p = static_cast<const ACE_Byte *>(in_ptr);
ACE_Byte *out_p = static_cast<ACE_Byte *>(out_ptr);
if (in_p && out_p) while(in_len-- > 0) {
ACE_Byte cur_byte = *in_p++;
ACE_UINT32 cpy_len = ACE_UINT32((cur_byte & ACE_CHAR_MAX) + 1);
if (cpy_len > max_out_len) {
return ACE_UINT64(-1); // Output Exhausted
} else if ((cur_byte & 0x80) != 0) { // compressed
if (in_len-- > 0) {
ACE_OS::memset(out_p, *in_p++, cpy_len);
} else {
return ACE_UINT64(-1); // Output Exhausted
}
} else if (in_len >= cpy_len) {
ACE_OS::memcpy(out_p, in_p, cpy_len);
in_p += cpy_len;
in_len -= cpy_len;
} else {
return ACE_UINT64(-1); // Output Exhausted
}
out_p += cpy_len;
max_out_len -= cpy_len;
out_len += cpy_len;
}
return out_len;
}
ACE_SINGLETON_TEMPLATE_INSTANTIATE(ACE_Singleton, ACE_RLECompressor, ACE_SYNCH_MUTEX);
// Close versioned namespace, if enabled by the user.
ACE_END_VERSIONED_NAMESPACE_DECL
#if defined (__BORLANDC__) && (__BORLANDC__ >= 0x660) && (__BORLANDC__ <= 0x680)
# pragma option pop
#endif
+106
View File
@@ -0,0 +1,106 @@
// -*- C++ -*-
//=============================================================================
/**
* @file RLECompressor.h
*
* @author TAO version by
* @author Derek Dominish <derek.dominish@dsto.defence.gov.au>
* @author ACE version by
* @author Derek Dominish <derek.dominish@dsto.defence.gov.au>
*
* Run-length encoding (RLE) is a very simple form of data compression
* in which runs of data (that is, sequences in which the same data value
* occurs in many consecutive data elements) are stored as a single data
* value and count, rather than as the original run. This is most useful
* on data that contains many such runs: for example, simple graphic
* images such as icons, line drawings, and animations. It is not useful
* with files that don't have many runs as it could slightly increase the
* output size.
* ALGORITHM: This algorithm is an optimized version of the traditional
* RLE algorithm in that it behaves better with very few runs.
*
* With a run of a character where that run is >= 3 this is
* replaced with the repeat indicator 0X80 and then the repeat count OR'd
* over this ident. This repeat count is therefore has a maximum value
* of 127 (0x7F) which is to be interpreted as the next character repeated
* another 'repeat count' times (i.e. a maximum of 128 characters can be
* represented in any single dupal). if the repeat ident is not present
* then the count is to be interpreted as a copy of the next repeat count
* characters + 1.
*
* EXAMPLE: the following arbitary string of 67 bytes:-
* WWWWWWWWWWWWBWWWWWWWWWWWWBBBWWWWWWWWWWWWWWWWWWWWWWWWBWWWWWWWWWWWWWW
* will produce (as a HEXDUMP) of 14 bytes
* 8B 57 00 42 8B 57 82 42 97 57 00 42 8D 57 .W.B.W.B.W.B.W
*/
//=============================================================================
#ifndef ACE_RLECOMPRESSOR_H
#define ACE_RLECOMPRESSOR_H
#include /**/ "ace/pre.h"
#include "ACE_RLECompression_export.h"
#if !defined (ACE_LACKS_PRAGMA_ONCE)
# pragma once
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Compression/Compressor.h"
#include "ace/Singleton.h"
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
class ACE_RLECompression_Export ACE_RLECompressor : public ACE_Compressor
{
public:
/**
* Default constructor. Should use instance() to get global instance.
*/
ACE_RLECompressor(void);
virtual ~ACE_RLECompressor(void);
/**
* Compress the @a in_ptr buffer for @a in_len into the
* @a dest_ptr buffer with a maximum @a max_out_len using
* the Run Length Ecoding (RLE) algorithm. If the
* @a max_out_len is exhausted through the compress process
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr compressed buffer length.
*
* @note It is advisable that the @max_out_len be slightly
* larger of the input @a in_len (i.e. x 1.1F) to cater
* for the possibility that a reduced compressed length
* is not possible.
*/
virtual ACE_UINT64 compress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len );
/**
* DeCompress the @a in_ptr buffer for @a in_len into the
* @a out_ptr buffer with a maximum @a max_out_len using
* the Run Length Ecoding (RLE) algorithm. If the
* @a max_out_len is exhausted during decompression
* then a value of -1 will be returned from the function,
* otherwise the return value will indicate the resultant
* @a out_ptr decompressed buffer length.
*/
virtual ACE_UINT64 decompress( const void *in_ptr,
ACE_UINT64 in_len,
void *out_ptr,
ACE_UINT64 max_out_len );
};
ACE_RLECOMPRESSION_SINGLETON_DECLARE(ACE_Singleton, ACE_RLECompressor, ACE_SYNCH_MUTEX);
typedef class ACE_Singleton<ACE_RLECompressor, ACE_SYNCH_MUTEX> ACE_RLECompression;
ACE_END_VERSIONED_NAMESPACE_DECL
#include /**/ "ace/post.h"
#endif // ACE_RLECOMPRESSOR_H