/[svn]/linuxsampler/trunk/src/network/lscpevent.h
ViewVC logotype

Contents of /linuxsampler/trunk/src/network/lscpevent.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 170 - (show annotations) (download) (as text)
Sat Jul 3 20:08:07 2004 UTC (19 years, 9 months ago) by senkov
File MIME type: text/x-c++hdr
File size: 3435 byte(s)
* moved ToString to common
* Implemented handling of multiple connections
* Implemented guts for event subscription/unsubscription
* Illustrated event notification sending by sending MISC events
when connections are established or terminated.

1 /***************************************************************************
2 * *
3 * LinuxSampler - modular, streaming capable sampler *
4 * *
5 * Copyright (C) 2003, 2004 by Benno Senoner and Christian Schoenebeck *
6 * *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
11 * *
12 * This program 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 *
15 * GNU General Public License for more details. *
16 * *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the Free Software *
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, *
20 * MA 02111-1307 USA *
21 ***************************************************************************/
22
23 #ifndef __LSCPEVENT_H_
24 #define __LSCPEVENT_H_
25 #include <iostream>
26 #include <sstream>
27 #include <string>
28 #include <list>
29 #include "../Sampler.h"
30 #include "../common/global.h"
31 #include "../common/LinuxSamplerException.h"
32
33 using namespace LinuxSampler;
34
35
36 /**
37 * Helper class for producing result sets
38 */
39 class LSCPEvent {
40 public:
41 /**
42 * Event types
43 **/
44 enum event_t {
45 event_channels,
46 event_voice_count,
47 event_stream_count,
48 event_buffer_fill,
49 event_info,
50 event_misc
51 };
52
53 /* This constructor will do type lookup based on name
54 **/
55 LSCPEvent(String eventName) throw (LinuxSamplerException);
56
57 /* These constructors are used to create event and fill it with data for sending
58 * These will be used by the thread that wants to send an event to all clients
59 * that are subscribed to it
60 **/
61 LSCPEvent(event_t eventType, int uiData);
62 LSCPEvent(event_t eventType, String sData);
63 LSCPEvent(event_t eventType, int uiData1, int uiData2);
64 LSCPEvent(event_t eventType, String sData, int uiData);
65 LSCPEvent(event_t eventType, int uiData, String sData);
66 String Produce( void );
67
68 /* Returns event type */
69 event_t GetType( void ) { return type; }
70
71 /* These methods are used to registed and unregister an event */
72 static void RegisterEvent(event_t eventType, String EventName);
73 static void UnregisterEvent(event_t eventType);
74
75 /* This method returns a name for events of a given type */
76 static String Name(event_t eventType);
77
78 /* This method returs a list of all event types registered */
79 static std::list<event_t> List( void );
80
81 private:
82 String storage;
83 event_t type;
84
85 static std::map<event_t, String> EventNames;
86 };
87
88 #endif // __LSCPEVENT_H_

  ViewVC Help
Powered by ViewVC