ifw  0.0.1-dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Activity.h
Go to the documentation of this file.
1 /*
2  * scampl4cpp/engine
3  *
4  * Copyright by European Southern Observatory, 2012
5  * All rights reserved
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public
9  * License as published by the Free Software Foundation; either
10  * version 2.1 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * Lesser General Public License for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public
18  * License along with this library; if not, write to the Free Software
19  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20  * 02111-1307 USA.
21  */
22 
23 /*
24  * $Id: Activity.h 1140 2016-10-24 09:07:29Z landolfa $
25  */
26 
27 #ifndef ACTIVITY_H
28 #define ACTIVITY_H
29 
30 #ifndef __cplusplus
31 #error This is a C++ include file and cannot be used from plain C
32 #endif
33 
34 #include <string>
35 #include <mutex>
36 
37 namespace scxml4cpp
38 {
39 
40  class Activity
41  {
42  public:
43  Activity(const std::string& id);
44  virtual ~Activity();
45 
46  virtual void start() = 0;
47  virtual void stop() = 0;
48  virtual void run() = 0;
49 
50  bool isRunning();
51  void setRunning(const bool running);
52  std::string getId() const;
53  void setId(const std::string& id);
54 
55  private:
56  std::string mId;
57  bool mRunning;
58  std::mutex mMutex;
59 
60  Activity(const Activity&);
61  Activity& operator= (const Activity&);
62  };
63 
64 }
65 #endif
Activity(const std::string &id)
Definition: Activity.cpp:33
virtual void stop()=0
Definition: Activity.h:40
bool isRunning()
Definition: Activity.cpp:46
virtual void start()=0
std::string getId() const
Definition: Activity.cpp:63
void setRunning(const bool running)
Definition: Activity.cpp:55
void setId(const std::string &id)
Definition: Activity.cpp:69
virtual ~Activity()
Definition: Activity.cpp:40
virtual void run()=0