mCRL2
|
Writes terms in a streamable binary aterm format to an output stream. More...
#include <aterm_io_binary.h>
Public Member Functions | |
binary_aterm_ostream (std::ostream &os) | |
Provide the output stream to which the terms are written. | |
binary_aterm_ostream (std::shared_ptr< mcrl2::utilities::obitstream > stream) | |
~binary_aterm_ostream () override | |
void | put (const aterm &term) override |
Writes an aterm in a compact binary format where subterms are shared. The term that is written itself is not shared whenever it occurs as the argument of another term. | |
![]() | |
virtual | ~aterm_ostream () |
virtual void | put (const aterm &term)=0 |
Write the given term to the stream. | |
![]() | |
virtual | ~aterm_stream () |
void | set_transformer (aterm_transformer transformer) |
Sets the given transformer to be applied to following writes. | |
aterm_transformer * | get_transformer () const |
Private Member Functions | |
std::size_t | write_function_symbol (const function_symbol &symbol) |
Write a function symbol to the output stream. | |
unsigned int | term_index_width () |
unsigned int | function_symbol_index_width () |
Private Attributes | |
std::shared_ptr< mcrl2::utilities::obitstream > | m_stream |
unsigned int | m_term_index_width |
caches the result of term_index_width(). | |
unsigned int | m_function_symbol_index_width |
caches the result of function_symbol_index_width(). | |
atermpp::indexed_set< aterm > | m_terms |
An index of already written terms. | |
mcrl2::utilities::indexed_set< function_symbol > | m_function_symbols |
An index of already written function symbols. | |
Additional Inherited Members | |
![]() | |
aterm_transformer * | m_transformer = identity |
Writes terms in a streamable binary aterm format to an output stream.
The streamable aterm format:
Aterms (and function symbols) are written as packets (with an identifier in the header) and their indices are derived from the number of aterms, resp. symbols, that occur before them in this stream. For each term we first ensure that its arguments and symbol are written to the stream (avoiding duplicates). Then its symbol index followed by a number of indices (depending on the arity) for its argments are written as integers. Packet headers also contain a special value to indicate that the read term should be visible as output as opposed to being only a subterm. The start of the stream is a zero followed by a header and a version and a term with function symbol index zero indicates the end of the stream.
Definition at line 34 of file aterm_io_binary.h.
atermpp::binary_aterm_ostream::binary_aterm_ostream | ( | std::ostream & | os | ) |
Provide the output stream to which the terms are written.
Definition at line 68 of file aterm_io_binary.cpp.
atermpp::binary_aterm_ostream::binary_aterm_ostream | ( | std::shared_ptr< mcrl2::utilities::obitstream > | stream | ) |
Definition at line 55 of file aterm_io_binary.cpp.
|
override |
Definition at line 72 of file aterm_io_binary.cpp.
|
private |
Definition at line 187 of file aterm_io_binary.cpp.
|
overridevirtual |
Writes an aterm in a compact binary format where subterms are shared. The term that is written itself is not shared whenever it occurs as the argument of another term.
Implements atermpp::aterm_ostream.
Definition at line 95 of file aterm_io_binary.cpp.
|
private |
Definition at line 181 of file aterm_io_binary.cpp.
|
private |
Write a function symbol to the output stream.
Definition at line 218 of file aterm_io_binary.cpp.
|
private |
caches the result of function_symbol_index_width().
Definition at line 60 of file aterm_io_binary.h.
|
private |
An index of already written function symbols.
Definition at line 63 of file aterm_io_binary.h.
|
private |
Definition at line 57 of file aterm_io_binary.h.
|
private |
caches the result of term_index_width().
Definition at line 59 of file aterm_io_binary.h.
|
private |
An index of already written terms.
Definition at line 62 of file aterm_io_binary.h.