Anoncoin  0.9.4
P2P Digital Currency
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:
[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 737 of file script.h.

Constructor & Destructor Documentation

CScriptCompressor::CScriptCompressor ( CScript scriptIn)
inline

Definition at line 761 of file script.h.

Member Function Documentation

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

Definition at line 1996 of file script.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 2036 of file script.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

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

Definition at line 763 of file script.h.

Here is the call graph for this function:

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

Definition at line 2027 of file script.cpp.

Here is the caller graph for this function:

bool CScriptCompressor::IsToKeyID ( CKeyID hash) const
protected

Definition at line 1960 of file script.cpp.

Here is the call graph for this function:

bool CScriptCompressor::IsToPubKey ( CPubKey pubkey) const
protected

Definition at line 1981 of file script.cpp.

Here is the call graph for this function:

bool CScriptCompressor::IsToScriptID ( CScriptID hash) const
protected

Definition at line 1971 of file script.cpp.

Here is the call graph for this function:

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

Definition at line 772 of file script.h.

Here is the call graph for this function:

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

Definition at line 784 of file script.h.

Here is the call graph for this function:

Member Data Documentation

const unsigned int CScriptCompressor::nSpecialScripts = 6
staticprivate

Definition at line 744 of file script.h.

CScript& CScriptCompressor::script
private

Definition at line 746 of file script.h.


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