Hi Mario and Steve,<div><br></div><div>I like what Steve wrote. If there are reusable functions that can be used from more than one algorithm, then we should do so.</div><div><br></div><div>I would like to add that the separation of "core" and "extra" was only because of the CGAL and GAUL dependency. So someone, who didn't need driving distance, shouldn't have to struggle with compiling CGAL as well.</div>
<div><br></div><div>Now as we don't need CGAL anymore since PostGIS 2.0, there is no need for "core" and "extra" anymore. GAUL is GPL as pgRouting and it didn't change for many years. So we could even compile it together with pgRouting.</div>
<div><br></div><div>Instead of "core" and "extra" I would prefer a directory for every new pgRouting algorithm. It could then contain files like:</div><div><ul><li>commons</li><ul><li>sql</li><li>src</li>
<li>tests</li><li>docs_common.rst</li></ul><li><algorithm_name></li><ul><li>sql</li><ul><li><file_name>.sql</li></ul><li>src</li><ul><li><file_name>.c</li><li><file_name>.h</li><li><file_name>.cpp</li>
</ul><li>tests</li><li>README.txt</li><li>docs_<algorithm>.rst</li></ul></ul></div><div>For example we can then ask for each algorithm to contain tests and documentation.</div><div><br></div><div>Daniel</div><div><br>
</div><div><br><br><div class="gmail_quote">On Wed, Jul 11, 2012 at 2:38 AM, Stephen Woodbridge <span dir="ltr"><<a href="mailto:woodbri@swoodbridge.com" target="_blank">woodbri@swoodbridge.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On 7/10/2012 5:23 AM, Mario Basa wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I am encountering problems placing the drivedist.c and<br>
boost_drivedist.cpp into core (everything compiles, drivedist works<br>
but astar searches dumps core. If I take out drivedist, astar works<br>
like normal.), so I decided to poke around the source. I just found<br>
out that there are so many duplicate functions (i.e.<br>
finish(),text2char(),etc.) and struct names (edge_column,etc.) in each<br>
of the C files.<br>
<br>
Since C does not have any namespace functionality nor function<br>
overloading, I don't have any idea which one will be called whenever<br>
there is a library call. Scary since this will be difficult to debug.<br>
<br>
Now that pgRouting is getting source contributions, I think this will<br>
be a good time that we start discussing function naming conventions to<br>
avoid duplicates as well as directory (core and extensions)<br>
structures.<br>
</blockquote>
<br></div>
Mario,<br>
<br>
UGH! Ideally one of two things should happen:<br>
<br>
1. common functions with compatible signatures should be extracted into a common.c common.h or utils.c utils.h and get shared by all algorithms that need them.<br>
<br>
2. local functions should all be declares "static" which means they are not visible or callable from references outside the file they are declared in.<br>
<br>
So, if you have a C wrapper and it needs functions and no other files need to use these functions then they should be declared as static and placed in the C wrapper file.<br>
<br>
If you have some function that multiple C files need to call or you C++ also needs to call, then it needs to go into a file like <namespace>_utils.c and all the functions in this file need to have a unique <namespace>_functionname() like signature.<br>
<br>
I think this will minimize the changes we need to make to the existing code using "static" declarations for most things, and then moving the others into some namespace'd set of files.<br>
<br>
How does this sound?<br>
<br>
I like the idea of having multiple library .so files rather than one huge file because it keeps things separated but more so because it makes it easy to rebuild one library without effecting any of the others. I would like to know that if I change TRSP that there is little to zero change that I can impact the other algorithms.<br>
<br>
Thank about a production environment where you have pgrouting running on lots of databases and in one database you want to add TRSP. By making it one big library you force a change on all the databases that did not need that change, but if TRSP is in a separate library then all the database that are not using it can be assured to be stable because they did not change. The worsted cases is that the new database with TRSP added to it might be unstable and if there is a collision of files like you describe the cases crashes, it only happens in the new database. Hmmm, maybe it doesn't work this way once the postgresql loads the library. But I don't remember having problems loading multiple libraries.<br>
<br>
Thoughts?<br>
<br>
-Steve<div class="HOEnZb"><div class="h5"><br>
______________________________<u></u>_________________<br>
pgrouting-dev mailing list<br>
<a href="mailto:pgrouting-dev@lists.osgeo.org" target="_blank">pgrouting-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/pgrouting-dev" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/pgrouting-dev</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><span style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">Georepublic UG & Georepublic Japan<br>eMail: <a href="mailto:daniel.kastl@georepublic.de" style="color:rgb(66,99,171)" target="_blank">daniel.kastl@georepublic.de</a><br>
Web: <a href="http://georepublic.de/" style="color:rgb(66,99,171)" target="_blank">http://georepublic.de</a></span><br>
</div>