24.02
IQueue.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2021 Arm Limited.
3
*
4
* SPDX-License-Identifier: MIT
5
*
6
* Permission is hereby granted, free of charge, to any person obtaining a copy
7
* of this software and associated documentation files (the "Software"), to
8
* deal in the Software without restriction, including without limitation the
9
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
10
* sell copies of the Software, and to permit persons to whom the Software is
11
* furnished to do so, subject to the following conditions:
12
*
13
* The above copyright notice and this permission notice shall be included in all
14
* copies or substantial portions of the Software.
15
*
16
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
* SOFTWARE.
23
*/
24
#ifndef SRC_COMMON_IQUEUE_H_
25
#define SRC_COMMON_IQUEUE_H_
26
27
#include "
src/common/IContext.h
"
28
29
struct
AclQueue_
30
{
31
arm_compute::detail::Header
header
{
arm_compute::detail::ObjectType::Queue
,
nullptr
};
32
33
protected
:
34
AclQueue_
() =
default
;
35
~
AclQueue_
() =
default
;
36
};
37
38
namespace
arm_compute
39
{
40
/** Base class specifying the queue interface */
41
class
IQueue
:
public
AclQueue_
42
{
43
public
:
44
/** Explict Operator Constructor
45
*
46
* @param[in] ctx Context to be used by the operator
47
*/
48
explicit
IQueue
(
IContext
*ctx)
49
{
50
this->
header
.
ctx
= ctx;
51
this->
header
.
ctx
->
inc_ref
();
52
}
53
/** Destructor */
54
virtual
~IQueue
()
55
{
56
this->
header
.
ctx
->
dec_ref
();
57
this->
header
.
type
=
detail::ObjectType::Invalid
;
58
};
59
/** Checks if a queue is valid
60
*
61
* @return True if successful otherwise false
62
*/
63
bool
is_valid
()
const
64
{
65
return
this->
header
.
type
==
detail::ObjectType::Queue
;
66
};
67
virtual
StatusCode
finish
() = 0;
68
};
69
70
/** Extract internal representation of a Queue
71
*
72
* @param[in] queue Opaque queue pointer
73
*
74
* @return The internal representation as an IQueue
75
*/
76
inline
IQueue
*
get_internal
(
AclQueue
queue)
77
{
78
return
static_cast<
IQueue
*
>
(queue);
79
}
80
81
namespace
detail
82
{
83
/** Check if an internal queue is valid
84
*
85
* @param[in] queue Internal queue to check
86
*
87
* @return A status code
88
*/
89
inline
StatusCode
validate_internal_queue
(
const
IQueue
*queue)
90
{
91
if
(queue ==
nullptr
|| !queue->
is_valid
())
92
{
93
ARM_COMPUTE_LOG_ERROR_ACL
(
"[IQueue]: Invalid queue object"
);
94
return
StatusCode::InvalidArgument
;
95
}
96
return
StatusCode::Success
;
97
}
98
}
// namespace detail
99
}
// namespace arm_compute
100
#endif
/* SRC_COMMON_IQUEUE_H_ */
ARM_COMPUTE_LOG_ERROR_ACL
#define ARM_COMPUTE_LOG_ERROR_ACL(msg)
Definition:
Log.h:32
arm_compute::StatusCode::Success
@ Success
arm_compute::IQueue
Base class specifying the queue interface.
Definition:
IQueue.h:41
arm_compute::IContext
Context interface.
Definition:
IContext.h:51
arm_compute::IContext::inc_ref
void inc_ref() const
Increment context refcount.
Definition:
IContext.h:71
arm_compute::detail::ObjectType::Invalid
@ Invalid
arm_compute::StatusCode
StatusCode
Definition:
Types.h:32
arm_compute::detail::ObjectType::Queue
@ Queue
arm_compute::IQueue::~IQueue
virtual ~IQueue()
Destructor.
Definition:
IQueue.h:54
arm_compute::StatusCode::InvalidArgument
@ InvalidArgument
arm_compute::detail::Header::ctx
IContext * ctx
Definition:
Object.h:60
arm_compute::detail::Header
Definition:
Object.h:48
IContext.h
arm_compute::detail::Header::type
ObjectType type
Definition:
Object.h:59
arm_compute::IQueue::IQueue
IQueue(IContext *ctx)
Explict Operator Constructor.
Definition:
IQueue.h:48
AclQueue_::header
arm_compute::detail::Header header
Definition:
IQueue.h:31
arm_compute
Copyright (c) 2017-2024 Arm Limited.
Definition:
introduction.dox:24
AclQueue_
Definition:
IQueue.h:29
arm_compute::IQueue::finish
virtual StatusCode finish()=0
arm_compute::get_internal
IContext * get_internal(AclContext ctx)
Extract internal representation of a Context.
Definition:
IContext.h:127
arm_compute::IContext::dec_ref
void dec_ref() const
Decrement context refcount.
Definition:
IContext.h:76
arm_compute::IQueue::is_valid
bool is_valid() const
Checks if a queue is valid.
Definition:
IQueue.h:63
arm_compute::detail::validate_internal_queue
StatusCode validate_internal_queue(const IQueue *queue)
Check if an internal queue is valid.
Definition:
IQueue.h:89
src
common
IQueue.h
Generated on Wed Feb 14 2024 11:14:46 for Compute Library by
1.8.17