GL Studio API
gls_rso_interface_3_impl.h
Go to the documentation of this file.
1 /*! \file
2  \brief Standard GL Studio implementation of the safe interface to version 2 RSOs (component side).
3 
4  \par Copyright Information
5 
6  Copyright (c) 2015 by 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 POSSIBILITY
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 #ifndef _GLS_RSO_INTERFACE_3_IMPL_H
41 #define _GLS_RSO_INTERFACE_3_IMPL_H
42 
43 #include "rso_interface_3.h"
44 #include "gls_include.h"
45 #include "events.h"
46 #include "gls_resources.h"
47 
48 namespace disti {
49 
50 class ComponentBase;
51 
52  /** Wraps a GlsResourceFilter so it can be passed to the RSO Interface's GetResources call */
54 {
55 private:
56  GlsResourceFilter *_filter;
57 
58 public:
59  GLS_EDITOR RSOResourceFilterImpl(GlsResourceFilter *filter) { _filter = filter; }
60  virtual GLS_EDITOR ~RSOResourceFilterImpl() { }
61 
62  // How many levels of qualification to show in the name.
63  // -1 means full qualification.
64  // Default: 0 // TODO: confirm this default
65  virtual int LevelsUp() const { return _filter->LevelsUp(); }
66  virtual void LevelsUp(int value) { _filter->LevelsUp(value); }
67 
68  // How many levels of children to show.
69  // 0 means don't show any children properties
70  // -1 means all the way down.
71  // Default: -1
72  virtual int GroupLevelsDown() const { return _filter->GroupLevelsDown(); }
73  virtual void GroupLevelsDown(int value) { _filter->GroupLevelsDown(value); }
74 
75  // If true, only a list of names will be returned.
76  // Values will not be returned.
77  // The format changes to not include the ":".
78  // Default: false
79  virtual bool NamesOnly() const { return _filter->NamesOnly(); }
80  virtual void NamesOnly(bool value) { _filter->NamesOnly(value); }
81 
82  // Manage the list of excluded attributes
83  virtual void AddExclude(const char* str) { _filter->AddExclude(str); }
84  // Returns the number of entries in the exclude list.
85  // Default: 0
86  virtual int ExcludeCount() const { return _filter->ExcludeCount(); }
87  // Returns NULL if index >= ExcludeCount() or index < -1
88  virtual const char* GetExclude(int index) const { return _filter->GetExclude(index); }
89 
90  // Manage the list of included attributes
91  virtual void AddInclude(const char* str) { _filter->AddInclude(str); }
92  // Returns the number of entries in the include list.
93  // Default: 0
94  virtual int IncludeCount() const { return _filter->IncludeCount(); }
95  // Returns NULL if index >= IncludeCount() or index < -1
96  virtual const char* GetInclude(int index) const { return _filter->GetInclude(index); }
97 
98  // Check a name against the filters
99  // Exclude list takes precedence
100  virtual bool PassFilter(const char* name) const { return _filter->PassFilter(name); }
101 
102  // Manage the stack of parent object names
103  virtual void PushParentName(const char *parent) { _filter->PushParentName(parent); }
104  virtual void PopParentName() { _filter->PopParentName(); }
105  // Returns the number of entries in the parent name stack
106  virtual unsigned int ParentNameCount() const { return _filter->ParentNameCount(); }
107  // Returns NULL if index >= ParentNameCount() or index < -1
108  virtual const char *GetParentName(unsigned int index) const { return _filter->GetParentName(index); }
109 };
110 
111 /** Implementation of the RSOInterface3. */
113 {
114 protected:
115  // Copied from GlsRSOInterface1Impl {
116  // Reference to the component being wrapped
117  // GlsRSOInterface1Impl will delete this object
118  ComponentBase* _component;
119 
120  // The containers event handler
121  RSOInterface1::EmittedEventHandler* _emittedEventHandler;
122 
123  // string to return from Resources methods
124  std::string _resourcesRetVal;
125  // } Copied from GlsRSOInterface1Impl
126 
127  // RSOInterface2 implementation
128 
129  typedef std::map<ResourceHandle, DistiAttributeBase *> ResourceHandleMap;
130 
131  ResourceHandleMap _resourceHandleMap;
132  ResourceHandle _nextResourceHandle;
133  bool _firstDraw;
134 
135  // Protected constructor - Call CreateInstance instead
136  GLS_EXPORT GlsRSOInterface3Impl(ComponentBase *component);
137 
138  // Protected destructor - Call DeleteInstance instead
139  virtual GLS_EXPORT ~GlsRSOInterface3Impl();
140 
141 public:
142  static GLS_EXPORT GlsRSOInterface3Impl *CreateInstance(ComponentBase *component);
143 
144  // Copied from GlsRSOInterface1Impl {
145  // Pass an event that was emitted from the component to the container
146  GLS_EXPORT int LiveComponentEventHandlerCb(ComponentBase*, disti::DisplayEvent* ev);
147 
148  // RSOInterface1 overrides
149 
150  virtual GLS_EXPORT void Calculate(double time);
151 
152  virtual GLS_EXPORT RSOInterface1* CloneObject();
153 
154  virtual GLS_EXPORT void DeleteInstance();
155 
156  virtual GLS_EXPORT void Draw();
157 
158  virtual GLS_EXPORT bool SetEmittedEventHandler(RSOInterface1::EmittedEventHandler* handler);
159 
160  virtual GLS_EXPORT bool GetBoundingSphere(RSOInterface1::Vector* center, float* radius);
161 
162  virtual GLS_EXPORT bool GetBoundingBox(RSOInterface1::Vector* min, RSOInterface1::Vector* max, const RSOInterface1::MatrixD* transform = NULL);
163 
164  virtual GLS_EXPORT bool HandleInput(RSOInterface1::Event* lci1_ev);
165 
166  virtual GLS_EXPORT bool HandleMultiTouchInput(RSOInterface3::MouseMultiTouchEvent *lci3_ev);
167 
168  virtual GLS_EXPORT bool Pick3D(const RSOInterface1::Vector& winLoc,
169  const RSOInterface1::Vector& logicalCoords,
170  float scale,
171  const RSOInterface1::Vector& directionVector,
172  RSOInterface1::Vector& collisionWinLoc,
173  const RSOInterface1::OpenGLMatrices& drawnMatrices);
174 
175  virtual GLS_EXPORT void PreDraw(const RSOInterface1::OpenGLMatrices& parentMatrices, RSOInterface1::Culler& culler);
176 
177  virtual GLS_EXPORT void SetResource(const char* resourceName, const char* resourceVal);
178 
179  virtual GLS_EXPORT const char* GetResource(const char* resourceName);
180 
181  virtual GLS_EXPORT const char* GetResources(RSOInterface1::ResourceFilter* filter = NULL);
182  // } Copied from GlsRSOInterface1Impl
183 
184  // RSOInterface2 implementation
185 
186  virtual ResourceHandle CreateResourceHandle(const char *resourceName);
187 
188  virtual void ReleaseResourceHandle(ResourceHandle resourceHandle);
189 
190  virtual bool IsResourceHandleValid(ResourceHandle resourceHandle);
191 
192  virtual void SetResource(ResourceHandle resourceHandle, const char *resourceVal);
193 
194  virtual const char *GetResource(ResourceHandle resourceHandle);
195 
196  virtual void SetIntResource(const char *resourceName, long resourceVal);
197 
198  virtual long GetIntResource(const char *resourceName);
199 
200  virtual void SetIntResource(ResourceHandle resourceHandle, long resourceVal);
201 
202  virtual long GetIntResource(ResourceHandle resourceHandle);
203 
204  virtual void SetFloatResource(const char *resourceName, double resourceVal);
205 
206  virtual double GetFloatResource(const char *resourceName);
207 
208  virtual void SetFloatResource(ResourceHandle resourceHandle, double resourceVal);
209 
210  virtual double GetFloatResource(ResourceHandle resourceHandle);
211 };
212 
213 } // end namespace disti
214 
215 #endif
Definition: rso_interface_1.h:551
const char * GetParentName(unsigned int index) const
Definition: gls_rso_interface_3_impl.h:112
Definition: rso_interface_1.h:264
const char * GetInclude(unsigned int index) const
Definition: gls_rso_interface_3_impl.h:53
unsigned int ExcludeCount() const
Returns the number of exclude entries in the filter.
bool NamesOnly()
Definition: gls_resources.h:103
A file for all GL Studio files to include.
unsigned int ParentNameCount() const
Definition: component_base.h:57
Definition: rso_interface_1.h:276
The standard Mouse and keyboard events and event structures.
void AddInclude(const char *name)
virtual bool PassFilter(const char *name)
Test a resource name against the filter.
Definition: rso_interface_1.h:564
unsigned int IncludeCount() const
Returns the number of includes in the filter.
Definition: rso_interface_1.h:63
void AddExclude(const char *name)
Definition: rso_interface_1.h:204
Definition: rso_interface_3.h:63
Definition: rso_interface_3.h:68
Definition: events.h:111
Definition: rso_interface_1.h:187
int LevelsUp()
Definition: gls_resources.h:79
Definition: rso_interface_1.h:225
int GroupLevelsDown()
Definition: gls_resources.h:96
Defines the RSO interface v3, which extends v2 to add multitouch support through the HandleMultiTouch...
Definition: gls_resources.h:50
disti::GlsResourceFilter classes and methods.
const char * GetExclude(unsigned int index) const
Definition: bmpimage.h:46
void PushParentName(const char *parent)