root/juggler/branches/2.2/modules/gadgeteer/gadget/Reactor.h

Revision 20010, 1.9 kB (checked in by aronb, 1 year ago)

Change clustering to be single threaded. This uses a Reactor to do a select on
all sockets.

  • Property svn:eol-style set to native
Line 
1 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
2  *
3  * VR Juggler is (C) Copyright 1998-2005 by Iowa State University
4  *
5  * Original Authors:
6  *   Allen Bierbaum, Christopher Just,
7  *   Patrick Hartling, Kevin Meinert,
8  *   Carolina Cruz-Neira, Albert Baker
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Library General Public
12  * License as published by the Free Software Foundation; either
13  * version 2 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Library General Public License for more details.
19  *
20  * You should have received a copy of the GNU Library General Public
21  * License along with this library; if not, write to the
22  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23  * Boston, MA 02111-1307, USA.
24  *
25  * -----------------------------------------------------------------
26  * File:          $RCSfile$
27  * Date modified: $Date: 2005-01-01 14:59:16 -0600 (Sat, 01 Jan 2005) $
28  * Version:       $Revision: 16524 $
29  * -----------------------------------------------------------------
30  *
31  *************** <auto-copyright.pl END do not edit this line> ***************/
32
33 #ifndef _GADGET_REACTOR_H_
34 #define _GADGET_REACTOR_H_
35
36 #include <gadget/gadgetConfig.h>
37
38 #include <vector>
39
40 #include <vpr/IO/Selector.h>
41
42
43 namespace gadget
44 {
45
46 class Node;
47
48 class Reactor
49 {
50 public:
51    void addNode(gadget::Node* node);
52
53    void removeNode(gadget::Node* node);
54
55    std::vector<gadget::Node*> getReadyNodes(const vpr::Interval& timeout);
56
57    vpr::Uint16 getNumHandles() const
58    {
59       return mSelector.getNumHandles();
60    }
61
62 private:
63    vpr::Selector mSelector;
64    std::map<vpr::IOSys::Handle, gadget::Node*> mDemuxTable;
65 };
66
67 }
68
69
70 #endif /* _GADGET_REACTOR_H_ */
Note: See TracBrowser for help on using the browser.