Octane v1.01.20 - The Open Compression Toolkit for C++ http://octane.sourceforge.net/
Homepage | Main | Modules | Class Hierarchy | Compound List | File List | Compound Members | Related Pages

OctaneClass Class Reference
[Core]

#include <octaneclass.hpp>

Inheritance diagram for OctaneClass:

CompressorManager OctaneCoder OctaneCompressor OctaneModeler OctaneParser OctaneTester SymbolWeightVector HuffmanCoder SampleCoder mtfllCompressor OctaneCompressor_Statistical SampleCompressor zleCompressor OctaneModeler_WeightVectored BitParser SampleParser SubstringParser List of all members.

Detailed Description

Base class from which most octane classes derive (including parser,coder,modeler,etc).

Definition at line 32 of file octaneclass.hpp.

Public Member Functions

 OctaneClass ()
 constructor

virtual ~OctaneClass ()
 destructor

virtual std::string GetName ()
 provide a unique name for the coder, used in some cases to automatically register the object with a manager

virtual std::string GetDescription ()
 optionally provide a longer (maybe 20-60 characters) description

virtual std::string GetHelpInformation ()
 optionally provide more information about the object on request for help

virtual void ShowDebuggingInfo ()
 show any debugging info on request (used by various derived classes) [optional]

virtual unsigned int GetMemoryUsed ()
 Report actual current memory usage (in bytes).

virtual unsigned int GetDiskspaceUsed (bool fortempdecompressiononly)
 Report disk space (in bytes) that would be used when saving state to file (in bytes).

virtual std::string GetParametersInformation ()
 Reports information about any parameters available.

virtual void SetDefaultParameters ()
 Reset any parameters to their default values.

virtual bool SetParameter (const std::string &parametername, const std::string &parametervalue)
 This function is called to set a variable value.

virtual bool SaveState (bitwriter &to, bool fortempdecompressiononly)
 Save state of object to output stream (if appropriate).

virtual bool LoadState (bitreader &from)
 Load state of object from input stream (if appropriate).


Static Public Member Functions

void NiceifyHighAsciiString (std::string &str)
 static helper to convert a raw binary string into a string which is displayable on screen

std::string PrefixNonEmptyString (const std::string headerstr, const std::string str)
 prefix a string (can contain newlines) with a header, IFF the string is non-empty


Protected Member Functions

virtual bool DoProtectedSaveState (bitwriter &to, bool fortempdecompressiononly)
 Save the state of the object - this is the virtual function that derived classes should override.

virtual bool DoProtectedLoadState (bitreader &from)
 Load the state of the object - this is the virtual function that derived classes should override.


Static Protected Member Functions

bool ParseParameter (const std::string &parametervalue, unsigned int &param)
 get value of an unsinged int parameter

bool ParseParameter (const std::string &parametervalue, int &param)
 get value of an int parameter

bool ParseParameter (const std::string &parametervalue, unsigned char &param)
 get value of an an unsigned char parameter

bool ParseParameter (const std::string &parametervalue, char &param)
 get value of a char parameter

bool ParseParameter (const std::string &parametervalue, bool &param)
 get value of a bool parameter


Member Function Documentation

virtual std::string OctaneClass::GetName  )  [inline, virtual]
 

provide a unique name for the coder, used in some cases to automatically register the object with a manager

Returns:
a short *unique* name

Reimplemented in OctaneCoder, HuffmanCoder, SampleCoder, OctaneCompressor, OctaneModeler, SampleModeler, OctaneModeler_WeightVectored, ZeroOrderModeler, SymbolWeightVector, and OctaneParser.

Definition at line 46 of file octaneclass.hpp.

00046 {return "OctaneClass";}

virtual std::string OctaneClass::GetDescription  )  [inline, virtual]
 

optionally provide a longer (maybe 20-60 characters) description

Returns:
a one line description

Reimplemented in OctaneCoder, HuffmanCoder, SampleCoder, OctaneCompressor, mtfllCompressor, SampleCompressor, SampleStatCompressor, OctaneCompressor_Statistical, SubStrHuffCompressor, zleCompressor, OctaneModeler, SampleModeler, OctaneModeler_WeightVectored, ZeroOrderModeler, SymbolWeightVector, and OctaneParser.

Definition at line 49 of file octaneclass.hpp.

00049 {return "Base Octane Class";}

virtual std::string OctaneClass::GetHelpInformation  )  [inline, virtual]
 

optionally provide more information about the object on request for help

Returns:
a long string (can be multiple
newlines)

Reimplemented in OctaneCoder, HuffmanCoder, SampleCoder, OctaneCompressor, OctaneCompressor_Statistical, OctaneModeler, SymbolWeightVector, and OctaneParser.

Definition at line 52 of file octaneclass.hpp.

00052 { return ""; }

virtual bool OctaneClass::SetParameter const std::string &  parametername,
const std::string &  parametervalue
[inline, virtual]
 

This function is called to set a variable value.

Note:
this can be called with a variable not owned by this class, in which case the function should return false.
Returns:
true if the variable was found (whether it was set properly or not).

Reimplemented in SampleCompressor, OctaneCompressor_Statistical, BitParser, SampleParser, and SubstringParser.

Definition at line 70 of file octaneclass.hpp.

Referenced by OctaneTester::ParseCommand(), and OctaneCompressor_Statistical::SetParameter().

00070 {return false;};

virtual bool OctaneClass::SaveState bitwriter to,
bool  fortempdecompressiononly
[inline, virtual]
 

Save state of object to output stream (if appropriate).

Returns:
true on success (or if no information needs to be saved).

Reimplemented in OctaneModeler_WeightVectored, SymbolWeightVector, BitParser, SampleParser, and SubstringParser.

Definition at line 73 of file octaneclass.hpp.

References DoProtectedSaveState().

Referenced by OctaneCompressor_Statistical::DoProtectedSaveState().

00073 {return DoProtectedSaveState(to,fortempdecompressiononly);};

virtual bool OctaneClass::LoadState bitreader from  )  [inline, virtual]
 

Load state of object from input stream (if appropriate).

Returns:
true on success (or if no information needs to be loaded).

Reimplemented in OctaneCompressor, OctaneModeler_WeightVectored, SymbolWeightVector, BitParser, SampleParser, and SubstringParser.

Definition at line 76 of file octaneclass.hpp.

References DoProtectedLoadState().

Referenced by OctaneCompressor_Statistical::DoProtectedLoadState().

00076 {return DoProtectedLoadState(from);};

bool OctaneClass::ParseParameter const std::string &  parametervalue,
unsigned int &  param
[inline, static, protected]
 

get value of an unsinged int parameter

Returns:
true on success

Definition at line 92 of file octaneclass.hpp.

Referenced by SubstringParser::SetParameter(), and SampleCompressor::SetParameter().

00092 {param=(unsigned int)(atoi(parametervalue.c_str()));return true;}

bool OctaneClass::ParseParameter const std::string &  parametervalue,
int &  param
[inline, static, protected]
 

get value of an int parameter

Returns:
true on success

Definition at line 95 of file octaneclass.hpp.

00095 {param=(int)(atoi(parametervalue.c_str()));return true;}

bool OctaneClass::ParseParameter const std::string &  parametervalue,
unsigned char &  param
[inline, static, protected]
 

get value of an an unsigned char parameter

Returns:
true on success

Definition at line 98 of file octaneclass.hpp.

00098 {param=(unsigned char)(atoi(parametervalue.c_str()));return true;}

bool OctaneClass::ParseParameter const std::string &  parametervalue,
char &  param
[inline, static, protected]
 

get value of a char parameter

Returns:
true on success

Definition at line 101 of file octaneclass.hpp.

00101 {param=(char)(atoi(parametervalue.c_str()));return true;}

bool OctaneClass::ParseParameter const std::string &  parametervalue,
bool &  param
[static, protected]
 

get value of a bool parameter

Returns:
true on success

Definition at line 20 of file octaneclass.cpp.

00021 {
00022         // convert and store a bool parameter value
00023         // ATTN: this is case sensitive and should be changed to case-insensitive
00024         if (parametervalue == "true")
00025                 param = true;
00026         else if (parametervalue == "false")
00027                 param = false;
00028         else if (atoi(parametervalue.c_str()) == 0)
00029                 param = false;
00030         else if (atoi(parametervalue.c_str()) == 1)
00031                 param = true;
00032         else
00033                 return false;
00034         return true;
00035 }

virtual bool OctaneClass::DoProtectedSaveState bitwriter to,
bool  fortempdecompressiononly
[inline, protected, virtual]
 

Save the state of the object - this is the virtual function that derived classes should override.

It is wrapped by the non-virtual function SaveState() above which can perform some timing and size measurements.

Reimplemented in OctaneCompressor, SampleCompressor, and OctaneCompressor_Statistical.

Definition at line 112 of file octaneclass.hpp.

Referenced by SaveState().

00112 {return true;};

virtual bool OctaneClass::DoProtectedLoadState bitreader from  )  [inline, protected, virtual]
 

Load the state of the object - this is the virtual function that derived classes should override.

It is wrapped by the non-virtual function LoadState() above which can perform some timing and size measurements.

Reimplemented in OctaneCompressor, SampleCompressor, and OctaneCompressor_Statistical.

Definition at line 115 of file octaneclass.hpp.

Referenced by LoadState().

00115 {return true;};


The documentation for this class was generated from the following files:  
Generated on 20 May 2004 by doxygen 1.3.3