Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Gauthier Quesnel
bits
Commits
1c24bbcc
Commit
1c24bbcc
authored
Apr 04, 2019
by
Gauthier Quesnel
Browse files
next12
parent
b605f021
Pipeline
#2308
failed with stage
in 25 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
include/bits/data-array.hpp
View file @
1c24bbcc
...
...
@@ -377,13 +377,6 @@ template<typename T, typename Identifier>
Identifier
data_array
<
T
,
Identifier
>::
get_id
(
const
T
&
t
)
{
using
type
=
data_array
<
T
,
Identifier
>::
item
;
// auto offset = offsetof(type, id);
// auto* ptr = reinterpret_cast<const char*>(&t);
// ptr += offset;
// return static_cast<int>(*reinterpret_cast<const int*>(ptr));
auto
*
ptr
=
reinterpret_cast
<
const
item
*>
(
&
t
);
return
ptr
->
id
;
}
...
...
include/bits/linker.hpp
View file @
1c24bbcc
...
...
@@ -145,7 +145,7 @@ private:
iterator
(
this_type
*
list_
,
DataArray
*
dataarray_
,
Identifier
elem_
)
noexcept
int
elem_
)
noexcept
:
list
(
list_
)
,
dataarray
(
dataarray_
)
,
elem
(
elem_
)
...
...
test/vpz.cpp
View file @
1c24bbcc
...
...
@@ -185,7 +185,7 @@ struct Vpz
bits
::
multi_linker
<
ID
,
ID
>
model_children
{
4096
};
bits
::
multi_linker
<
ID
,
ID
>
condition_named_values
{
4096
};
void
init
(
int
object_capacity
,
int
list_capacity
)
void
init
(
int
object_capacity
,
int
/*
list_capacity
*/
)
{
dynamics
.
init
(
object_capacity
);
views
.
init
(
object_capacity
);
...
...
@@ -260,10 +260,34 @@ struct Vpz
fprintf
(
&
f
,
" <experiment name=
\"
%s
\"
>
\n
"
,
name
.
c_str
());
fprintf
(
&
f
,
" <conditions>
\n
"
);
// Condition* cond = nullptr;
// while (conditions.next(cond)) {
// write(f, *cond);
// }
Condition
*
cond
=
nullptr
;
while
(
conditions
.
next
(
cond
))
{
fprintf
(
&
f
,
" <condition name=
\"
%s
\"
>
\n
"
,
cond
->
name
.
c_str
());
for
(
auto
it
=
condition_named_values
.
begin
(
&
conditions
,
conditions
.
get_id
(
*
cond
)),
et
=
condition_named_values
.
end
(
&
conditions
);
it
!=
et
;
++
it
)
{
auto
*
namedvalue
=
named_values
.
try_to_get
(
*
it
);
fprintf
(
&
f
,
" <port name=
\"
%s
\"
>
\n
"
,
namedvalue
->
name
.
c_str
());
switch
(
namedvalue
->
type
)
{
case
value_type
::
real32
:
{
auto
*
v
=
real32
.
try_to_get
(
namedvalue_links
[
*
it
]);
fprintf
(
&
f
,
" <double>%f</double>
\n
"
,
static_cast
<
double
>
(
*
v
));
}
break
;
default:
break
;
// to be continued
}
}
fprintf
(
&
f
,
" </condition>
\n
"
);
}
fprintf
(
&
f
,
" </experiment>
\n
"
);
}
...
...
@@ -380,7 +404,7 @@ struct Vpz
{
auto
id_coupledmodel
=
models
.
get_id
(
coupledmodel
);
auto
id_port_source
=
output_ports
.
get_id
(
port_source
);
auto
id_port_destination
=
input_ports
.
get_id
(
port_
source
);
auto
id_port_destination
=
input_ports
.
get_id
(
port_
destination
);
model_connections
.
emplace
(
id_coupledmodel
,
ID2
(
id_port_source
,
id_port_destination
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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