00001 /* 00002 * WOscLib, an object oriented OSC library. 00003 * Copyright (C) 2005 Uli Clemens Franke, Weiss Engineering LTD, Switzerland. 00004 * 00005 * This library is free software; you can redistribute it and/or 00006 * modify it under the terms of the GNU Lesser General Public 00007 * License as published by the Free Software Foundation; either 00008 * version 2.1 of the License, or (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 GNU 00013 * Lesser General Public License for more details. 00014 * 00015 * You should have received a copy of the GNU Lesser General Public 00016 * License along with this library; if not, write to the Free Software 00017 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00018 * 00019 * For details see lgpl.txt 00020 * 00021 * Weiss Engineering LTD. 00022 * Florastrass 42 00023 * 8610 Uster 00024 * Switzerland 00025 * 00026 * uli.franke@weiss.ch 00027 */ 00028 00029 /** WOscMethod , WOscCallbackList and WOscCallbackListItem header file. 00030 * \file 00031 * 00032 * $Author: cls-nebadje $ ( \ref _UcfWOscLib ) 00033 * $Date: 2009-01-13 17:23:19 $ 00034 * $Revision: 1.4 $ 00035 * 00036 * Copyright (c) Weiss Engineering Ltd 00037 * 00038 */ 00039 00040 #ifndef __WOSCRECEIVERMETHOD_H__ 00041 #define __WOSCRECEIVERMETHOD_H__ 00042 00043 00044 #include "WOscMethod.h" 00045 #include "WOscReceiver.h" 00046 00047 00048 /** Adds functionality to WOscMethod necessary for use in WOscReceiver. 00049 * This happens by handling the internal context pointer in a type-save way by 00050 * providing constructors and functions. 00051 * 00052 */ 00053 class WOscReceiverMethod: public WOscMethod 00054 { 00055 public: 00056 /** Constructor of an OSC receiver method. 00057 * @param parent 00058 * Pointer to parent container. 00059 * @param context 00060 * Pointer to the receiver owning this method. The context can be used 00061 * later in receiver methods (i.e. for accessing OSC receiver functionality 00062 * inside OSC methods). 00063 * @param methodName 00064 * Address pattern (e.g. "echo"). 00065 * @param methodDescription 00066 * Description of this method. 00067 */ 00068 WOscReceiverMethod(WOscContainer* parent, WOscReceiver* context, 00069 const char* methodName, const char* methodDescription) : 00070 WOscMethod(parent, methodName, new WOscMethodInfo(methodDescription)), 00071 m_context(context) 00072 { } 00073 /** As the other constructor but the user can set a proprietary method 00074 * info. 00075 * @param info 00076 * Proprietary info. Note that this object will be deallocated by the 00077 * method itself. 00078 */ 00079 WOscReceiverMethod(WOscContainer* parent, WOscReceiver* context, 00080 const char* methodName, WOscMethodInfo* info) : 00081 WOscMethod(parent, methodName, info), m_context(context) 00082 { } 00083 00084 protected: 00085 /** Destructor. */ 00086 virtual ~WOscReceiverMethod() { } 00087 /** Returns a pointer to the OSC receiver owning this method. 00088 * Casts the internal context-pointer to OSC receiver. 00089 * @returns 00090 * The receiver context of the OSC method. 00091 */ 00092 WOscReceiver* GetContext() { return m_context; } 00093 00094 private: 00095 WOscReceiver* m_context; /**< Freely usable context pointer.*/ 00096 00097 /** An example of how to inherit from WOscReceiverMethod. 00098 * \example WOscServer.cpp 00099 * The header (WOscServer.h) prepended: 00100 * \include WOscServer.h 00101 */ 00102 00103 }; 00104 00105 #endif // #ifndef __WOSCRECEIVERMETHOD_H__