Street, formatter, serialize (-)

xiaoxiao2021-03-06  41

The transplantation BT has been carried out for two weeks, and the last part of the code is left. Deeply experience the pain of different compilers to the developers to the developers. Today's mental state is not very good, the development ideas are a bit blocked, just doing this time's ideas.

A few days ago, I saw an article on the programmer, I feel that it is not very deep. Plus the base library developed has also entered the second version, and we also want to say two sentences. If there is any omission, please correct it.

Explain a few concepts of the title before writing

Stream all can be used as a stream of readable or writable. For example, FStream, Memstream, SockStream, DatabaseStream, HttpStream, etc. Stream controls data from the source and go. Formatter formatter is a stream operator, which is modified to read and write. He is responsible for streaming data format serialize serialization is a well-known concept, which is an important means of persistence and object transmission. I remember that there is a summary, serialization is at another time, or another space, there is a copy of this object. In fact, Serialize is a special example of formatter, explained below.

Stream

And the program is from the data flow

Input ---> Processing ----> Output

Use C to explain

iStream -> Process ----> Ostream

STREAM now

FSTREAM's Operation of File (Standard Library) SockStream's Operation of Strings (Socket : http://www.linuxhacker.at/socketxx) MemStream's operation (SSP: Netease P2P) Platform) HTTPStream's data to HTTP (SSP: Under Developing) Database Stream Database Flow

With these streams, developers can free from repeated data reads and data storage

For example, to develop a network program, the job to do is the following

Protocol :: ping ping;

SockStream (SOCK: DATAGRAM) DS;

DS-> Connect (Serv, Port)

DS << ping << Endl;

After accepting ping, after processing, save it in the database

Protocol :: Object * Obj;

SockStream (SOCK: DATAGRAM) DS

DS-> bind (port);

DS >> OBJ;

DBSTREAM DBS;

DBS .Open ("protocol. ping");

DBS << obj << endl;

Is it very convenient to program?

转载请注明原文地址:https://www.9cbs.com/read-116284.html

New Post(0)