Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
Public Member Functions | Protected Member Functions | Private Attributes | Static Private Attributes | List of all members
CScriptCompressor Class Reference

Compact serializer for scripts. More...

#include <script.h>

Collaboration diagram for CScriptCompressor:
Collaboration graph
[legend]

Public Member Functions

 CScriptCompressor (CScript &scriptIn)
 
unsigned int GetSerializeSize (int nType, int nVersion) const
 
template<typename Stream >
void Serialize (Stream &s, int nType, int nVersion) const
 
template<typename Stream >
void Unserialize (Stream &s, int nType, int nVersion)
 

Protected Member Functions

bool IsToKeyID (CKeyID &hash) const
 
bool IsToScriptID (CScriptID &hash) const
 
bool IsToPubKey (CPubKey &pubkey) const
 
bool Compress (std::vector< unsigned char > &out) const
 
unsigned int GetSpecialSize (unsigned int nSize) const
 
bool Decompress (unsigned int nSize, const std::vector< unsigned char > &out)
 

Private Attributes

CScriptscript
 

Static Private Attributes

static const unsigned int nSpecialScripts = 6
 

Detailed Description

Compact serializer for scripts.

It detects common cases and encodes them much more efficiently. 3 special cases are defined:

Other scripts up to 121 bytes require 1 byte + script length. Above that, scripts up to 16505 bytes require 2 bytes + script length.

Definition at line 606 of file script.h.

Constructor & Destructor Documentation

CScriptCompressor::CScriptCompressor ( CScript scriptIn)
inline

Definition at line 630 of file script.h.

Member Function Documentation

bool CScriptCompressor::Compress ( std::vector< unsigned char > &  out) const
protected

Definition at line 1819 of file script.cpp.

bool CScriptCompressor::Decompress ( unsigned int  nSize,
const std::vector< unsigned char > &  out 
)
protected

Definition at line 1859 of file script.cpp.

unsigned int CScriptCompressor::GetSerializeSize ( int  nType,
int  nVersion 
) const
inline

Definition at line 632 of file script.h.

unsigned int CScriptCompressor::GetSpecialSize ( unsigned int  nSize) const
protected

Definition at line 1850 of file script.cpp.

bool CScriptCompressor::IsToKeyID ( CKeyID hash) const
protected

Definition at line 1783 of file script.cpp.

bool CScriptCompressor::IsToPubKey ( CPubKey pubkey) const
protected

Definition at line 1804 of file script.cpp.

bool CScriptCompressor::IsToScriptID ( CScriptID hash) const
protected

Definition at line 1794 of file script.cpp.

template<typename Stream >
void CScriptCompressor::Serialize ( Stream &  s,
int  nType,
int  nVersion 
) const
inline

Definition at line 641 of file script.h.

template<typename Stream >
void CScriptCompressor::Unserialize ( Stream &  s,
int  nType,
int  nVersion 
)
inline

Definition at line 653 of file script.h.

Member Data Documentation

const unsigned int CScriptCompressor::nSpecialScripts = 6
staticprivate

Definition at line 613 of file script.h.

CScript& CScriptCompressor::script
private

Definition at line 615 of file script.h.


The documentation for this class was generated from the following files: