RIT VEXU Core API
Loading...
Searching...
No Matches
VDP::String Class Reference

#include <types.hpp>

Inheritance diagram for VDP::String:
VDP::Part

Public Member Functions

 String (std::string name, FetchFunc fetcher=[]() { return "no value";})
 
void fetch () override
 
void response () override
 
void set_value (std::string new_value)
 
std::string get_value ()
 
void read_data_from_message (PacketReader &reader) override
 
void pprint (std::stringstream &ss, size_t indent) const override
 
void pprint_data (std::stringstream &ss, size_t indent) const override
 
- Public Member Functions inherited from VDP::Part
 Part (std::string name)
 
std::string pretty_print () const
 
std::string pretty_print_data () const
 

Protected Member Functions

void write_schema (PacketWriter &sofar) const override
 
void write_message (PacketWriter &sofar) const override
 

Detailed Description

A string type conveyed as a part

Constructor & Destructor Documentation

◆ String()

VDP::String::String ( std::string field_name,
FetchFunc fetcher = []() { return "no value"; } )
explicit

creates a string type conveyed as a part with a name and a fetcher

Parameters
namename of the string to have
fetcherthe fetch function to use when running fetch()

creates a string type conveyed as a part with a name and a fetcher

Parameters
namename of the string to have
fetcherthe fetcher function to use when assigning it new data

Member Function Documentation

◆ fetch()

void VDP::String::fetch ( )
overridevirtual

function to run when fetching this part, runs the fetch function

used to assign the string new data, runs the fetch function

Implements VDP::Part.

◆ get_value()

std::string VDP::String::get_value ( )
Returns
the currently stored string

◆ pprint()

void VDP::String::pprint ( std::stringstream & ss,
size_t indent ) const
overridevirtual

changes a stringstream to be formatted as name: string

Parameters
ssthe stringstream to change
indentthe amount of indents to use

Implements VDP::Part.

◆ pprint_data()

void VDP::String::pprint_data ( std::stringstream & ss,
size_t indent ) const
overridevirtual

changes a stringstream to be formatted as name: value

Parameters
ssthe stringstream to change
indentthe amount of indents to use

Implements VDP::Part.

◆ read_data_from_message()

void VDP::String::read_data_from_message ( PacketReader & reader)
overridevirtual

sets the string part's value to the string read by a packet reader

Parameters
readerthe packet reader to get the string from

sets the string part's value to the string read by a packet reader

Parameters
readerthe part reader to get

Implements VDP::Part.

◆ response()

void VDP::String::response ( )
overridevirtual

function to run when receiving to this part

Reimplemented from VDP::Part.

◆ set_value()

void VDP::String::set_value ( std::string new_value)

sets the string part's value to the string given

Parameters
new_valuethe string to set the value to

◆ write_message()

void VDP::String::write_message ( PacketWriter & sofar) const
overrideprotectedvirtual

writes the strings data to a packet

Parameters
sofarthe packet writer to write with

Implements VDP::Part.

◆ write_schema()

void VDP::String::write_schema ( PacketWriter & sofar) const
overrideprotectedvirtual

writes the schematic for the string to a packet

Parameters
sofarthe packet writer to write with

Implements VDP::Part.


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