|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
38 if (fallback==
nullptr) {
39 fprintf(stderr,
"Cannot allocate ServerAdapter\n");
45 if (fallback!=
nullptr)
delete fallback;
49 std::string
apply(
const std::string& txt,
const Contact& remote)
override {
59 printf(
"ASKED %s, GAVE %s\n", txt.c_str(), result.c_str());
64 return fallback->
start();
77 fprintf(stderr,
"Cannot allocate ServerAdapter\n");
82 BootstrapServer::~BootstrapServer() {
90 bool BootstrapServer::start() {
97 bool BootstrapServer::stop() {
106 bool configFileRequired,
107 bool mayEditConfigFile) {
115 }
else if (configFileRequired) {
116 fprintf(stderr,
"Could not read configuration file %s\n",
123 if (suggest.
getHost() ==
"...") {
142 if (suggest.
getHost() ==
"...") {
147 if (!configFileRequired) {
150 fprintf(stderr,
"Overriding non-local address for name server\n");
155 if (betterHost!=suggest.
getHost()) {
156 fprintf(stderr,
"Overriding loopback address for name server\n");
162 bool changed =
false;
168 if (changed && !mayEditConfigFile) {
169 fprintf(stderr,
"PROBLEM: need to change settings in %s\n",
171 fprintf(stderr,
" Current settings: host %s port %d family %s\n",
174 fprintf(stderr,
" Desired settings: host %s port %d family %s\n",
176 fprintf(stderr,
"Please specify '--write' if it is ok to overwrite current settings, or\n");
177 fprintf(stderr,
"Please specify '--read' to use the current settings, or\n");
181 bool shouldSave = changed || !prev.
isValid();
187 fprintf(stderr,
"Could not save configuration file %s\n",
198 Contact addr = FallbackNameServer::getAddress();
A dummy connection to test yarp::os::Portable implementations.
std::string getConfigFileName(const char *stem=nullptr, const char *ns=nullptr)
static bool isLocalName(const std::string &name)
virtual ~BootstrapServerAdapter()
static std::string getHostName(bool prefer_loopback=false, const std::string &seed="")
Multi-cast server, for last resort information sharing about name information – when config files are...
ConnectionReader & getReader(ConnectionWriter *replyWriter=nullptr)
Get the dummy ConnectionReader loaded with whatever was written the ConnectionWriter since it was las...
std::string getNamespace(bool refresh=false)
std::string apply(const std::string &txt, const Contact &remote) override
Adapt YARP multicast server to use a different NameService.
void setAddress(const Contact &address)
An interface for writing to a network connection.
static void handler(int sig)
ConnectionWriter & getWriter()
Get the dummy ConnectionWriter loaded with whatever was written the ConnectionWriter since it was las...
bool toFile(bool clean=false)
Abstract interface for a name server operator.
Classes for constructing name servers.
BootstrapServerAdapter(NameService &owner)
void setTextMode(bool textmode)
Set the textMode of the dummy connection.
An interface to the operating system, including Port based communication.
virtual std::string expectText(const char terminatingChar='\n')=0
Read some text from the network connection.
bool fromFile(const char *ns=nullptr)
RandScalar * implementation(void *t)
Manage a single connection to the name server.
Stub for a YARP2-conforming name server.
Small helper class to help deal with legacy YARP configuration files.
The components from which ports and connections are built.
virtual void appendText(const std::string &str, const char terminate='\n')=0
Send a terminated string to the network connection.