DataDirector API
AttributeChangedEmitter.h
Go to the documentation of this file.
1 /*! \file AttributeChangedEmitter.h
2  \brief The AttributeChangedEmitter class. Interface class for emitting AttributeChanged events.
3 
4  \par Copyright Information
5 
6  Copyright (c) 2012 The DiSTI Corporation.<br>
7  11301 Corporate Blvd; Suite 100<br>
8  Orlando, Florida 32817<br>
9  USA<br>
10  <br>
11  All rights reserved.<br>
12 
13  This Software contains proprietary trade secrets of DiSTI and may not be
14 reproduced, in whole or part, in any form, or by any means of electronic,
15 mechanical, or otherwise, without the written permission of DiSTI. Said
16 permission may be derived through the purchase of applicable DiSTI product
17 licenses which detail the distribution rights of this content and any
18 Derivative Works based on this or other copyrighted DiSTI Software.
19 
20  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26 
27  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBLITY
33 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34 EXCEED FIVE DOLLARS (US$5.00).
35 
36  The aforementioned terms and restrictions are governed by the laws of the
37 State of Florida and the United States of America.
38 
39 */
40 
41 #ifndef _AttributeChangedEmitter_H
42 #define _AttributeChangedEmitter_H
43 
44 #include "events.h"
45 
46 namespace disti
47 {
48 
49 #ifdef WIN32
50 #define snprintf _snprintf
51 #endif
52 
54 {
55 public:
56 
57  void EmitAttributeChangedEventProperty(DisplayObject *obj,const char *qualifiedName, const char *name,int arg)
58  {
59  char str[1024];
60  if (strlen (qualifiedName) > 0)
61  {
62  snprintf(str, 1024, "%s.%s %d",qualifiedName,name,arg);
63  }
64  else
65  {
66  snprintf(str, 1024, "%s %d",name,arg);
67  }
68 
69  ObjectEvent newEvent(obj, "AttributeChanged", str);
70  EmitObjectEvent(obj, &newEvent);
71  }
72 
73  void EmitAttributeChangedEventProperty(DisplayObject *obj,const char *qualifiedName,const char *name,bool arg)
74  {
75  EmitAttributeChangedEventProperty(obj,qualifiedName,name,(int)arg);
76  }
77 
78  void EmitAttributeChangedEventProperty(DisplayObject *obj,const char *qualifiedName, const char *name,float arg)
79  {
80  char str[1024];
81  if (strlen (qualifiedName) > 0)
82  {
83  snprintf(str, 1024, "%s.%s %.8f",qualifiedName,name,arg);
84  }
85  else
86  {
87  snprintf(str, 1024, "%s %.8f",name,arg);
88  }
89 
90  ObjectEvent newEvent(obj, "AttributeChanged", str);
91  EmitObjectEvent(obj, &newEvent);
92  }
93 
94  void EmitAttributeChangedEventProperty(DisplayObject *obj,const char *qualifiedName, const char *name,const char* arg)
95  {
96  char str[1024];
97  if (strlen (qualifiedName) > 0)
98  {
99  snprintf(str, 1024, "%s.%s %s",qualifiedName,name,arg);
100  }
101  else
102  {
103  snprintf(str, 1024, "%s %s",name,arg);
104  }
105 
106  ObjectEvent newEvent(obj, "AttributeChanged", str);
107  EmitObjectEvent(obj, &newEvent);
108  }
109 
110  void EmitAttributeChangedEvent(DisplayObject *obj,const char *qualifiedName, const char *name,int arg)
111  {
112  char str[1024];
113  if (strlen (qualifiedName) > 0)
114  {
115  snprintf(str, 1024, "%s.%s.%s %d",qualifiedName,obj->InstanceName(),name,arg);
116  }
117  else
118  {
119  snprintf(str, 1024, "%s.%s %d",obj->InstanceName(),name,arg);
120  }
121 
122  ObjectEvent newEvent(obj, "AttributeChanged", str);
123  EmitObjectEvent(obj, &newEvent);
124  }
125 
126  void EmitAttributeChangedEvent(DisplayObject *obj,const char *qualifiedName,const char *name,bool arg)
127  {
128  EmitAttributeChangedEvent(obj,qualifiedName,name,(int)arg);
129  }
130 
131  void EmitAttributeChangedEvent(DisplayObject *obj,const char *qualifiedName,const char *name,float arg)
132  {
133  char str[1024];
134  if (strlen (qualifiedName) > 0)
135  {
136  snprintf(str, 1024, "%s.%s.%s %.8f",qualifiedName,obj->InstanceName(),name,arg);
137  }
138  else
139  {
140  snprintf(str, 1024, "%s.%s %.8f",obj->InstanceName(),name,arg);
141  }
142 
143  ObjectEvent newEvent(obj, "AttributeChanged", str);
144  EmitObjectEvent(obj, &newEvent);
145  }
146 };
147 
148 }
149 #endif
150 
Definition: AttributeChangedEmitter.h:53
Definition: AttributeChangedEmitter.h:46