Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
graph-tool
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
43
Issues
43
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tiago Peixoto
graph-tool
Commits
ecabb934
Commit
ecabb934
authored
Sep 19, 2008
by
Tiago Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid unnecessary string assembly inside inline()
parent
a4bff0c6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
11 deletions
+10
-11
src/graph_tool/run_action/inline.py
src/graph_tool/run_action/inline.py
+10
-11
No files found.
src/graph_tool/run_action/inline.py
View file @
ecabb934
...
...
@@ -37,6 +37,16 @@ cxxflags = libgraph_tool_core.mod_info().cxxflags + " -I%s" % inc_prefix
# this is the code template which defines the action function object
support_template
=
open
(
prefix
+
"/run_action/run_action_template.hh"
).
read
()
# property map types
props
=
""
for
d
in
[
"vertex"
,
"edge"
,
"graph"
]:
for
t
in
core
.
value_types
():
props
+=
((
"typedef typename %s_prop_t::template as<%s >::type"
+
\
" %sprop_%s_t;
\n
"
)
%
\
(
d
,
t
,
d
[
0
],
t
.
replace
(
" "
,
"_"
).
replace
(
"::"
,
"_"
)
\
.
replace
(
"<"
,
"_"
).
replace
(
">"
,
"_"
))).
\
replace
(
"__"
,
"_"
)
def
inline
(
g
,
code
,
arg_names
=
[],
local_dict
=
None
,
global_dict
=
None
,
force
=
0
,
compiler
=
"gcc"
,
verbose
=
0
,
auto_downcast
=
1
,
support_code
=
""
,
libraries
=
[],
...
...
@@ -49,19 +59,8 @@ def inline(g, code, arg_names=[], local_dict=None,
# we need to have different template names for each actions, to avoid
# strange RTTI issues. We'll therefore append an md5 hash of the code (plus
# grah_tool version string) to each action's name
import
hashlib
code_hash
=
hashlib
.
md5
(
code
+
core
.
__version__
).
hexdigest
()
# property map types
props
=
""
for
d
in
[
"vertex"
,
"edge"
,
"graph"
]:
for
t
in
core
.
value_types
():
props
+=
((
"typedef typename %s_prop_t::template as<%s >::type"
+
\
" %sprop_%s_t;
\n
"
)
%
\
(
d
,
t
,
d
[
0
],
t
.
replace
(
" "
,
"_"
).
replace
(
"::"
,
"_"
)
\
.
replace
(
"<"
,
"_"
).
replace
(
">"
,
"_"
))).
\
replace
(
"__"
,
"_"
)
# each term on the expansion will properly unwrap a tuple pointer value
# to a reference with the appropriate name and type
exp_term
=
"""typename boost::remove_pointer<typename tr1::tuple_element<%d,Args>::type>::type& %s =
...
...
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