HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
EX_Vector.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: evvector.C ( EXPR Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __EX_Vector_h__
12 #define __EX_Vector_h__
13 
14 #include "EXPR_API.h"
15 #include <UT/UT_VectorTypes.h>
16 #include <SYS/SYS_Types.h>
17 
18 class ev_Matrix;
19 
20 //
21 // Class definition for array data types
22 //
23 
25 {
26 public:
27  ev_Vector(int size=1);
28  ev_Vector(const ev_Vector &src);
29  ~ev_Vector();
30 
31  ev_Vector &operator=(const ev_Vector &src) = delete;
32 
33  int getSize() const { return (int)myArray[0]; }
34  fpreal getValue(int idx) const;
35  fpreal fastGet(int idx) const { return myArray[idx+1]; }
36  void setValue(int idx, fpreal val);
37  void fastSet(int idx, fpreal val) { myArray[idx+1] = val; }
38 
39  void copy(const ev_Vector &src);
40  void add(const ev_Vector &src);
41  void sub(const ev_Vector &src);
42  void times(fpreal scalar);
43  void times(const ev_Matrix &src);
44 
45  void getVector3(UT_Vector3R &v) const;
46  void getVector4(UT_Vector4R &v) const;
47  void setVector3(const UT_Vector3R &v);
48  void setVector4(const UT_Vector4R &v);
49 
50  int castFrom(const char *str);
51  int castFrom(fpreal val);
52  int castFrom(ev_Matrix &from);
53  int castTo(ev_Matrix &to) const;
54  int castToFloat(fpreal &rval) const;
55  char *castToString() const;
56 
57  // Returns 1 if it's a valid vector string
58  int scan(const char *str);
59 
60  fpreal operator()(int idx) const { return fastGet(idx); }
61  fpreal operator[](int idx) const { return getValue(idx); }
62  void grow(int newsize);
63 
64 private:
65 
66  fpreal *myArray;
67 };
68 
69 #endif
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
const GLdouble * v
Definition: glcorearb.h:837
fpreal operator()(int idx) const
Definition: EX_Vector.h:60
ImageBuf OIIO_API sub(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
int getSize() const
Definition: EX_Vector.h:33
void fastSet(int idx, fpreal val)
Definition: EX_Vector.h:37
GLsizeiptr size
Definition: glcorearb.h:664
fpreal64 fpreal
Definition: SYS_Types.h:277
fpreal operator[](int idx) const
Definition: EX_Vector.h:61
GLuint GLfloat * val
Definition: glcorearb.h:1608
fpreal fastGet(int idx) const
Definition: EX_Vector.h:35
ImageBuf OIIO_API add(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
#define EXPR_API
Definition: EXPR_API.h:10
GLenum src
Definition: glcorearb.h:1793