nidas  v1.2-1520
SampleClientList.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2005, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_CORE_SAMPLECLIENTLIST_H
28 #define NIDAS_CORE_SAMPLECLIENTLIST_H
29 
30 #include <list>
31 
33 #include "SampleClient.h"
34 
35 namespace nidas { namespace core {
36 
42 public:
43 
45 
51 
52  virtual ~SampleClientList() {}
53 
59 
66  virtual void add(SampleClient*);
67 
73  virtual void remove(SampleClient*);
74 
78  virtual bool empty() const;
79 
85  virtual void removeAll();
86 
90  void lock() const throw() { _clistLock.lock(); }
91 
95  void unlock() const throw() { _clistLock.unlock(); }
96 
98  std::list<SampleClient*>::const_iterator begin() throw() { return _clients.begin(); }
99 
101  std::list<SampleClient*>::const_iterator end() throw() { return _clients.end(); }
102 
103 private:
104 
109 
113  std::list<SampleClient*> _clients;
114 
115 };
116 
117 }} // namespace nidas namespace core
118 
119 #endif
std::list< SampleClient * >::const_iterator end()
get a const_iterator pointing to one-past-last element.
Definition: SampleClientList.h:101
virtual void add(SampleClient *)
Add a SampleClient to this list.
Definition: SampleClientList.cc:53
std::list< SampleClient * > _clients
My current clients.
Definition: SampleClientList.h:113
virtual ~SampleClientList()
Definition: SampleClientList.h:52
Pure virtual interface of a client of Samples.
Definition: SampleClient.h:38
virtual bool empty() const
Are there any clients?
Definition: SampleClientList.cc:72
void lock()
Lock the Mutex.
Definition: ThreadSupport.h:206
std::list< SampleClient * >::const_iterator begin()
get a const_iterator pointing to first element.
Definition: SampleClientList.h:98
A list of SampleClients.
Definition: SampleClientList.h:41
SampleClientList & operator=(const SampleClientList &cl)
Public assignment operator.
Definition: SampleClientList.cc:41
nidas::util::Mutex _clistLock
mutex to prevent simultaneous access to clients list
Definition: SampleClientList.h:108
virtual void removeAll()
Big cleanup.
Definition: SampleClientList.cc:80
void unlock() const
Unlock this list.
Definition: SampleClientList.h:95
void lock() const
Lock this list.
Definition: SampleClientList.h:90
A C++ wrapper for a POSIX mutex.
Definition: ThreadSupport.h:154
void unlock()
Unlock the Mutex.
Definition: ThreadSupport.h:218
SampleClientList()
Definition: SampleClientList.h:44