source: trunk/src/testing/include/fsManager.h @ 4

Revision 4, 5.9 KB checked in by ajaworski, 13 years ago (diff)

Added modified SAGE sources

Line 
1/******************************************************************************
2 * SAGE - Scalable Adaptive Graphics Environment
3 *
4 * Module: fsManager.h
5 * Author : Byungil Jeong
6 *
7 * Copyright (C) 2004 Electronic Visualization Laboratory,
8 * University of Illinois at Chicago
9 *
10 * All rights reserved.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions are met:
14 *
15 *  * Redistributions of source code must retain the above copyright
16 *    notice, this list of conditions and the following disclaimer.
17 *  * Redistributions in binary form must reproduce the above
18 *    copyright notice, this list of conditions and the following disclaimer
19 *    in the documentation and/or other materials provided with the distribution.
20 *  * Neither the name of the University of Illinois at Chicago nor
21 *    the names of its contributors may be used to endorse or promote
22 *    products derived from this software without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
27 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 *
36 * Direct questions, comments etc about SAGE to sage_users@listserv.uic.edu or
37 * http://www.evl.uic.edu/cavern/forum/
38 *
39 *****************************************************************************/
40
41
42#ifndef _FSManager_H
43#define _FSManager_H
44
45#include "sage.h"
46#include "sageConfig.h"
47#include <map>
48
49class fsCore;
50class displayInstance;
51class fsServer;
52class sageVirtualDesktop;
53
54/**
55 * class rcvInfo
56 *
57 */
58class rcvInfo {
59public:
60        int syncPort;
61        int syncBarrierPort; /**< TCP port number for the barrier server (2nd phase) */
62
63        /**
64         * This determines the duration of the first phase => eventually frequency of graphics swap buffer call
65         * in Hz
66         */
67        int refreshInterval;
68        int syncMasterPollingInterval; /**< (in usec), select() return timer for syncMaster */
69
70        /**
71         * 0 nosync
72         * 1 data sync only
73         * 2 swap buffer sync
74         * 3 with NTP
75         */
76        int syncLevel;
77
78        int streamPort;
79        int bufSize;
80        bool fullScreen;
81
82        bool audioOn;
83        int audioPort;
84        int audioSyncPort;
85        int agSyncPort;
86        rcvInfo() : syncPort(11000), syncBarrierPort(11001), refreshInterval(120), syncMasterPollingInterval(100), syncLevel(1), streamPort(21000), bufSize(64), fullScreen(true),
87                        audioOn(false), audioSyncPort(13000), audioPort(23000), agSyncPort(15000) {}
88};
89
90class sageNwConfig;
91class displayConnection;
92
93/**
94 * \brief The container of the Free Space Manager components - fsCore, displayInstance, appData, and fsServer.
95 *
96 * The FSManager receives from UI clients various user commands such as application execution, window move, resizing or z-order change and then executes the commands by sending control messages to SAIL nodes or SAGE receivers.
97 *
98 * This class is instanced by main() in the fsMain.cpp,
99 * then member function mainLoop() is called after reading fsManager.conf
100 */
101class fsManager {
102private:
103   fsCore *core;
104   fsServer *server;
105
106        int m_execIndex;
107        int m_execIDList[MAX_INST_NUM];
108
109   rcvInfo rInfo;
110   sageNwConfig *nwInfo;
111
112   std::vector<appInExec *> execList; /**< a list of applications */
113   std::vector<displayInstance *> dispList;
114   std::vector<int> uiList;
115   std::vector<int> appUiList;
116   std::vector<sageRect *> drawObjectList;
117   std::vector<sageVirtualDesktop *> vdtList;
118   std::vector<displayConnection *> dispConnectionList;
119
120   char fsIP[SAGE_IP_LEN];
121   char pubIP[SAGE_IP_LEN];
122   char fsName[SAGE_NAME_LEN];
123   char conManIP[SAGE_IP_LEN];
124   int conManPort;
125   int uiPort, sysPort, trackPort;
126   int winTime;
127   int winStep;
128   bool NRM;
129   bool blockCommands;
130   bool fsmClose;
131   bool globalSync;
132   bool useLocalPort;
133
134   /**
135        * generated by init()
136        * invoke talkToConnectionManager()
137        */
138   static void* msgThread(void *args);
139
140   /**
141    * connect to connection manager
142    * continuously send message to the connection manager
143    */
144   int talkToConnectionManager();
145
146public:
147   fsManager();
148   ~fsManager();
149
150   /**
151        * reads config file then sets the fsManager member variables.<BR>
152        * creates fsServer and fsCore instances and calls init() of them.<BR>
153        * creates sageVirtualDesktop objects that will launch sageDIsplayManager and sageAudioManager<BR>
154        * starts msgThread().
155        */
156   int init(const char *config);
157
158   void printAppList();
159   char* getFsIP() { return fsIP; }
160   int getUiPort() { return uiPort; }
161   int getSysPort() { return sysPort; }
162   int getTrackPort() { return trackPort; }
163
164   /**
165        * keeps calling server->checkClients() forever
166        */
167   void mainLoop();
168
169   int msgToCore(sageMessage &msg, int clientID);
170   int msgToDisp(sageMessage &msg, int clientID);
171   int sendMessage(int cId, int code, int data);
172   int sendMessage(int cId, int code, char* data);
173   int sendMessage(int cId, int code);
174   int sendMessage(sageMessage &msg);
175   int windowChanged(int appId);
176   int parseDisplayConnectionInfo(FILE *fp);
177   int sendToAllRcvs(int code, char *data = NULL);
178   int sendToAllRcvs(int code, int data);
179   int sendToVDT(int vdtID, int code, char *data = NULL);
180   int sendToVDT(int vdtID, int code, int data);
181   int sendToOtherVDT(int vdtID, int code, char *data = NULL);
182   int sendToOtherVDT(int vdtID, int code, int data);
183
184   friend class fsCore;
185   friend class displayInstance;
186   friend class fsServer;
187};
188
189#endif
Note: See TracBrowser for help on using the repository browser.