Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Slic3r::Bonjour Class Reference

Bonjour lookup performer. More...

#include <src/slic3r/Utils/Bonjour.hpp>

+ Inheritance diagram for Slic3r::Bonjour:
+ Collaboration diagram for Slic3r::Bonjour:

Classes

struct  priv
 

Public Types

typedef std::shared_ptr< BonjourPtr
 
typedef std::function< void(BonjourReply &&)> ReplyFn
 
typedef std::function< void()> CompleteFn
 
typedef std::function< void(const std::vector< BonjourReply > &)> ResolveFn
 
typedef std::set< std::string > TxtKeys
 

Public Member Functions

 Bonjour (std::string service)
 
 Bonjour (Bonjour &&other)
 
 ~Bonjour ()
 
Bonjourset_protocol (std::string protocol)
 
Bonjourset_txt_keys (TxtKeys txt_keys)
 
Bonjourset_timeout (unsigned timeout)
 
Bonjourset_retries (unsigned retries)
 
Bonjourset_hostname (const std::string &hostname)
 
Bonjouron_reply (ReplyFn fn)
 
Bonjouron_complete (CompleteFn fn)
 
Bonjouron_resolve (ResolveFn fn)
 
Ptr lookup ()
 
Ptr resolve ()
 
void resolve_sync ()
 

Private Attributes

std::unique_ptr< privp
 

Detailed Description

Bonjour lookup performer.

Member Typedef Documentation

◆ CompleteFn

typedef std::function<void()> Slic3r::Bonjour::CompleteFn

◆ Ptr

typedef std::shared_ptr<Bonjour> Slic3r::Bonjour::Ptr

◆ ReplyFn

typedef std::function<void(BonjourReply &&)> Slic3r::Bonjour::ReplyFn

◆ ResolveFn

typedef std::function<void(const std::vector<BonjourReply>&)> Slic3r::Bonjour::ResolveFn

◆ TxtKeys

typedef std::set<std::string> Slic3r::Bonjour::TxtKeys

Constructor & Destructor Documentation

◆ Bonjour() [1/2]

Slic3r::Bonjour::Bonjour ( std::string  service)
1109 : p(new priv(std::move(service)))
1110{}
std::unique_ptr< priv > p
Definition Bonjour.hpp:90
Definition CutSurface.cpp:39

◆ Bonjour() [2/2]

Slic3r::Bonjour::Bonjour ( Bonjour &&  other)
1112: p(std::move(other.p)) {}

◆ ~Bonjour()

Slic3r::Bonjour::~Bonjour ( )
1115{
1116 if (p && p->io_thread.joinable()) {
1117 p->io_thread.detach();
1118 }
1119}

References p.

Member Function Documentation

◆ lookup()

Bonjour::Ptr Slic3r::Bonjour::lookup ( )
1170{
1171 auto self = std::make_shared<Bonjour>(std::move(*this));
1172
1173 if (self->p) {
1174 auto io_thread = std::thread([self]() {
1175 self->p->lookup_perform();
1176 });
1177 self->p->io_thread = std::move(io_thread);
1178 }
1179
1180 return self;
1181}

◆ on_complete()

Bonjour & Slic3r::Bonjour::on_complete ( CompleteFn  fn)
1158{
1159 if (p) { p->completefn = std::move(fn); }
1160 return *this;
1161}

References p.

◆ on_reply()

Bonjour & Slic3r::Bonjour::on_reply ( ReplyFn  fn)
1152{
1153 if (p) { p->replyfn = std::move(fn); }
1154 return *this;
1155}

References p.

Referenced by Slic3r::BonjourDialog::show_and_lookup().

+ Here is the caller graph for this function:

◆ on_resolve()

Bonjour & Slic3r::Bonjour::on_resolve ( ResolveFn  fn)
1164{
1165 if (p) { p->resolvefn = std::move(fn); }
1166 return *this;
1167}

References p.

Referenced by Slic3r::OctoPrint::upload().

+ Here is the caller graph for this function:

◆ resolve()

Bonjour::Ptr Slic3r::Bonjour::resolve ( )
1185{
1186 auto self = std::make_shared<Bonjour>(std::move(*this));
1187
1188 if (self->p) {
1189 auto io_thread = std::thread([self]() {
1190 self->p->resolve_perform();
1191 });
1192 self->p->io_thread = std::move(io_thread);
1193 }
1194
1195 return self;
1196}

◆ resolve_sync()

void Slic3r::Bonjour::resolve_sync ( )
1199{
1200 if (p)
1201 p->resolve_perform();
1202}

References p.

◆ set_hostname()

Bonjour & Slic3r::Bonjour::set_hostname ( const std::string &  hostname)
1140{
1141 if (p) { p->hostname = hostname; }
1142 return *this;
1143}

References p.

Referenced by Slic3r::OctoPrint::upload().

+ Here is the caller graph for this function:

◆ set_protocol()

Bonjour & Slic3r::Bonjour::set_protocol ( std::string  protocol)
1122{
1123 if (p) { p->protocol = std::move(protocol); }
1124 return *this;
1125}

References p.

◆ set_retries()

Bonjour & Slic3r::Bonjour::set_retries ( unsigned  retries)
1146{
1147 if (p && retries > 0) { p->retries = retries; }
1148 return *this;
1149}

References p.

Referenced by Slic3r::BonjourDialog::show_and_lookup(), and Slic3r::OctoPrint::upload().

+ Here is the caller graph for this function:

◆ set_timeout()

Bonjour & Slic3r::Bonjour::set_timeout ( unsigned  timeout)
1134{
1135 if (p) { p->timeout = timeout; }
1136 return *this;
1137}

References p.

Referenced by Slic3r::BonjourDialog::show_and_lookup(), and Slic3r::OctoPrint::upload().

+ Here is the caller graph for this function:

◆ set_txt_keys()

Bonjour & Slic3r::Bonjour::set_txt_keys ( TxtKeys  txt_keys)
1128{
1129 if (p) { p->txt_keys = std::move(txt_keys); }
1130 return *this;
1131}

References p.

Referenced by Slic3r::BonjourDialog::show_and_lookup().

+ Here is the caller graph for this function:

Member Data Documentation

◆ p


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