HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GT_DAConstant.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: GT_DAConstant.h ( GT Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __GT_DAConstant__
12 #define __GT_DAConstant__
13 
14 #include "GT_API.h"
15 #include "GT_DAInherit.h"
16 
17 /// @brief Extend a single element from a source array to emulate a larger array
18 ///
19 /// Given a source data array, this class will emulate a larger array by
20 /// extending a single element from the source array over a given size.
21 /// For example: @code
22 /// GT_DataArray &src;
23 /// GT_DAConstant varying;
24 /// varying.init(32, 100);
25 /// @endcode
26 /// Creates an array of 100 entries referencing element 32 from the source
27 /// array.
29 public:
30  /// Default constructor
32  : mySize(0)
33  , myOffset(0)
34  , GT_DAInherit()
35  {
36  }
37  /// Useful constructor
40  : myOffset(offset)
41  , mySize(size)
42  , GT_DAInherit(data)
43  {
44  }
45  /// Copy constructor
47  : myOffset(src.myOffset),
48  mySize(src.mySize),
49  GT_DAInherit(src)
50  {
51  }
52  virtual ~GT_DAConstant();
53 
54  virtual const char *className() const { return "GT_DAConstant"; }
55 
56  /// Create a constant data array from the existing data array.
57  static const GT_DataArrayHandle createConstant(
58  const GT_DataArrayHandle &h,
60  GT_Size size);
61 
62  /// Initialize with given data
65  {
66  GT_DAInherit::init(data);
67  myOffset = offset;
68  mySize = size;
69  }
70 
71  GT_IMPL_INHERIT_ARRAY(getIndirect, mySize)
72 
73 private:
74  /// Map the requested offset to the offset in my data
75  inline GT_Offset getIndirect(GT_Offset) const
76  { return myOffset; }
77 
78  GT_Offset myOffset;
79  GT_Size mySize;
80 };
81 
82 #endif
virtual const char * className() const
Definition: GT_DAConstant.h:54
Extend a single element from a source array to emulate a larger array.
Definition: GT_DAConstant.h:28
#define GT_API
Definition: GT_API.h:11
GLsizeiptr size
Definition: glcorearb.h:663
GT_DAConstant(const GT_DAConstant &src)
Copy constructor.
Definition: GT_DAConstant.h:46
GLintptr offset
Definition: glcorearb.h:664
void init(const GT_DataArrayHandle &data, GT_Offset offset, GT_Size size)
Initialize with given data.
Definition: GT_DAConstant.h:63
GT_DAConstant(const GT_DataArrayHandle &data, GT_Offset offset, GT_Size size)
Useful constructor.
Definition: GT_DAConstant.h:38
GLboolean * data
Definition: glcorearb.h:130
GLfloat GLfloat GLfloat GLfloat h
Definition: glcorearb.h:2001
Base class for a data array which references another data array.
Definition: GT_DAInherit.h:18
#define GT_IMPL_INHERIT_ARRAY(MAP_INDEX, SIZE)
Definition: GT_DAInherit.h:71
void init(const GT_DataArrayHandle &data)
Definition: GT_DAInherit.h:32
GT_DAConstant()
Default constructor.
Definition: GT_DAConstant.h:31
int64 GT_Offset
Definition: GT_Types.h:110
int64 GT_Size
Definition: GT_Types.h:109
GLenum src
Definition: glcorearb.h:1792