YARP
Yet Another Robot Platform
NameService.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006-2010 RobotCub Consortium
4  * All rights reserved.
5  *
6  * This software may be modified and distributed under the terms of the
7  * BSD-3-Clause license. See the accompanying LICENSE file for details.
8  */
9 
10 #ifndef YARPDB_NAMESERVICE_INC
11 #define YARPDB_NAMESERVICE_INC
12 
13 #include <yarp/name/api.h>
14 #include <yarp/os/Bottle.h>
15 #include <yarp/os/Contact.h>
16 #include <yarp/os/NameStore.h>
17 
18 namespace yarp {
29  namespace name {
30  class NameService;
31  }
32 }
33 
40 public:
41  virtual ~NameService() {}
42 
43  virtual bool apply(yarp::os::Bottle& cmd,
44  yarp::os::Bottle& reply,
45  yarp::os::Bottle& event,
46  const yarp::os::Contact& remote) = 0;
47 
48  virtual void onEvent(yarp::os::Bottle& event) {}
49 
50  virtual void lock() {}
51  virtual void unlock() {}
52 
53  virtual void goPublic() {}
54 
55  yarp::os::Contact query(const std::string& name) override {
56  return yarp::os::Contact();
57  }
58 
59  bool announce(const std::string& name, int activity) override {
60  return false;
61  }
62 
65  const yarp::os::Contact& remote) override;
66 };
67 
68 
69 #endif
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
yarp::os::NameStore
Abstract interface for a database of port names.
Definition: NameStore.h:23
yarp::name::NameService::unlock
virtual void unlock()
Definition: NameService.h:51
api.h
yarp::os::PortWriter
Interface implemented by all objects that can write themselves to the network, such as Bottle objects...
Definition: PortWriter.h:27
yarp::name::NameService::~NameService
virtual ~NameService()
Definition: NameService.h:41
yarp::name::NameService::onEvent
virtual void onEvent(yarp::os::Bottle &event)
Definition: NameService.h:48
yarp::os::PortReader
Interface implemented by all objects that can read themselves from the network, such as Bottle object...
Definition: PortReader.h:28
yarp::name::NameService::announce
bool announce(const std::string &name, int activity) override
Definition: NameService.h:59
yarp::name::NameService
Abstract interface for a name server operator.
Definition: NameService.h:39
yarp::name::NameService::apply
virtual bool apply(yarp::os::Bottle &cmd, yarp::os::Bottle &reply, yarp::os::Bottle &event, const yarp::os::Contact &remote)=0
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::name::NameService::process
bool process(yarp::os::PortWriter &in, yarp::os::PortReader &out, const yarp::os::Contact &remote) override
Definition: NameService.cpp:16
yarp::os::Contact
Represents how to reach a part of a YARP network.
Definition: Contact.h:39
yarp::name::NameService::lock
virtual void lock()
Definition: NameService.h:50
yarp::name::NameService::goPublic
virtual void goPublic()
Definition: NameService.h:53
Contact.h
NameStore.h
YARP_name_API
#define YARP_name_API
Definition: api.h:18
Bottle.h
yarp::name::NameService::query
yarp::os::Contact query(const std::string &name) override
Definition: NameService.h:55