|
YARP
Yet Another Robot Platform
|
|
Go to the documentation of this file.
26 #define MIN_PORT_NUMBER_OFFSET 2
27 #define MAX_PORT_NUMBER_OFFSET 9999
50 NameServerContainer::~NameServerContainer()
74 Network::registerContact(c);
80 std::string dbDefault =
":memory:";
81 std::string subdbDefault =
":memory:";
83 if (options.
check(
"memory")) {
84 yCWarning(NAMESERVERCONTAINER,
"The --memory option was given, but that is now a default. Continuing.");
87 std::string dbFilename = options.
check(
"portdb",
88 Value(dbDefault)).asString();
89 std::string subdbFilename = options.
check(
"subdb",
90 Value(subdbDefault)).asString();
92 std::string ip = options.
check(
"ip",
Value(
"...")).asString();
93 int sock = options.
check(
"socket",
Value(Network::getDefaultPortRange())).asInt32();
94 bool cautious = options.
check(
"cautious");
96 yCInfo(NAMESERVERCONTAINER,
"Using port database: %s", dbFilename.c_str());
97 yCInfo(NAMESERVERCONTAINER,
"Using subscription database: %s", subdbFilename.c_str());
98 if (dbFilename!=
":memory:" || subdbFilename!=
":memory:") {
99 yCInfo(NAMESERVERCONTAINER,
"If you ever need to clear the name server's state, just delete those files.");
101 yCInfo(NAMESERVERCONTAINER,
"IP address: %s", (ip==
"...")?
"default":ip.c_str());
102 yCInfo(NAMESERVERCONTAINER,
"Port number: %d", sock);
105 if (options.
check(
"ip")||options.
check(
"socket")) {
106 yCError(NAMESERVERCONTAINER,
"Database needs to be reset, IP or port number set.");
111 if (pmem ==
nullptr) {
112 yCError(NAMESERVERCONTAINER,
"Aborting, ports database failed to open.");
116 if (!subscriber.
open(subdbFilename)) {
117 yCError(NAMESERVERCONTAINER,
"Aborting, subscription database failed to open.");
121 contact =
Contact(
"...",
"tcp", ip, sock);
123 if (!options.
check(
"local")) {
124 if (!BootstrapServer::configFileBootstrap(contact,
125 options.
check(
"read"),
126 options.
check(
"write"))) {
127 yCError(NAMESERVERCONTAINER,
"Aborting.\n");
135 if (lstStr.find(
"rossrv") == std::string::npos ||
136 lstStr.find(
"tcpros") == std::string::npos ||
137 lstStr.find(
"xmlrpc") == std::string::npos) {
138 yCError(NAMESERVERCONTAINER,
"Missing one or more required carriers ");
139 yCError(NAMESERVERCONTAINER,
"for yarpserver --ros (rossrv, tcpros, xmlrpc).\n");
140 yCError(NAMESERVERCONTAINER,
"Run 'yarp connect --list-carriers' to see carriers on your machine\n");
141 yCError(NAMESERVERCONTAINER,
"Aborting.\n");
145 Contact c = Contact::fromString(addr);
152 yCInfo(NAMESERVERCONTAINER,
"Using ROS with ROS_MASTER_URI=%s\n", addr.c_str());
154 yCFatal(NAMESERVERCONTAINER,
"Cannot find ROS, check ROS_MASTER_URI (currently '%s')\n", addr.c_str());
160 alloc.
open(pmem,config);
161 ns.
open(pmem,&alloc,contact);
162 NetworkBase::queryBypass(&ns);
166 combo1.
open(subscriber,style);
A simple collection of objects that can be described and transmitted in a portable way.
void open(TripleSource *db, Allocator *alloc, const yarp::os::Contact &serverContact)
const yarp::os::Contact & where()
std::string toString() const override
Gives a human-readable textual representation of the bottle.
#define YARP_SERVERSQL_LOG_COMPONENT(name, name_string)
A base class for nested structures that can be searched.
#define yCWarning(component,...)
std::string getEnvironment(const char *key, bool *found=nullptr)
Read a variable from the environment.
Compose two name services into one.
Abstract view of a database as a collection of triples.
void setStore(yarp::os::NameStore &store)
void preregister(const yarp::os::Contact &c)
yarp::os::Contact whereDelegate()
bool open(const std::string &filename, bool fresh=false)
virtual Contact getNameServerContact() const =0
Get an address for a name server that manages the name space, if available.
#define MIN_PORT_NUMBER_OFFSET
bool welcome(const std::string &port, int activity) override
bool configure(const yarp::os::Searchable &options)
virtual bool check(const std::string &key) const =0
Check if there exists a property of the given name.
static Bottle listCarriers()
void setDelegate(yarp::os::NameSpace *delegate)
An abstract name space for ports.
#define yCError(component,...)
void setDelegate(yarp::os::NameSpace *delegate)
void setSubscriber(Subscriber *subscriber)
#define yCInfo(component,...)
Collection of carriers, a singleton.
TripleSource * open(const char *filename, bool cautious=false, bool fresh=false)
Utilities for manipulating the YARP network, including initialization and shutdown.
An implementation of name service operators on a triple store.
A single value (typically within a Bottle).
void open(NameService &ns1, NameService &ns2)
Multicast and file-based mechanisms for finding the name server.
void open(NameService &ns1, NameService &ns2)
Utilities for manipulating the YARP network, excluding initialization and shutdown.
#define MAX_PORT_NUMBER_OFFSET
void open(TripleSource *db, const AllocatorConfig &config)
#define yCFatal(component,...)