You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since #652, DART has been composed as the core library dart and several component libraries like dart-optimizer-nlopt, and the component libraries get compiled only when the required dependencies are installed. We then introduced dart::gui::osg namespace for OpenSceneGraph dependent library rather than using prefix like dart::gui::OsgViewer. However, we still use prefixes for other component classes like NloptSolver and IpoptSolver. I think we should follow one rule for consistency, but not sure which one is preferred way.
After Googling, I learned that using namespaces is the C++ way while using prefixes is the C way, and I'm inclined to using namespaces because of this reason.
Downsides of using namespace I can imagine would be (1) that it would require more typing for :: (e.g., NloptSolver vs nlopt::Solver) and (2) that it could cause namespace conflict with the dependency namespace (e.g., dart::collision::fcl of DART and fcl of FCL). (2) can be resolved by using the global namespace specifier like ::fcl for FCL namespace, though.
Here are some examples of current, namespace, and prefix cases.
dart::collision::fcl::CollisionDetector
dart::collision::bullet::CollisionDetector
dart::collision::dart::CollisionDetector // or something like dart::collision::builtin::CollisionDetector since dart::collision::dart would be ambiguous
dart::optimizer::nlopt::Solver
dart::optimizer::ipopt::Solver
dart::gui::glut::Window
dart::gui::glfw::Window
dart::gui::osg::[~]
The text was updated successfully, but these errors were encountered:
I agree on using namespace over prefixes, but we still use prefixes for optimizers and collision detectors. If we close this, then let's create an issue to track it.
Since #652, DART has been composed as the core library
dart
and several component libraries likedart-optimizer-nlopt
, and the component libraries get compiled only when the required dependencies are installed. We then introduceddart::gui::osg
namespace for OpenSceneGraph dependent library rather than using prefix likedart::gui::OsgViewer
. However, we still use prefixes for other component classes likeNloptSolver
andIpoptSolver
. I think we should follow one rule for consistency, but not sure which one is preferred way.After Googling, I learned that using namespaces is the C++ way while using prefixes is the C way, and I'm inclined to using namespaces because of this reason.
Downsides of using namespace I can imagine would be (1) that it would require more typing for
::
(e.g.,NloptSolver
vsnlopt::Solver
) and (2) that it could cause namespace conflict with the dependency namespace (e.g.,dart::collision::fcl
of DART andfcl
of FCL). (2) can be resolved by using the global namespace specifier like::fcl
for FCL namespace, though.Here are some examples of current, namespace, and prefix cases.
current
prefix
namespace
dart::collision::fcl::CollisionDetector dart::collision::bullet::CollisionDetector dart::collision::dart::CollisionDetector // or something like dart::collision::builtin::CollisionDetector since dart::collision::dart would be ambiguous dart::optimizer::nlopt::Solver dart::optimizer::ipopt::Solver dart::gui::glut::Window dart::gui::glfw::Window dart::gui::osg::[~]
The text was updated successfully, but these errors were encountered: