#include <WOscMethod.h>
Inherited by WOscReceiverMethod.
Public Member Functions | |
| WOscMethod (WOscContainer *parent, const char *name, WOscMethodInfo *info=NULL) | |
| virtual void | Method (const WOscMessage *message, const WOscTimeTag &when, const WOscNetReturn *networkReturnAddress)=0 |
| void | AddMethodAlias (WOscContainer *parent, const char *alias) |
| WOscContainer * | GetParent () |
| WOscString | GetName () |
| WOscString | GetAddress () |
| WOscString | GetAddressSpace () |
| const WOscMethodInfo * | GetInfo () const |
Protected Member Functions | |
| virtual | ~WOscMethod () |
Friends | |
| class | WOscContainer |
If during dispatching and subsequent invoking an OSC-method gets called, the message, which produced the invokation, and a network-return-address is passed.
Methods can be seen as remote functions. Multiple computers communicate remotely by calling each others functions and passing arguments.
Inherit your own methods from this class or - when using WOscReceiver - from WOscReceiverMethod.
Definition at line 84 of file WOscMethod.h.
|
||||||||||||||||
|
Constructor. Osc-methods can only be constructed in presence of a parent container, since method-orphans are not allowed. Additionally they have to be instantiated dynamically because the OSC-address-tree (formed by WOscContainer objects) handles the clean-up of all tree-elements. Therefor the destructor is private.
Definition at line 94 of file WOscMethod.cpp. References WOscContainer::AddMethod(), and ERR_PARENT_POINTER_NULL. 00095 :
00096 m_parent(parent), m_info(info)
00097 {
00098 if ( parent == NULL )
00099 throw WOscException(ERR_PARENT_POINTER_NULL, __FILE__, __LINE__);
00100 m_parent->AddMethod(this, name, false);
00101 }
|
|
|
Destructor. A WOscMethod can be deleted only by WOscContainers. Does nothing currently. Definition at line 132 of file WOscMethod.h. 00132 { delete m_info; }
|
|
||||||||||||
|
Adds this method as alias to the list of methods of the container passed as argument.
Definition at line 118 of file WOscMethod.cpp. References WOscContainer::AddMethod(), and ERR_PARENT_POINTER_NULL. 00119 {
00120 if ( parent == NULL ) // should not happen
00121 throw WOscException(ERR_PARENT_POINTER_NULL, __FILE__, __LINE__);
00122 parent->AddMethod(this, alias, true);
00123 }
|
|
|
Returns the OSC-address of this container as seen from the root. If this container should be aliased, it returns the main, not aliased, address.
Definition at line 205 of file WOscMethod.cpp. References WOscContainer::GetName(), GetName(), and WOscContainer::m_parent. 00206 {
00207 WOscContainer* momentaryParent = m_parent;
00208 WOscString address = GetName();
00209 WOscString tmp;
00210
00211 /* traverse tree upwards until root is reached */
00212 while ( momentaryParent != NULL ){
00213 if (momentaryParent->m_parent == NULL) break;
00214 WOscString tmp = momentaryParent->GetName();
00215 tmp += '/';
00216 address = tmp + address;
00217
00218 momentaryParent = momentaryParent->m_parent;
00219 }
00220 tmp = '/';
00221
00222 return tmp + address;
00223 }
|
|
|
Returns the whole OSC-address-space as seen from root. The address-space contains only addresses with valid leaves (OSC-methods).
Definition at line 186 of file WOscMethod.cpp. References WOscContainer::FindRoot(), and WOscContainer::GetMethodList(). 00187 {
00188 const WOscContainer* root = m_parent->FindRoot();
00189 return root->GetMethodList();
00190 }
|
|
|
Retrieve the proprietary info which can be set in the constructor. NULL if not set. Definition at line 125 of file WOscMethod.h. 00125 { return m_info; }
|
|
|
Gets the name (the single pattern, not the OSC-address) of this node. If a container is named "xyz" and it's located in the OSC-address-space at "/abcd/klm/xyz/lalala", only xyz is returned.
Definition at line 164 of file WOscMethod.cpp. References WOscContainer::m_methodEntries. Referenced by GetAddress(). 00165 {
00166 /* search all children of parent for not aliased name */
00167 const std::vector<WOscMethodEntry>& methEntries = m_parent->m_methodEntries;
00168 for ( int i = methEntries.size()-1; i >= 0; i-- )
00169 if ( methEntries[i].m_method == this && !methEntries[i].m_isAlias ) {
00170 return WOscString(methEntries[i].m_name.c_str());
00171 }
00172
00173 return WOscString();
00174 }
|
|
|
Returns the main parent-container (not aliased ones!). For use in the method-member function to get the calling- container-context.
Definition at line 233 of file WOscMethod.cpp. 00234 {
00235 return m_parent;
00236 }
|
|
||||||||||||||||
|
The OSC method. This is the function that will be called, when a certain OSC-address in a message matches the address of this method-object. The message is then passed together with a network-return-address and a timeTag which contains the point in time of the invocation. Each message object can access the program resources without global variables by using the context-pointer.
|
|
|
WOscContainer controls the deletion of registered methods. Definition at line 129 of file WOscMethod.h. |
1.4.1