CorTeX Core ABI 7
ToolTech Software · C++ library reference
Loading...
Searching...
No Matches
ctxVector.h
Go to the documentation of this file.
1//*****************************************************************************
2// File : ctxVector.h
3// Description : Templates for buffered Vector operations
4// Author : Anders Modén
5// Product : CorTeX 2.0.1
6//
7// Copyright © 2015- Anders Modén, Sweden
8//
9// NOTE: CorTeX is a software development kit (SDK)
10// for neural networks and genetic programming.
11// Licensed by Anders Modén.
12//
13//
14// Revision History...
15//
16// Who Date Description
17//
18// AMO 150708 Created file (1.0.0)
19//
20//******************************************************************************
21#ifndef __CTX_VECTOR_H__
22#define __CTX_VECTOR_H__
23
25#include "ctxInputBuffer.h"
26#include "ctxOutputBuffer.h"
27
28
29template <class T> class ctxVector : public ctxTransformInstance
30{
31public:
32
34 {
35 // As we create a "result" instance in this call we want an evaluated answer
36
37 // One page
38
39 // Page 0
40
41 exec();
42 }
43
44 ctxVector(T *memory=NULL, gzUInt32 count=0)
45 {
46
47 set(memory, count);
48 }
49
50 ctxVector(const T &v1)
51 {
52 set(&v1, 1);
53 }
54
55 ctxVector(const T &v1,const T &v2)
56 {
57 T val[] = { v1, v2 };
58
59 set(val, 2);
60 }
61
62 ctxVector(const T &v1, const T &v2,const T &v3)
63 {
64 T val[] = { v1, v2, v3};
65
66 set(val, 3);
67 }
68
69 ctxVector(const T &v1, const T &v2, const T &v3,const T &v4)
70 {
71 T val[] = { v1, v2, v3, v4};
72
73 set(val, 4);
74 }
75
76 gzVoid set(T *memory, gzUInt32 count)
77 {
78 if(memory && count) // We set the result directly from memory
79 m_transform->setBuffer(RESULT,ctxInputBuffer<T>(memory,count));
80 }
81
82 gzBool get(T *memory, gzUInt32 count)
83 {
84 if (memory && count)
85 {
86 ctxOutputBuffer<T> output(m_transform->getBuffer(RESULT));
87
88 return output.getOutputData(memory, count);
89 }
90
91 return FALSE;
92 }
93};
94
95
96#endif //__CTX_VECTOR_H__
97
gzBool getOutputData(T *data, gzUInt32 size, gzUInt32 offset=0)
ctxTransform * getTransform()
gzBool exec(ctxContext *context=NULL, ctxTransformCommand command=EVALUATE, gzUInt32 pages=1)
ctxVector(const T &v1)
Definition ctxVector.h:50
ctxVector(const T &v1, const T &v2, const T &v3)
Definition ctxVector.h:62
ctxVector(const T &v1, const T &v2, const T &v3, const T &v4)
Definition ctxVector.h:69
gzBool get(T *memory, gzUInt32 count)
Definition ctxVector.h:82
ctxVector(ctxTransformInstance &result)
Definition ctxVector.h:33
ctxVector(T *memory=NULL, gzUInt32 count=0)
Definition ctxVector.h:44
ctxVector(const T &v1, const T &v2)
Definition ctxVector.h:55
gzVoid set(T *memory, gzUInt32 count)
Definition ctxVector.h:76
@ RESULT