class QPanda::DRAW_TEXT_PIC::DrawPicture

Overview

draw text-picture More…

#include <Draw.h>

class DrawPicture
{
public:
    // construction

    DrawPicture(QProg prog, LayeredTopoSeq& layer_info, uint32_t length);

    // methods

    void init(std::vector<int>& quBits, std::vector<int>& clBits);
    std::string present(bool b_out_put_to_file = false);
    void mergeLine();
    int getMaxQuWireLength(WireIter start_quBit_wire, WireIter end_quBit_wire);
    void updateTextPicLen();
    unsigned long getWideCharVal(const unsigned char* wide_char);
    void check_time_sequence(TopoSeqIter cur_layer_iter);
    void update_time_sequence(Wire::sRef& p_wire, int increased_time_sequence);
    void append_time_sequence_line();
    void append_layer_line();
    void draw_by_layer();
    void draw_by_time_sequence(const std::string config_data = CONFIG_PATH);
    QVec get_qvec_difference(QVec& vec1, QVec& vec2);
};

Detailed Documentation

draw text-picture

Construction

DrawPicture(QProg prog, LayeredTopoSeq& layer_info, uint32_t length)

Constructor of DrawPicture.

Methods

void init(std::vector<int>& quBits, std::vector<int>& clBits)

initialize

Parameters:

std::vector<int>&

used qubits

std::vector<int>&

used class bits

std::string present(bool b_out_put_to_file = false)

display and return the target string

Returns:

std::string

void mergeLine()

merge wire line

int getMaxQuWireLength(WireIter start_quBit_wire, WireIter end_quBit_wire)

get the max length of quantum wire between start_quBit_wire and end_quBit_wire

Parameters:

WireIter

start quBit wire

WireIter

end quBit wire

Returns:

int the max length

void updateTextPicLen()

update TextPic length

unsigned long getWideCharVal(const unsigned char* wide_char)

get val of wide char

Parameters:

unsigned char*

the target wide char

Returns:

the val of the wide char

void check_time_sequence(TopoSeqIter cur_layer_iter)

check the target wire time sequence

Parameters:

TopoSeqIter

the target layer

void update_time_sequence(Wire::sRef& p_wire, int increased_time_sequence)

update the target wire time sequence

Parameters:

std::shared_ptr<Wire>

the target wire

int

increased time sequence

void append_time_sequence_line()

append time sequence line to text-picture

void append_layer_line()

append layer line to text-picture

void draw_by_layer()

draw text-picture by layer

void draw_by_time_sequence(const std::string config_data = CONFIG_PATH)

draw text-picture by time sequence

Parameters:

const

std::string It can be configuration file or configuration data, which can be distinguished by file suffix, so the configuration file must be end with “.json”, default is CONFIG_PATH

QVec get_qvec_difference(QVec& vec1, QVec& vec2)

get the difference of two QVecs

Returns:

QVec vec1 - vec2