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
d6b292eb
authored
Mar 14, 2016
by
lucapegolotti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix style of sequential_data_structures.h
parent
d6a1458a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
70 deletions
+55
-70
linearizability_tester/src/sequential_data_structures.h
+55
-70
No files found.
linearizability_tester/src/sequential_data_structures.h
View file @
d6b292eb
...
...
@@ -8,7 +8,7 @@
namespace
lt
{
namespace
state
{
class
Set
{
{
public
:
typedef
char
Value
;
typedef
bool
Ret
;
...
...
@@ -35,7 +35,7 @@ class Set
bool
ret
=
set
.
is_empty
();
return
{
ret
==
empty_ret
.
ret
,
set
};
}
};
};
struct
ContainsCallOp
:
public
internal
::
ArgOp
<
Set
,
Value
,
s_contains_op_name
>
{
...
...
@@ -150,28 +150,27 @@ class Set
{
return
m_bitset
!=
set
.
m_bitset
;
}
};
};
constexpr
char
Set
::
s_empty_op_name
[];
constexpr
char
Set
::
s_contains_op_name
[];
constexpr
char
Set
::
s_insert_op_name
[];
constexpr
char
Set
::
s_erase_op_name
[];
constexpr
char
Set
::
s_empty_op_name
[];
constexpr
char
Set
::
s_contains_op_name
[];
constexpr
char
Set
::
s_insert_op_name
[];
constexpr
char
Set
::
s_erase_op_name
[];
template
<>
struct
Hash
<
Set
>
{
template
<>
struct
Hash
<
Set
>
{
std
::
size_t
operator
()(
const
Set
&
set
)
const
noexcept
{
return
set
.
bitset
().
hash_code
();
}
};
/// Bounded stack
};
/// N - stack capacity
template
<
std
::
size_t
N
>
class
Stack
{
/// Bounded stack
/// N - stack capacity
template
<
std
::
size_t
N
>
class
Stack
{
public
:
typedef
char
Value
;
...
...
@@ -488,14 +487,29 @@ class Set
// \see_also http://en.cppreference.com/w/cpp/types/size_t
return
reinterpret_cast
<
uintptr_t
>
(
m_curr
);
}
};
};
/// Bounded queue
template
<
std
::
size_t
N
>
constexpr
char
Stack
<
N
>::
s_try_push_op_name
[];
/// N - queue capacity
template
<
std
::
size_t
N
>
class
Queue
{
template
<
std
::
size_t
N
>
constexpr
char
Stack
<
N
>::
s_try_pop_op_name
[];
template
<
std
::
size_t
N
>
struct
Hash
<
Stack
<
N
>>
{
std
::
size_t
operator
()(
const
Stack
<
N
>&
stack
)
const
noexcept
{
return
stack
.
hash_code
();
}
};
/// Bounded queue
/// N - queue capacity
template
<
std
::
size_t
N
>
class
Queue
{
public
:
typedef
char
Value
;
...
...
@@ -550,12 +564,12 @@ class Set
return
m_value
;
}
#ifdef _LT_DEBUG_
#ifdef _LT_DEBUG_
std
::
ostream
&
print
(
std
::
ostream
&
os
)
const
override
{
return
os
<<
"ret: [ok: "
<<
ok
()
<<
", value: "
<<
(
ok
()
?
std
::
to_string
(
value
())
:
"undefined"
)
<<
"]"
;
}
#endif
#endif
};
struct
TryDequeueCallOp
:
public
internal
::
ZeroArgOp
<
Queue
<
N
>
,
s_try_dequeue_op_name
>
...
...
@@ -620,7 +634,6 @@ class Set
if
(
m_next
!=
nullptr
)
{
m_next
->
m_prev
=
nullptr
;
}
}
Node
(
const
Node
&
)
=
delete
;
...
...
@@ -640,6 +653,7 @@ class Set
m_next
{
next
},
m_ref_counter
{
0U
},
m_nexts_num
{
0U
}
{
if
(
prev
!=
nullptr
)
{
prev
->
m_ref_counter
++
;
}
...
...
@@ -650,11 +664,6 @@ class Set
NodePtr
update_next
(
Value
value
)
{
/*
if (m_nexts_num > 0 && m_next != nullptr) {
m_next->m_ref_counter--;
}
*/
NodePtr
node_ptr
=
new
Node
(
value
,
this
,
nullptr
);
m_next
=
node_ptr
;
node_ptr
->
m_ref_counter
++
;
...
...
@@ -732,7 +741,6 @@ class Set
// Decrement reference counter of head and tail, delete them if necessary
void
dec_ref_counter
()
const
{
NodePtr
curNode
=
m_head
;
NodePtr
aux
=
nullptr
;
...
...
@@ -762,16 +770,9 @@ class Set
curNode
=
curNode
->
prev
();
if
(
curNode
!=
nullptr
)
{
/*if (curNode->next() != aux) {
if (aux->m_ref_counter == 1) {
break;
}
}*/
--
curNode
->
m_ref_counter
;
}
delete
aux
;
}
}
...
...
@@ -806,8 +807,6 @@ class Set
return
find_next
(
m_head
);
}
public
:
~
Queue
()
...
...
@@ -931,38 +930,23 @@ class Set
// \see_also http://en.cppreference.com/w/cpp/types/size_t
return
reinterpret_cast
<
uintptr_t
>
(
m_head
);
}
};
template
<
std
::
size_t
N
>
constexpr
char
Stack
<
N
>::
s_try_push_op_name
[];
template
<
std
::
size_t
N
>
constexpr
char
Stack
<
N
>::
s_try_pop_op_name
[];
template
<
std
::
size_t
N
>
struct
Hash
<
Stack
<
N
>>
{
std
::
size_t
operator
()(
const
Stack
<
N
>&
stack
)
const
noexcept
{
return
stack
.
hash_code
();
}
};
};
template
<
std
::
size_t
N
>
constexpr
char
Queue
<
N
>::
s_try_enqueue_op_name
[];
template
<
std
::
size_t
N
>
constexpr
char
Queue
<
N
>::
s_try_enqueue_op_name
[];
template
<
std
::
size_t
N
>
constexpr
char
Queue
<
N
>::
s_try_dequeue_op_name
[];
template
<
std
::
size_t
N
>
constexpr
char
Queue
<
N
>::
s_try_dequeue_op_name
[];
template
<
std
::
size_t
N
>
struct
Hash
<
Queue
<
N
>>
{
std
::
size_t
operator
()(
const
Queue
<
N
>&
queue
)
const
noexcept
{
template
<
std
::
size_t
N
>
struct
Hash
<
Queue
<
N
>>
{
std
::
size_t
operator
()(
const
Queue
<
N
>&
queue
)
const
noexcept
{
return
queue
.
hash_code
();
}
};
}
}
};
}
// state
}
// lt
#endif
\ No newline at end of file
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