Jamoma API  0.6.0.a19
WebSocketSenderManager.cpp
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup modularWebSocket
4  *
5  * @brief A WebSocket send object manager
6  *
7  * @details
8  *
9  * @authors Théo de la Hogue, Laurent Garnier
10  *
11  * @copyright Copyright © 2013, Théo de la Hogue @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 
17 #include "WebSocketSenderManager.h"
18 
19 WebSocketSenderManager::WebSocketSenderManager()
20 {}
21 
22 WebSocketSenderManager::~WebSocketSenderManager()
23 {}
24 
25 TTObject WebSocketSenderManager::lookup(TTSymbol applicationName)
26 {
27  TTValue last, v;
28  TTObject lastObject;
29  TTErr err;
30 
31  err = mSenders.lookup(applicationName, last);
32 
33  if (err)
34  return this->add(applicationName);
35 
36  else {
37 
38  lastObject = last[0];
39 
40  v.append(lastObject);
41 
42  mSenders.remove(applicationName);
43  mSenders.append(applicationName, v);
44  }
45 
46  return lastObject;
47 }
48 
49 TTObject WebSocketSenderManager::add(TTSymbol applicationName)
50 {
51  TTValue v;
52  TTObject anObject("web.send");
53 
54  v.append(anObject);
55 
56  mSenders.append(applicationName, v);
57 
58  return anObject;
59 }
Create and use Jamoma object instances.
Definition: TTObject.h:29
void append(const T &anElementValueToAppend)
Insert a single TTElement at the end.
Definition: TTValue.h:243
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
Definition: TTSymbol.h:26
A WebSocket send object manager.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
Definition: TTBase.h:342
[doxygenAppendixC_copyExample]
Definition: TTValue.h:34