Revert "Minor modernization of DynamicAny code"
[ACE_TAO.git] / TAO / tao / ZIOP / ZIOP.h
blob64d4b66990be392cb4fb01592d78e4e610af51a3
1 // -*- C++ -*-
3 //=============================================================================
4 /**
5 * @file ZIOP.h
7 * Dynamic loader object for the ZIOP library
9 * @author Johnny Willemsen <jwillemsen@remedy.nl>
11 //=============================================================================
13 #ifndef TAO_ZIOP_H
14 #define TAO_ZIOP_H
15 #include /**/ "ace/pre.h"
17 #include "tao/ZIOP/ziop_export.h"
19 #if !defined (ACE_LACKS_PRAGMA_ONCE)
20 # pragma once
21 #endif /* ACE_LACKS_PRAGMA_ONCE */
23 #include "tao/PI/PI.h"
24 #include "tao/ZIOP_Adapter.h"
25 #include "tao/Compression/Compression.h"
26 #include "tao/Policy_Validator.h"
27 #include "ace/Service_Config.h"
29 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
31 class TAO_ServerRequest;
33 /**
34 * @class TAO_ZIOP_Loader
36 * @brief Class that loads the ZIOP library.
39 class TAO_ZIOP_Export TAO_ZIOP_Loader : public TAO_ZIOP_Adapter
41 public:
42 /// Constructor
43 TAO_ZIOP_Loader ();
45 /// Destructor
46 virtual ~TAO_ZIOP_Loader ();
48 virtual bool decompress (ACE_Data_Block **db, TAO_Queued_Data &qd, TAO_ORB_Core &orb_core);
50 // Compress the @a stream. Starting point of the compression is rd_ptr()
51 virtual bool marshal_data (TAO_OutputCDR &cdr, TAO_Stub &stub);
52 virtual bool marshal_data (TAO_OutputCDR &cdr, TAO_ORB_Core &orb_core, TAO_ServerRequest *request);
54 /// Initialize the BiDIR loader hooks.
55 virtual int init (int argc, ACE_TCHAR* []);
57 virtual void load_policy_validators (TAO_Policy_Validator &validator);
59 /// Used to force the initialization of the ORB code.
60 static int Initializer ();
62 /// Converts compressor ID to a compressor name.
63 static const char * ziop_compressorid_name (::Compression::CompressorId st);
65 private:
66 /// Set to true after init is called.
67 bool initialized_;
69 /// dump a ZIOP datablock after (de)compression
70 void dump_msg (const char *type, const u_char *ptr,
71 size_t len, size_t original_data_length,
72 ::Compression::CompressorId compressor_id,
73 ::Compression::CompressionLevel compression_level);
75 /// Get the compression low value, returns 0 when it is not set
76 CORBA::ULong compression_low_value (CORBA::Policy_ptr policy) const;
78 /// Get the compression min ratio value, returns 0 when it is not set
79 Compression::CompressionRatio compression_minratio_value (
80 CORBA::Policy_ptr policy) const;
82 bool get_compressor_details (
83 ::Compression::CompressorIdLevelList *list,
84 Compression::CompressorId &compressor_id,
85 Compression::CompressionLevel &compression_level);
87 bool get_compression_details(CORBA::Policy_ptr compression_enabling_policy,
88 CORBA::Policy_ptr compression_level_list_policy,
89 Compression::CompressorId &compressor_id,
90 Compression::CompressionLevel &compression_level);
92 bool complete_compression (Compression::Compressor_ptr compressor,
93 TAO_OutputCDR &cdr,
94 ACE_Message_Block& mb,
95 char *initial_rd_ptr,
96 CORBA::ULong low_value,
97 Compression::CompressionRatio min_ratio,
98 CORBA::ULong original_data_length,
99 Compression::CompressorId compressor_id);
101 bool compress_data (TAO_OutputCDR &cdr,
102 CORBA::Object_ptr compression_manager,
103 CORBA::ULong low_value,
104 ::Compression::CompressionRatio min_ratio,
105 ::Compression::CompressorId compressor_id,
106 ::Compression::CompressionLevel compression_level);
108 bool compress (Compression::Compressor_ptr compressor,
109 const ::Compression::Buffer &source,
110 ::Compression::Buffer &target);
112 bool decompress (Compression::Compressor_ptr compressor,
113 const ::Compression::Buffer &source,
114 ::Compression::Buffer &target);
116 ::Compression::CompressionRatio get_ratio (CORBA::OctetSeq& uncompressed,
117 CORBA::OctetSeq& compressed);
119 bool check_min_ratio (const ::Compression::CompressionRatio& this_ratio,
120 ::Compression::CompressionRatio overall_ratio,
121 ::Compression::CompressionRatio min_ratio) const;
124 static int
125 TAO_Requires_ZIOP_Initializer = TAO_ZIOP_Loader::Initializer ();
128 ACE_STATIC_SVC_DECLARE (TAO_ZIOP_Loader)
129 ACE_FACTORY_DECLARE (TAO_ZIOP, TAO_ZIOP_Loader)
131 TAO_END_VERSIONED_NAMESPACE_DECL
133 #define TAO_ZIOP_SAFE_INCLUDE
134 #include "tao/ZIOP/ZIOPC.h"
135 #undef TAO_ZIOP_SAFE_INCLUDE
137 #include /**/ "ace/post.h"
138 #endif /* TAO_ZIOP_H */