root / windows / trunk / addons / ofxOsc / src / ofxOscBundle.h @ 23

View | Annotate | Download (2.4 KB)

1 23 jake
/*
2 23 jake
3 23 jake
 Copyright (c) 2007-2009, Damian Stewart
4 23 jake
 All rights reserved.
5 23 jake
6 23 jake
 Redistribution and use in source and binary forms, with or without
7 23 jake
 modification, are permitted provided that the following conditions are met:
8 23 jake
 * Redistributions of source code must retain the above copyright
9 23 jake
 notice, this list of conditions and the following disclaimer.
10 23 jake
 * Redistributions in binary form must reproduce the above copyright
11 23 jake
 notice, this list of conditions and the following disclaimer in the
12 23 jake
 documentation and/or other materials provided with the distribution.
13 23 jake
 * Neither the name of the developer nor the
14 23 jake
 names of its contributors may be used to endorse or promote products
15 23 jake
 derived from this software without specific prior written permission.
16 23 jake
17 23 jake
 THIS SOFTWARE IS PROVIDED BY DAMIAN STEWART ''AS IS'' AND ANY
18 23 jake
 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 23 jake
 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 23 jake
 DISCLAIMED. IN NO EVENT SHALL DAMIAN STEWART BE LIABLE FOR ANY
21 23 jake
 DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 23 jake
 (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 23 jake
 LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 23 jake
 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 23 jake
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 23 jake
 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 23 jake
 */
28 23 jake
29 23 jake
#ifndef _OFXOSCBUNDLE_H
30 23 jake
#define _OFXOSCBUNDLE_H
31 23 jake
32 23 jake
#include <vector>
33 23 jake
#include "ofxOscMessage.h"
34 23 jake
35 23 jake
class ofxOscBundle
36 23 jake
{
37 23 jake
public:
38 23 jake
        ofxOscBundle();
39 23 jake
        ~ofxOscBundle();
40 23 jake
        ofxOscBundle( const ofxOscBundle& other ) { copy ( other ); }
41 23 jake
        ofxOscBundle& operator= ( const ofxOscBundle& other ) { return copy( other ); }
42 23 jake
        /// for operator= and copy constructor
43 23 jake
        ofxOscBundle& copy( const ofxOscBundle& other );
44 23 jake
45 23 jake
        /// erase contents
46 23 jake
        void clear() { messages.clear(); bundles.clear(); }
47 23 jake
48 23 jake
        /// add bundle elements
49 23 jake
        void addBundle( const ofxOscBundle& element );
50 23 jake
        void addMessage( const ofxOscMessage& message );
51 23 jake
52 23 jake
        /// get bundle elements
53 23 jake
        int getBundleCount() const { return bundles.size(); }
54 23 jake
        int getMessageCount() const { return messages.size(); }
55 23 jake
        /// return the bundle or message at the given index
56 23 jake
        ofxOscBundle& getBundleAt( int i ) { return bundles[i]; }
57 23 jake
        ofxOscMessage& getMessageAt( int i ) { return messages[i]; }
58 23 jake
59 23 jake
private:
60 23 jake
61 23 jake
        std::vector< ofxOscMessage > messages;
62 23 jake
        std::vector< ofxOscBundle > bundles;
63 23 jake
};
64 23 jake
65 23 jake
66 23 jake
#endif