CorTeX
Core ABI 7
ToolTech Software · C++ library reference
ToolTech
CorTeX overview
Programmer’s manual
Class reference
Change history
CycloPos ↗
Toggle main menu visibility
Loading...
Searching...
No Matches
include
ctxInputBuffer.h
Go to the documentation of this file.
1
//*****************************************************************************
2
// File : ctxInputBuffer.h
3
// Description : Managers input typed buffers
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_INPUT_BUFFER_H__
22
#define __CTX_INPUT_BUFFER_H__
23
24
#include "
ctxBuffer.h
"
25
26
template
<
class
T>
class
ctxInputBuffer
27
{
28
public
:
29
30
inline
ctxInputBuffer
(T *data,gzUInt32 size,
ctxBuffer
*old=NULL);
31
32
inline
gzBool
setInputData
(T *data, gzUInt32 size,gzUInt32 offset=0);
33
34
inline
gzBool
valid
()
const
;
35
36
operator
ctxBuffer
* ()
const
37
{
38
return
m_buffer;
39
}
40
41
private
:
42
43
ctxBufferPtr m_buffer;
44
};
45
46
47
template
<
class
T>
inline
ctxInputBuffer<T>::ctxInputBuffer
(T *data, gzUInt32 size,
ctxBuffer
*old)
48
{
49
if
(old && (old->
getBufferType
()==
getBufferType<T>
()) && (old->
getBufferSize
()==
sizeof
(T)*size))
50
m_buffer = old;
51
else
52
m_buffer =
ctxBuffer::create
(
getBufferType<T>
(),
sizeof
(T)*size);
53
54
if
(m_buffer)
55
setInputData
(data,
sizeof
(T)*size);
56
}
57
58
template
<
class
T>
inline
gzBool
ctxInputBuffer<T>::valid
()
const
59
{
60
return
m_buffer != NULL;
61
}
62
63
template
<
class
T>
inline
gzBool
ctxInputBuffer<T>::setInputData
(T *data, gzUInt32 size,gzUInt32 offset)
64
{
65
if
(data && m_buffer)
66
return
m_buffer->setBufferData(data, size*
sizeof
(T),offset*
sizeof
(T));
67
else
68
return
FALSE;
69
}
70
71
#endif
//__CTX_INPUT_BUFFER_H__
72
73
ctxBuffer
Definition
ctxBuffer.h:43
ctxBuffer::getBufferSize
virtual gzUInt32 getBufferSize() const =0
ctxBuffer::create
static ctxBuffer * create(ctxBufferType type, gzUInt32 size)
ctxBuffer::getBufferType
virtual ctxBufferType getBufferType() const =0
ctxInputBuffer::valid
gzBool valid() const
Definition
ctxInputBuffer.h:58
ctxInputBuffer::setInputData
gzBool setInputData(T *data, gzUInt32 size, gzUInt32 offset=0)
Definition
ctxInputBuffer.h:63
ctxInputBuffer::ctxInputBuffer
ctxInputBuffer(T *data, gzUInt32 size, ctxBuffer *old=NULL)
Definition
ctxInputBuffer.h:47
ctxBuffer.h
getBufferType
ctxBufferType getBufferType()
Definition
ctxBufferType.h:46
Generated by
1.18.0