icub-client
subSystem.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2014 WYSIWYD Consortium, European Commission FP7 Project ICT-612139
3  * Authors: Stéphane Lallée
4  * email: stephane.lallee@gmail.com
5  * website: https://github.com/robotology/icub-client/
6  * Permission is granted to copy, distribute, and/or modify this program
7  * under the terms of the GNU General Public License, version 2 or any
8  * later version published by the Free Software Foundation.
9  *
10  * A copy of the license can be found at
11  * icub-client/license/gpl.txt
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
16  * Public License for more details
17  */
18 
19 #ifndef __ICUBCLIENT_SUBSYSTEM_H__
20 #define __ICUBCLIENT_SUBSYSTEM_H__
21 
22 #define SUBSYSTEM "abstract"
23 
24 #include <iostream>
25 #include <iterator>
26 #include <algorithm>
27 #include <yarp/os/RpcClient.h>
28 
37 namespace icubclient{
43  class SubSystem
44  {
45  protected:
46  std::string m_masterName;
47  std::string m_type;
48  yarp::os::RpcClient portRPC;
49 
50  virtual bool connect() = 0;
51 
52  public:
53  SubSystem(const std::string &masterName) { m_masterName = masterName; m_type = SUBSYSTEM; }
54  virtual ~SubSystem() {}
59  bool Connect() {
60  return connect();
61  }
62 
66  virtual void Close() = 0;
67 
71  std::string getType() const { return m_type; }
72  };
73 }//Namespace
74 #endif
75 
76 
std::string m_type
Definition: subSystem.h:47
yarp::os::RpcClient portRPC
Definition: subSystem.h:48
std::string getType() const
Return the type of the subsystem as string.
Definition: subSystem.h:71
virtual bool connect()=0
virtual void Close()=0
Clean up resources.
#define SUBSYSTEM
Definition: subSystem.h:22
Abstract class to handle sub-systems of the icub-client.
Definition: subSystem.h:43
SubSystem(const std::string &masterName)
Definition: subSystem.h:53
bool Connect()
Connects the subsystem to its "host".
Definition: subSystem.h:59
virtual ~SubSystem()
Definition: subSystem.h:54
std::string m_masterName
Definition: subSystem.h:46