drumstick 0.5.0
subscription.h
Go to the documentation of this file.
00001 /*
00002     MIDI Sequencer C++ library 
00003     Copyright (C) 2006-2010, Pedro Lopez-Cabanillas <plcl@users.sf.net>
00004 
00005     This library is free software; you can redistribute it and/or modify
00006     it under the terms of the GNU General Public License as published by
00007     the Free Software Foundation; either version 2 of the License, or
00008     (at your option) any later version.
00009 
00010     This library is distributed in the hope that it will be useful,
00011     but WITHOUT ANY WARRANTY; without even the implied warranty of
00012     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013     GNU General Public License for more details.
00014 
00015     You should have received a copy of the GNU General Public License along 
00016     with this program; if not, write to the Free Software Foundation, Inc., 
00017     51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.    
00018 */
00019 
00020  
00021 #ifndef DRUMSTICK_SUBSCRIPTION_H
00022 #define DRUMSTICK_SUBSCRIPTION_H
00023 
00024 #include "drumstickcommon.h"
00025 #include <QList>
00026 
00034 namespace drumstick {
00035 
00036 class MidiClient;
00037 
00043 class DRUMSTICK_EXPORT Subscriber
00044 {
00045     friend class PortInfo;
00046 public:
00047     Subscriber();
00048     Subscriber(const Subscriber& other);
00049     Subscriber(snd_seq_query_subscribe_t* other);
00050     virtual ~Subscriber();
00051     Subscriber* clone();
00052     int getSizeOfInfo() const;
00053     
00054     int getClient();
00055     int getPort();
00056     const snd_seq_addr_t* getRoot();
00057     snd_seq_query_subs_type_t getType();
00058     int getIndex();
00059     int getNumSubs();
00060     const snd_seq_addr_t* getAddr();
00061     int getQueue();
00062     bool getExclusive();
00063     bool getTimeUpdate();
00064     bool getTimeReal();
00065     void setClient(int client);
00066     void setPort(int port);
00067     void setRoot(snd_seq_addr_t* addr);
00068     void setType(snd_seq_query_subs_type_t type);
00069     void setIndex(int index);
00070     Subscriber& operator=(const Subscriber& other);
00071 
00072 private:
00073     snd_seq_query_subscribe_t* m_Info;
00074 
00075 };
00076 
00082 class DRUMSTICK_EXPORT Subscription
00083 {
00084 public:
00085     Subscription();
00086     Subscription(const Subscription& other);
00087     Subscription(snd_seq_port_subscribe_t* other);
00088     Subscription(MidiClient* seq);
00089     virtual ~Subscription();
00090     Subscription* clone();
00091     int getSizeOfInfo() const;
00092     
00093     void setSender(unsigned char client, unsigned char port);
00094     void setDest(unsigned char client, unsigned char port);
00095     void subscribe(MidiClient* seq);
00096     void unsubscribe(MidiClient* seq);
00097 
00098     const snd_seq_addr_t* getSender();
00099     const snd_seq_addr_t* getDest();
00100     int getQueue();
00101     bool getExclusive();
00102     bool getTimeUpdate();
00103     bool getTimeReal();
00104     void setSender(const snd_seq_addr_t* addr);
00105     void setDest(const snd_seq_addr_t* addr);
00106     void setQueue(int queue);
00107     void setExclusive(bool val);
00108     void setTimeUpdate(bool val);
00109     void setTimeReal(bool val);
00110     Subscription& operator=(const Subscription& other);
00111 
00112 private:
00113     snd_seq_port_subscribe_t* m_Info;
00114 };
00115 
00119 typedef QList<Subscription> SubscriptionsList;
00120 
00124 typedef QList<Subscriber> SubscribersList;
00125 
00126 }
00127 
00130 #endif //DRUMSTICK_SUBSCRIPTION_H