YARP
Yet Another Robot Platform
NameService.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3  * SPDX-FileCopyrightText: 2006-2010 RobotCub Consortium
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #ifndef YARPDB_NAMESERVICE_INC
8 #define YARPDB_NAMESERVICE_INC
9 
10 #include <yarp/name/api.h>
11 #include <yarp/os/Bottle.h>
12 #include <yarp/os/Contact.h>
13 #include <yarp/os/NameStore.h>
14 
15 namespace yarp {
26  namespace name {
27  class NameService;
28  }
29 }
30 
37 public:
38  virtual ~NameService() {}
39 
40  virtual bool apply(yarp::os::Bottle& cmd,
41  yarp::os::Bottle& reply,
42  yarp::os::Bottle& event,
43  const yarp::os::Contact& remote) = 0;
44 
45  virtual void onEvent(yarp::os::Bottle& event) {}
46 
47  virtual void lock() {}
48  virtual void unlock() {}
49 
50  virtual void goPublic() {}
51 
52  yarp::os::Contact query(const std::string& name) override {
53  return yarp::os::Contact();
54  }
55 
56  bool announce(const std::string& name, int activity) override {
57  return false;
58  }
59 
62  const yarp::os::Contact& remote) override;
63 };
64 
65 
66 #endif
Abstract interface for a name server operator.
Definition: NameService.h:36
bool announce(const std::string &name, int activity) override
Definition: NameService.h:56
virtual void onEvent(yarp::os::Bottle &event)
Definition: NameService.h:45
virtual void lock()
Definition: NameService.h:47
virtual void goPublic()
Definition: NameService.h:50
bool process(yarp::os::PortWriter &in, yarp::os::PortReader &out, const yarp::os::Contact &remote) override
Definition: NameService.cpp:13
virtual void unlock()
Definition: NameService.h:48
virtual bool apply(yarp::os::Bottle &cmd, yarp::os::Bottle &reply, yarp::os::Bottle &event, const yarp::os::Contact &remote)=0
yarp::os::Contact query(const std::string &name) override
Definition: NameService.h:52
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:74
Represents how to reach a part of a YARP network.
Definition: Contact.h:36
Abstract interface for a database of port names.
Definition: NameStore.h:20
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:25
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:24
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_name_API
Definition: api.h:17