Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
FORMUS3IC_LAS3
/
embb
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
e59cccfc
authored
Apr 29, 2016
by
lucapegolotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
containers_cpp: improve style uniformity and readability
parent
b8e71625
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
438 additions
and
331 deletions
+438
-331
containers_cpp/include/embb/containers/blocking_map.h
+83
-32
containers_cpp/include/embb/containers/blocking_priority_queue.h
+60
-51
containers_cpp/include/embb/containers/blocking_queue.h
+45
-32
containers_cpp/include/embb/containers/blocking_set.h
+66
-31
containers_cpp/include/embb/containers/blocking_stack.h
+63
-54
containers_cpp/include/embb/containers/internal/blocking_map-inl.h
+24
-27
containers_cpp/include/embb/containers/internal/blocking_priority_queue-inl.h
+24
-27
containers_cpp/include/embb/containers/internal/blocking_push_and_pop_container.h
+26
-26
containers_cpp/include/embb/containers/internal/blocking_queue-inl.h
+1
-2
containers_cpp/include/embb/containers/internal/blocking_set-inl.h
+45
-46
containers_cpp/include/embb/containers/internal/blocking_stack-inl.h
+1
-3
No files found.
containers_cpp/include/embb/containers/blocking_map.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2016, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_BLOCKING_MAP_H_
#ifndef EMBB_CONTAINERS_BLOCKING_MAP_H_
#define EMBB_CONTAINERS_BLOCKING_MAP_H_
#define EMBB_CONTAINERS_BLOCKING_MAP_H_
...
@@ -33,26 +33,77 @@
...
@@ -33,26 +33,77 @@
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
/**
* Blocking map.
*
* \tparam Key Key type of the elements in the map.
* \tparam Value Value type of the elements in the map.
*/
template
<
typename
Key
,
typename
Value
>
template
<
typename
Key
,
typename
Value
>
class
BlockingMap
{
class
BlockingMap
{
typedef
embb
::
base
::
Mutex
Mutex
;
typedef
embb
::
base
::
Mutex
Mutex
;
typedef
embb
::
base
::
LockGuard
<>
LockGuard
;
typedef
embb
::
base
::
LockGuard
<>
LockGuard
;
private
:
private
:
/**
* Internal map from the standard library.
*/
std
::
map
<
Key
,
Value
>
internalMap
;
std
::
map
<
Key
,
Value
>
internalMap
;
/**
* Mutex for synchronizing concurrent accesses to the structure.
*/
Mutex
mutex
;
Mutex
mutex
;
public
:
public
:
/**
* Creates an empty map.
*/
BlockingMap
();
BlockingMap
();
bool
Insert
(
const
Key
&
key
,
const
Value
&
value
);
/**
* Inserts a new element (key,value) in the map, if no elements
bool
Erase
(
const
Key
&
key
);
* with the same key already exists.
*
bool
Contains
(
const
Key
&
key
);
* \return \c true if the inserting succeeded,
* \c false otherwise.
Value
&
operator
[](
const
Key
&
key
);
*/
bool
Insert
(
const
Key
&
key
,
/**< [IN] Constant reference to key of the element to insert*/
const
Value
&
value
/**< [IN] Constant reference to value of the element to insert*/
);
/**
* Erases the element with the specified key, if such an element exists.
*
* \return \c true if erasing was successfull, \c false otherwise.
*/
bool
Erase
(
const
Key
&
key
/**< [IN] Constant reference to the key of the element to erase*/
);
/*
* Checks if the map contains an element with the specified key.
*
* \return \c true if the the map contains the element, \c false
* otherwise
*/
bool
Contains
(
const
Key
&
key
/**< [IN] Constant reference to key of the element
to search for*/
);
/**
* Accesses the element with the specified key, if such an element exists.
* If it does not exists, creates an element with the specified key.
*
* \return Reference to the value with the specified key.
*/
Value
&
operator
[](
const
Key
&
key
/**< [IN] Constant reference to key of the element to access*/
);
};
};
...
@@ -61,5 +112,5 @@ class BlockingMap {
...
@@ -61,5 +112,5 @@ class BlockingMap {
#include <embb/containers/internal/blocking_map-inl.h>
#include <embb/containers/internal/blocking_map-inl.h>
#endif EMBB_CONTAINERS_BLOCKING_MAP_H_
#endif
//
EMBB_CONTAINERS_BLOCKING_MAP_H_
containers_cpp/include/embb/containers/blocking_priority_queue.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2015
, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_BLOCKING_PRIORITY_QUEUE_H_
#ifndef EMBB_CONTAINERS_BLOCKING_PRIORITY_QUEUE_H_
#define EMBB_CONTAINERS_BLOCKING_PRIORITY_QUEUE_H_
#define EMBB_CONTAINERS_BLOCKING_PRIORITY_QUEUE_H_
#include <queue>
#include <queue>
#include <embb/containers/internal/blocking_push_and_pop_container.h>
#include <embb/containers/internal/blocking_push_and_pop_container.h>
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
/**
/**
* Wrapper for the standard library priority_queue.
* Blocking priority queue.
*
*
* \tparam T Element type
* \concept{CPP_CONCEPTS_QUEUE}
*/
*
* \ingroup CPP_CONTAINERS_QUEUES
*
* \see WaitFreeSPSCQueue, LockFreeMPMCQueue, BlockingQueue
*
* \tparam Type Element type
* \tparam Container Type of the underlying container
* \tparam Compare Type of the ordering of the container,
* which determines what element will be
* dequeued next.
*/
template
<
typename
Type
,
template
<
typename
Type
,
class
Container
=
std
::
vector
<
Type
>
,
class
Container
=
std
::
vector
<
Type
>
,
class
Compare
=
std
::
less
<
typename
Container
::
value_type
>>
class
Compare
=
std
::
less
<
typename
Container
::
value_type
>>
class
BlockingPriorityQueue
:
public
BlockingPushAndPopContainer
<
Type
>
{
class
BlockingPriorityQueue
:
public
BlockingPushAndPopContainer
<
Type
>
{
private
:
private
:
/**
/**
* Internal priority_queue from the standard library.
* Internal priority_queue from the standard library.
*/
*/
std
::
priority_queue
<
Type
,
Container
,
Compare
>
internalQueue
;
std
::
priority_queue
<
Type
,
Container
,
Compare
>
internalQueue
;
/**
* Wrapper for the push method in the standard priority_queue.
* Implements the corresponding pure virtual method
* in the super class.
*/
void
SpecializedPush
(
const
Type
&
element
);
/**
* Wrapper for the pop method in the standard priority_queue.
* Implements the corresponding pure virtual method
* in the super class.
*/
void
SpecializedPop
(
Type
&
element
);
/**
* Wrapper for the empty method in the standard priority_queue.
* Implements the corresponding pure virtual method
* in the super class.
*/
bool
IsEmpty
();
public
:
public
:
/**
/**
* Enqueues an element in the internal priority_queue.
* Enqueues an element in the internal priority_queue.
...
@@ -60,27 +90,6 @@ class BlockingPriorityQueue : public BlockingPushAndPopContainer<Type> {
...
@@ -60,27 +90,6 @@ class BlockingPriorityQueue : public BlockingPushAndPopContainer<Type> {
void
Dequeue
(
void
Dequeue
(
Type
&
element
Type
&
element
/**< [IN] Reference to dequeued element*/
);
/**< [IN] Reference to dequeued element*/
);
protected
:
/*
* Wrapper for the push method in the standard priority_queue.
*/
virtual
void
SpecializedPush
(
const
Type
&
element
/**< [IN] Constant reference to element to push.*/
);
/**
* Wrapper for the pop method in the standard priority_queue.
*/
virtual
void
SpecializedPop
(
Type
&
element
/**< [IN,OUT] Reference to element to the popped element*/
);
/**
* Wrapper for the empty method in the standard priority_queue.
*/
virtual
bool
IsEmpty
();
};
};
}
// namespace containers
}
// namespace containers
...
...
containers_cpp/include/embb/containers/blocking_queue.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-201
5
, Siemens AG. All rights reserved.
* Copyright (c) 2014-201
6
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -28,55 +28,68 @@
...
@@ -28,55 +28,68 @@
#define EMBB_CONTAINERS_BLOCKING_QUEUE_H_
#define EMBB_CONTAINERS_BLOCKING_QUEUE_H_
#include <queue>
#include <queue>
#include <embb/containers/internal/blocking_push_and_pop_container.h>
#include <embb/containers/internal/blocking_push_and_pop_container.h>
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
/**
/**
* Wrapper for the standard library queue.
* Blocking queue.
*
*
* \tparam T Element type
* \concept{CPP_CONCEPTS_QUEUE}
*/
*
* \ingroup CPP_CONTAINERS_QUEUES
*
* \see WaitFreeSPSCQueue, LockFreeMPMCQueue, BlockingPriorityQueue
*
* \tparam Type Element type
*/
template
<
typename
Type
>
template
<
typename
Type
>
class
BlockingQueue
:
public
BlockingPushAndPopContainer
<
Type
>
{
class
BlockingQueue
:
public
BlockingPushAndPopContainer
<
Type
>
{
private
:
private
:
/**
/**
* Internal queue from the standard library.
* Internal queue from the standard library.
*/
*/
std
::
queue
<
Type
>
internalQueue
;
std
::
queue
<
Type
>
internalQueue
;
public
:
/**
/**
* Enqueues an element in the internal queue.
* Wrapper for push_back method in the standard library queue.
*/
* Implements the corresponding pure virtual method
void
Enqueue
(
* in the super class.
const
Type
&
element
*/
/**< [IN] Constant reference to element to enqueue*/
);
void
SpecializedPush
(
const
Type
&
element
);
/**
* Wrapper for pop_front method in the standard library queue.
* Implements the corresponding pure virtual method
* in the super class.
*/
void
SpecializedPop
(
Type
&
element
);
void
Dequeue
(
/**
Type
&
element
* Wrapper for the empty method in the standard queue.
/**< [IN] Reference to dequeued element*/
);
* Implements the corresponding pure virtual method
* in the super class.
*/
bool
IsEmpty
();
p
rotected
:
p
ublic
:
/
*
/*
*
*
Wrapper for the push method in the standard
queue.
*
Enqueues an element in the priority
queue.
*/
*/
v
irtual
void
SpecializedPush
(
v
oid
Enqueue
(
const
Type
&
element
const
Type
&
element
/**< [IN] Constant reference to element to
push.
*/
);
/**< [IN] Constant reference to element to
enqueue
*/
);
/**
/**
* Wrapper for the pop method in the standard queue.
* Dequeues the next element from the priority queue.
*/
* What element will be dequeued is determined by the Compare
virtual
void
SpecializedPop
(
* template parameter. By default, the next returned element is
* the one with the largest key.
*/
void
Dequeue
(
Type
&
element
Type
&
element
/**< [IN,OUT] Reference to element to the popped element*/
);
/**< [IN, OUT] Reference to dequeued element*/
);
/**
* Wrapper for the empty method in the standard queue.
*/
virtual
bool
IsEmpty
();
};
};
...
...
containers_cpp/include/embb/containers/blocking_set.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2015
, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_BLOCKING_SET_H_
#ifndef EMBB_CONTAINERS_BLOCKING_SET_H_
#define EMBB_CONTAINERS_BLOCKING_SET_H_
#define EMBB_CONTAINERS_BLOCKING_SET_H_
...
@@ -36,27 +36,62 @@ namespace embb {
...
@@ -36,27 +36,62 @@ namespace embb {
namespace
containers
{
namespace
containers
{
/*
/*
* Wrapper for the standard library
set.
* Blocking
set.
*
*
* \tparam T
Element type.
* \tparam Type
Element type.
*/
*/
template
<
typename
Type
>
template
<
typename
Type
>
class
BlockingSet
{
class
BlockingSet
{
typedef
embb
::
base
::
Mutex
Mutex
;
typedef
embb
::
base
::
Mutex
Mutex
;
typedef
embb
::
base
::
LockGuard
<
Mutex
>
LockGuard
;
typedef
embb
::
base
::
LockGuard
<
Mutex
>
LockGuard
;
private
:
private
:
/**
* Internal set from the standard library
*/
std
::
set
<
Type
>
internalSet
;
std
::
set
<
Type
>
internalSet
;
/**
* Mutex for synchronizing the accesses
* to the structure.
*/
Mutex
mutex
;
Mutex
mutex
;
public
:
public
:
/**
* Creates an empty set.
*/
BlockingSet
();
BlockingSet
();
bool
Insert
(
const
Type
&
element
);
/**
* Inserts an element in the set.
*
* \return \c true if the element has been inserted (i.e.
* it was not already in the set), \c false otherwise.
*/
bool
Insert
(
const
Type
&
element
/**< [IN] Reference to the element to insert. */
);
bool
Erase
(
const
Type
&
element
);
/**
* Erases an element from the set.
*
* \return \c true if the element has been erased (which means
* that it was in the set) \c false otherwise.
*/
bool
Erase
(
const
Type
&
element
/**< [IN] Reference to the element to erase. */
);
bool
Contains
(
const
Type
&
element
);
/**
* Checks if the an element is in the set.
*
* \return \c true if the element is in the set,
* \c false otherwise.
*/
bool
Contains
(
const
Type
&
element
/**< [IN] Reference to the element to search for. */
);
};
};
...
...
containers_cpp/include/embb/containers/blocking_stack.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2015
, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_BLOCKING_STACK_H_
#ifndef EMBB_CONTAINERS_BLOCKING_STACK_H_
#define EMBB_CONTAINERS_BLOCKING_STACK_H_
#define EMBB_CONTAINERS_BLOCKING_STACK_H_
#include <stack>
#include <stack>
#include <embb/containers/internal/blocking_push_and_pop_container.h>
#include <embb/containers/internal/blocking_push_and_pop_container.h>
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
/**
/**
* Wrapper for the standard library stack.
* Blocking stack.
*
*
* \tparam T Element type
* \concept{CPP_CONCEPTS_STACK}
*/
*
* \ingroup CPP_CONTAINERS_STACKS
*
* \tparam Type Type of the stack elements
*
*/
template
<
typename
Type
>
template
<
typename
Type
>
class
BlockingStack
:
public
BlockingPushAndPopContainer
<
Type
>
{
class
BlockingStack
:
public
BlockingPushAndPopContainer
<
Type
>
{
private
:
private
:
/**
/**
* Internal stack from the standard library.
* Internal stack from the standard library.
*/
*/
std
::
stack
<
Type
>
internalStack
;
std
::
stack
<
Type
>
internalStack
;
public
:
/*
* Wrapper for the push method in the standard stack.
* Implements the corresponding pure virtual method
* in the super class.
*/
void
SpecializedPush
(
const
Type
&
element
);
/**
/**
* Enstacks an element in the internal
stack.
* Wrapper for the pop method in the standard
stack.
*/
* Implements the corresponding pure virtual method
void
Push
(
* in the super class.
const
Type
&
element
*/
/**< [IN] Constant reference to element to push*/
);
void
SpecializedPop
(
Type
&
element
);
void
Pop
(
/**
Type
&
element
* Wrapper for the empty method in the standard stack.
/**< [IN] Reference to popped element*/
);
* Implements the corresponding pure virtual method
* in the super class
*/
bool
IsEmpty
();
p
rotected
:
p
ublic
:
/
*
/*
*
*
Wrapper for the push method in the standard
stack.
*
Pushes an element in the
stack.
*/
*/
v
irtual
void
Specialized
Push
(
v
oid
Push
(
const
Type
&
element
const
Type
&
element
/**< [IN] Constant reference to element to push
.
*/
);
/**< [IN] Constant reference to element to push*/
);
/**
/**
* Wrapper for the pop method in the standard
stack.
* Pop an element from the
stack.
*/
*/
v
irtual
void
Specialized
Pop
(
v
oid
Pop
(
Type
&
element
Type
&
element
/**< [IN,OUT] Reference to element to the popped element*/
);
/**< [IN, OUT] Reference to popped element*/
);
/**
* Wrapper for the empty method in the standard stack.
*/
virtual
bool
IsEmpty
();
};
};
...
...
containers_cpp/include/embb/containers/internal/blocking_map-inl.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2016, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_MAP_INL_H_
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_MAP_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_SET_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_SET_INL_H_
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
...
@@ -35,7 +34,6 @@ template<typename K, typename V>
...
@@ -35,7 +34,6 @@ template<typename K, typename V>
BlockingMap
<
K
,
V
>::
BlockingMap
()
:
BlockingMap
<
K
,
V
>::
BlockingMap
()
:
internalMap
()
{}
internalMap
()
{}
template
<
typename
K
,
typename
V
>
template
<
typename
K
,
typename
V
>
bool
BlockingMap
<
K
,
V
>::
Insert
(
const
K
&
key
,
const
V
&
value
)
{
bool
BlockingMap
<
K
,
V
>::
Insert
(
const
K
&
key
,
const
V
&
value
)
{
LockGuard
lock
(
mutex
);
LockGuard
lock
(
mutex
);
...
@@ -60,7 +58,6 @@ V& BlockingMap<K, V>::operator[](const K& key) {
...
@@ -60,7 +58,6 @@ V& BlockingMap<K, V>::operator[](const K& key) {
return
internalMap
[
key
];
return
internalMap
[
key
];
}
}
}
}
}
}
...
...
containers_cpp/include/embb/containers/internal/blocking_priority_queue-inl.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2015
, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_PRIORITY_QUEUE_INL_H_
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_PRIORITY_QUEUE_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_PRIORITY_QUEUE_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_PRIORITY_QUEUE_INL_H_
...
@@ -56,9 +56,7 @@ bool BlockingPriorityQueue<T, Container, Compare>::IsEmpty() {
...
@@ -56,9 +56,7 @@ bool BlockingPriorityQueue<T, Container, Compare>::IsEmpty() {
return
internalQueue
.
empty
();
return
internalQueue
.
empty
();
}
}
}
}
}
}
#endif // EMBB_CONTAINERS_INTERNAL_BLOCKING_PRIORITY_QUEUE_INL_H_
#endif // EMBB_CONTAINERS_INTERNAL_BLOCKING_PRIORITY_QUEUE_INL_H_
\ No newline at end of file
containers_cpp/include/embb/containers/internal/blocking_push_and_pop_container.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2015
, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_BLOCKING_PUSH_AND_POP_CONTAINER_H_
#ifndef EMBB_CONTAINERS_BLOCKING_PUSH_AND_POP_CONTAINER_H_
#define EMBB_CONTAINERS_BLOCKING_PUSH_AND_POP_CONTAINER_H_
#define EMBB_CONTAINERS_BLOCKING_PUSH_AND_POP_CONTAINER_H_
...
@@ -30,10 +30,11 @@
...
@@ -30,10 +30,11 @@
#include <embb/base/base.h>
#include <embb/base/base.h>
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
// Abstract class, provides a synchronization mechanism for
// data structures that support push/pop-like methods (e.g. stacks, queues)
template
<
typename
Type
>
template
<
typename
Type
>
class
BlockingPushAndPopContainer
{
class
BlockingPushAndPopContainer
{
...
@@ -69,7 +70,6 @@ class BlockingPushAndPopContainer {
...
@@ -69,7 +70,6 @@ class BlockingPushAndPopContainer {
SpecializedPop
(
element
);
SpecializedPop
(
element
);
}
}
};
};
}
}
...
...
containers_cpp/include/embb/containers/internal/blocking_queue-inl.h
View file @
e59cccfc
#include "..\blocking_queue.h"
/*
/*
* Copyright (c) 2014-201
5
, Siemens AG. All rights reserved.
* Copyright (c) 2014-201
6
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
...
containers_cpp/include/embb/containers/internal/blocking_set-inl.h
View file @
e59cccfc
/*
/*
* Copyright (c) 2014-2015
, Siemens AG. All rights reserved.
* Copyright (c) 2014-2016
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
*
*
* 1. Redistributions of source code must retain the above copyright notice,
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* this list of conditions and the following disclaimer.
*
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* and/or other materials provided with the distribution.
*
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_SET_INL_H_
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_SET_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_SET_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_SET_INL_H_
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
template
<
typename
T
>
template
<
typename
T
>
BlockingSet
<
T
>::
BlockingSet
()
:
BlockingSet
<
T
>::
BlockingSet
()
:
internalSet
()
{}
internalSet
()
{}
template
<
typename
T
>
template
<
typename
T
>
bool
BlockingSet
<
T
>::
Insert
(
const
T
&
element
){
bool
BlockingSet
<
T
>::
Insert
(
const
T
&
element
){
LockGuard
lock
(
mutex
);
LockGuard
lock
(
mutex
);
return
internalSet
.
insert
(
element
).
second
;
return
internalSet
.
insert
(
element
).
second
;
}
}
template
<
typename
T
>
template
<
typename
T
>
bool
BlockingSet
<
T
>::
Erase
(
const
T
&
element
){
bool
BlockingSet
<
T
>::
Erase
(
const
T
&
element
){
LockGuard
lock
(
mutex
);
LockGuard
lock
(
mutex
);
return
internalSet
.
erase
(
element
)
>
0
;
return
internalSet
.
erase
(
element
)
>
0
;
}
}
template
<
typename
T
>
template
<
typename
T
>
bool
BlockingSet
<
T
>::
Contains
(
const
T
&
element
){
bool
BlockingSet
<
T
>::
Contains
(
const
T
&
element
){
LockGuard
lock
(
mutex
);
LockGuard
lock
(
mutex
);
return
internalSet
.
find
(
element
)
!=
internalSet
.
end
();
return
internalSet
.
find
(
element
)
!=
internalSet
.
end
();
}
}
}
}
}
}
...
...
containers_cpp/include/embb/containers/internal/blocking_stack-inl.h
View file @
e59cccfc
#include "..\blocking_stack.h"
/*
/*
* Copyright (c) 2014-201
5
, Siemens AG. All rights reserved.
* Copyright (c) 2014-201
6
, Siemens AG. All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* modification, are permitted provided that the following conditions are met:
...
@@ -28,7 +27,6 @@
...
@@ -28,7 +27,6 @@
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_STACK_INL_H_
#ifndef EMBB_CONTAINERS_INTERNAL_BLOCKING_STACK_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_STACK_INL_H_
#define EMBB_CONTAINERS_INTERNAL_BLOCKING_STACK_INL_H_
namespace
embb
{
namespace
embb
{
namespace
containers
{
namespace
containers
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment