Free Electron
SurfaceAccessibleI.h
Go to the documentation of this file.
1 /* Copyright (C) 2003-2021 Free Electron Organization
2  Any use of this software requires a license. If a valid license
3  was not distributed with this file, visit freeelectron.org. */
4 
5 /** @file */
6 
7 #ifndef __surface_SurfaceAccessibleI_h__
8 #define __surface_SurfaceAccessibleI_h__
9 
10 namespace fe
11 {
12 namespace ext
13 {
14 
15 class SurfaceAccessorI;
16 
17 /**************************************************************************//**
18  @brief Surface Element Access and Alteration
19 
20  @ingroup surface
21 *//***************************************************************************/
22 class FE_DL_EXPORT SurfaceAccessibleI:
23  virtual public Component,
24  public CastableAs<SurfaceAccessibleI>
25 {
26  public:
27  enum Element
28  {
29  e_point,
30  e_pointGroup,
31  e_vertex,
32  e_primitive,
33  e_primitiveGroup,
34  e_detail,
35  e_elementEnums
36  };
37  enum Attribute
38  {
39  e_generic,
40  e_position,
41  e_normal,
42  e_uv,
43  e_color,
44  e_vertices,
45  e_properties
46  // TODO common attributes
47  };
48  enum Properties
49  {
50  e_openCurve,
51  e_countU,
52  e_countV,
53  e_wrappedU,
54  e_wrappedV,
55  e_depth
56  };
57  enum Form
58  {
59  e_closed,
60  e_open
61  };
62  enum Message
63  {
64  e_quiet,
65  e_warning,
66  e_error
67  };
68  enum Creation
69  {
70  e_refuseMissing,
71  e_createMissing
72  };
73  enum Writable
74  {
75  e_readOnly,
76  e_readWrite
77  };
78  //* e_unpaged or e_paged
79  enum AtomicChange
80  {
81  e_pointsOnly,
82  e_pointsOfPrimitives,
83  e_primitivesOnly,
84  e_primitivesWithPoints //* TODO
85  };
86 
87  //* duplicate from WorkI
88  enum Threading
89  {
90  e_unknown=WorkI::e_unknown,
91  e_singleThread=WorkI::e_singleThread,
92  e_multiThread=WorkI::e_multiThread
93  };
94 
95  /// @brief view to a reduced set in indices
96  class FE_DL_EXPORT FilterI:
97  virtual public Counted,
98  public CastableAs<FilterI>
99  {
100  public:
101  virtual I32 filterCount(void) const =0;
102  virtual I32 filter(I32 a_filterIndex) const =0;
103  };
104 
105  //* TODO not pure -> move out
106  class Spec
107  {
108  public:
109  Spec(void) {}
110 
111  void set(String a_name,String a_typeName)
112  {
113  m_name=a_name;
114  m_typeName=a_typeName;
115  }
116  const String& name(void) const { return m_name; }
117  const String& typeName(void) const { return m_typeName; }
118 
119  bool operator==(const Spec& a_rOtherSpec) const
120  { return (a_rOtherSpec.m_name==m_name &&
121  a_rOtherSpec.m_typeName==m_typeName); }
122 
123  private:
124  String m_name;
125  String m_typeName;
126  };
127 
128  //* TODO not pure -> move out
129  class ThreadingState: public Counted
130  {
131  public:
132  ThreadingState(void):
133  m_threading(e_singleThread) {}
134  void set(SurfaceAccessibleI::Threading
135  a_threading)
136  { m_threading=a_threading; }
137  SurfaceAccessibleI::Threading threading(void) const
138  { return m_threading; }
139  private:
140  SurfaceAccessibleI::Threading m_threading;
141  };
142 
143  /// @brief Return true if surface is available
144 virtual BWORD isBound(void) =0;
145  /// @brief associate with model data
146 virtual void bind(Instance a_instance) =0;
147  /// @brief choose a data scope
148 virtual void bind(sp<Scope> a_scope) =0;
149  /// @brief Inform threading intentions
151  a_spThreadingState) =0;
152 
153  /// @brief load model data from file
154 virtual BWORD load(String a_filename) =0;
155  /// @brief load model data with settings
156 virtual BWORD load(String a_filename,
157  sp<Catalog> a_spSettings) =0;
158  /// @brief save model data to file
159 virtual BWORD save(String a_filename) =0;
160  /// @brief save model data with settings
161 virtual BWORD save(String a_filename,
162  sp<Catalog> a_spSettings) =0;
163 
164  /** @brief Indicate whether an implementation
165  can be accessed from multiple threads. */
166 virtual BWORD threadable(void) =0;
167 
168  /// @brief Start a thread-unsafe action
169 virtual void lock(void) =0;
170 virtual void lock(I64 a_id) =0;
171  /// @brief Finish a thread-unsafe action
172 virtual void unlock(void) =0;
173 virtual void unlock(I64 a_id) =0;
174 
175 virtual void groupNames(Array<String>& a_rNameArray,
176  SurfaceAccessibleI::Element
177  a_element) const =0;
178 virtual void attributeSpecs(
180  a_rSpecs,
181  SurfaceAccessibleI::Element
182  a_element) const =0;
183 virtual void attributeSpecs(
185  a_rSpecs,
186  String a_nodeName,
187  SurfaceAccessibleI::Element
188  a_element) const =0;
189 
190 virtual void clear(void) =0;
191 
192 virtual I32 count(String a_nodeName,
193  SurfaceAccessibleI::Element
194  a_element) const =0;
195 virtual I32 count(SurfaceAccessibleI::Element
196  a_element) const =0;
197 
198  /// @brief Return access to an attribute
199 virtual sp<SurfaceAccessorI> accessor(String a_node,
200  SurfaceAccessibleI::Element a_element,
201  String a_name,
202  SurfaceAccessibleI::Creation a_create,
203  SurfaceAccessibleI::Writable a_writable
204  ) =0;
205 virtual sp<SurfaceAccessorI> accessor(String a_node,
206  SurfaceAccessibleI::Element a_element,
207  SurfaceAccessibleI::Attribute
208  a_attribute,
209  SurfaceAccessibleI::Creation a_create,
210  SurfaceAccessibleI::Writable a_writable
211  ) =0;
212 
213 virtual sp<SurfaceAccessorI> accessor(String a_node,
214  SurfaceAccessibleI::Element a_element,
215  String a_name,
216  SurfaceAccessibleI::Creation a_create)
217  =0;
218 virtual sp<SurfaceAccessorI> accessor(String a_node,
219  SurfaceAccessibleI::Element a_element,
220  SurfaceAccessibleI::Attribute
221  a_attribute,
222  SurfaceAccessibleI::Creation a_create)
223  =0;
224 
225 virtual sp<SurfaceAccessorI> accessor(SurfaceAccessibleI::Element a_element,
226  String a_name,
227  SurfaceAccessibleI::Creation a_create
228  ) =0;
229 virtual sp<SurfaceAccessorI> accessor(SurfaceAccessibleI::Element a_element,
230  SurfaceAccessibleI::Attribute
231  a_attribute,
232  SurfaceAccessibleI::Creation a_create
233  ) =0;
234 
235 virtual sp<SurfaceAccessorI> accessor(SurfaceAccessibleI::Element a_element,
236  String a_name) =0;
237 virtual sp<SurfaceAccessorI> accessor(SurfaceAccessibleI::Element a_element,
238  SurfaceAccessibleI::Attribute
239  a_attribute) =0;
240 
241  /** @brief Remove attributes/groups
242  for entire surface
243 
244  The pattern argument is space delimited
245  regex patterns. */
246 virtual I32 discardPattern(
247  SurfaceAccessibleI::Element a_element,
248  String a_pattern) =0;
249 virtual BWORD discard(SurfaceAccessibleI::Element a_element,
250  String a_name) =0;
251 virtual BWORD discard(SurfaceAccessibleI::Element a_element,
252  SurfaceAccessibleI::Attribute
253  a_attribute) =0;
254 
255  /** @brief Remove elements from surface
256 
257  The group string argument is space delimited
258  regex patterns of groups and/or
259  numerical ranges (like "2-5 17").
260 
261  If a_retainGroups is true,
262  remove all elements not in the groups. */
263 virtual I32 deleteElements(
264  SurfaceAccessibleI::Element a_element,
265  String a_groupString,
266  BWORD a_retainGroups) =0;
267 virtual I32 deleteElements(
268  SurfaceAccessibleI::Element a_element,
269  std::set<I32>& a_rIntSet,
270  BWORD a_retainGroups) =0;
271 
272  /// @brief Return current underlying SurfaceI
273 virtual sp<SurfaceI> surface(void) =0;
274 virtual sp<SurfaceI> surface(String a_group) =0;
275 virtual sp<SurfaceI> surface(String a_group,
276  SurfaceI::Restrictions
277  a_restrictions) =0;
278 
279 virtual sp<SurfaceI> subSurface(U32 a_subIndex) =0;
280 virtual sp<SurfaceI> subSurface(U32 a_subIndex,String a_group) =0;
281 virtual sp<SurfaceI> subSurface(U32 a_subIndex,String a_group,
282  SurfaceI::Restrictions
283  a_restrictions) =0;
284 
285 virtual void copy(sp<SurfaceAccessibleI>
286  a_spSurfaceAccessible) =0;
287 virtual void copy(sp<SurfaceAccessibleI>
288  a_spSurfaceAccessible,
289  String a_nodeName) =0;
290 virtual void copy(sp<SurfaceAccessibleI>
291  a_spSurfaceAccessible,
292  sp<FilterI> a_spFilter) =0;
293 
294 virtual void append(sp<SurfaceAccessibleI>
295  a_spSurfaceAccessibleI,
296  const SpatialTransform*
297  a_pTransform) =0;
298 
299 virtual void append(sp<SurfaceAccessibleI>
300  a_spSurfaceAccessible,
301  String a_nodeName,
303  a_rTransformArray,
304  sp<FilterI> a_spFilter) =0;
305 
306 virtual void instance(sp<SurfaceAccessibleI>
307  a_spSurfaceAccessibleI,
309  a_rTransformArray) =0;
310 
311 virtual sp<SpannedRange> atomize(SurfaceAccessibleI::AtomicChange
312  a_atomicChange,String a_group,
313  U32 a_desiredCount) =0;
314 
315 virtual sp<SpannedRange> atomizeConnectivity(
316  SurfaceAccessibleI::AtomicChange
317  a_atomicChange,String a_group,
318  U32 a_desiredCount,
319  BWORD a_checkPages) =0;
320 
321 virtual void setPaging(BWORD a_paging) =0;
322 virtual BWORD paging(void) const =0;
323 
324 virtual void preparePaging(SurfaceAccessibleI::AtomicChange
325  a_atomicChange,String a_group) =0;
326 virtual I32 pointPage(U32 a_pointIndex) const =0;
327 virtual I32 primitivePage(U32 a_primitiveIndex) const =0;
328 
329 virtual BWORD copyOutline(Array<String>&
330  a_rStringArray) const =0;
331 
332 virtual sp<Component> payload(void) =0;
333 };
334 
335 } /* namespace ext */
336 } /* namespace fe */
337 
338 #endif /* __surface_SurfaceAccessibleI_h__ */
Surface Element Access and Alteration.
Definition: SurfaceAccessibleI.h:22
Heap-based support for classes participating in fe::ptr <>
Definition: Counted.h:35
Smart pointer used with types represented by BaseType.
Definition: Instance.h:28
kernel
Definition: namespace.dox:3
view to a reduced set in indices
Definition: SurfaceAccessibleI.h:96
BWORD operator==(const DualString &s1, const DualString &s2)
Compare two DualString&#39;s.
Definition: DualString.h:208
Automatically reference-counted string container.
Definition: String.h:128
Wrapper for std::vector.
Definition: Array.h:21
Base for all interfacable components.
Definition: Component.h:20
Per-class participation non-RTTI fallback dynamic casting mechanism.
Definition: Castable.h:192