Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-5.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
jslee02 committed Oct 23, 2015
2 parents c383323 + 0e5d071 commit 5792cbb
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 43 deletions.
39 changes: 21 additions & 18 deletions ci/before_install_osx.sh
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
brew tap dartsim/dart
brew tap homebrew/science

brew update
brew update > /dev/null

brew install git
# brew install cmake # installed cmake-3.0.2
brew install assimp
brew install fcl
brew install bullet
brew install flann # 1.8.14
# brew install boost # installed boost-1.55.2
brew install eigen # 3.2.2
brew install tinyxml # 2.6.2
brew install tinyxml2 # 2.2.0
brew install libccd #
brew install nlopt # 2.4.2
brew install ipopt
brew install ros/deps/urdfdom
brew install ros/deps/urdfdom_headers
brew install ros/deps/console_bridge
brew install ros/deps/gtest
PACKAGES='
git
cmake
assimp
fcl
bullet
flann
boost
eigen
tinyxml
tinyxml2
libccd
nlopt
ipopt
ros/deps/urdfdom
ros/deps/urdfdom_headers
ros/deps/console_bridge
ros/deps/gtest
'

brew install $PACKAGES | grep -v '%$'
4 changes: 2 additions & 2 deletions dart/common/LocalResourceRetriever.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace dart {
namespace common {

//==============================================================================
bool LocalResourceRetriever::exists(const Uri& _uri) const
bool LocalResourceRetriever::exists(const Uri& _uri)
{
// Open and close the file to check if it exists. It would be more efficient
// to stat() it, but that is not portable.
Expand All @@ -58,7 +58,7 @@ bool LocalResourceRetriever::exists(const Uri& _uri) const
}

//==============================================================================
common::ResourcePtr LocalResourceRetriever::retrieve(const Uri& _uri) const
common::ResourcePtr LocalResourceRetriever::retrieve(const Uri& _uri)
{
if(_uri.mScheme.get_value_or("file") != "file")
return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions dart/common/LocalResourceRetriever.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ class LocalResourceRetriever : public virtual ResourceRetriever
virtual ~LocalResourceRetriever() = default;

// Documentation inherited.
bool exists(const Uri& _uri) const override;
bool exists(const Uri& _uri) override;

// Documentation inherited.
ResourcePtr retrieve(const Uri& _uri) const override;
ResourcePtr retrieve(const Uri& _uri) override;
};

using LocalResourceRetrieverPtr = std::shared_ptr<LocalResourceRetriever>;
Expand Down
10 changes: 8 additions & 2 deletions dart/common/ResourceRetriever.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,16 @@ class ResourceRetriever
virtual ~ResourceRetriever() = default;

/// \brief Return whether the resource specified by a URI exists.
virtual bool exists(const Uri& _uri) const = 0;
virtual bool exists(const Uri& _uri) = 0;

/// \brief Return the resource specified by a URI or nullptr on failure.
virtual ResourcePtr retrieve(const Uri& _uri) const = 0;
virtual ResourcePtr retrieve(const Uri& _uri) = 0;

// We don't const-qualify for exists and retrieve here. Derived classes of
// ResourceRetriever will be interacting with external resources that you
// don't necessarily have control over so we cannot guarantee that you get the
// same result every time with the same input Uri. Indeed, const-qualification
// for those functions is pointless.
};

using ResourceRetrieverPtr = std::shared_ptr<ResourceRetriever>;
Expand Down
4 changes: 2 additions & 2 deletions dart/utils/CompositeResourceRetriever.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ bool CompositeResourceRetriever::addSchemaRetriever(
}

//==============================================================================
bool CompositeResourceRetriever::exists(const common::Uri& _uri) const
bool CompositeResourceRetriever::exists(const common::Uri& _uri)
{
for(const common::ResourceRetrieverPtr& resourceRetriever
: getRetrievers(_uri))
Expand All @@ -87,7 +87,7 @@ bool CompositeResourceRetriever::exists(const common::Uri& _uri) const

//==============================================================================
common::ResourcePtr CompositeResourceRetriever::retrieve(
const common::Uri& _uri) const
const common::Uri& _uri)
{
const std::vector<common::ResourceRetrieverPtr> &retrievers
= getRetrievers(_uri);
Expand Down
4 changes: 2 additions & 2 deletions dart/utils/CompositeResourceRetriever.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,10 @@ class CompositeResourceRetriever : public virtual common::ResourceRetriever
const common::ResourceRetrieverPtr& _resourceRetriever);

// Documentation inherited.
bool exists(const common::Uri& _uri) const override;
bool exists(const common::Uri& _uri) override;

// Documentation inherited.
common::ResourcePtr retrieve(const common::Uri& _uri) const override;
common::ResourcePtr retrieve(const common::Uri& _uri) override;

private:
std::vector<common::ResourceRetrieverPtr> getRetrievers(
Expand Down
5 changes: 2 additions & 3 deletions dart/utils/PackageResourceRetriever.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ void PackageResourceRetriever::addPackageDirectory(
}

//==============================================================================
bool PackageResourceRetriever::exists(const common::Uri& _uri) const
bool PackageResourceRetriever::exists(const common::Uri& _uri)
{
std::string packageName, relativePath;
if (!resolvePackageUri(_uri, packageName, relativePath))
Expand All @@ -89,8 +89,7 @@ bool PackageResourceRetriever::exists(const common::Uri& _uri) const
}

//==============================================================================
common::ResourcePtr PackageResourceRetriever::retrieve(
const common::Uri& _uri) const
common::ResourcePtr PackageResourceRetriever::retrieve(const common::Uri& _uri)
{
std::string packageName, relativePath;
if (!resolvePackageUri(_uri, packageName, relativePath))
Expand Down
4 changes: 2 additions & 2 deletions dart/utils/PackageResourceRetriever.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ class PackageResourceRetriever : public virtual common::ResourceRetriever
const std::string& _packageDirectory);

// Documentation inherited.
bool exists(const common::Uri& _uri) const override;
bool exists(const common::Uri& _uri) override;

// Documentation inherited.
common::ResourcePtr retrieve(const common::Uri& _uri) const override;
common::ResourcePtr retrieve(const common::Uri& _uri) override;

private:
common::ResourceRetrieverPtr mLocalRetriever;
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<buildtool_depend>cmake</buildtool_depend>
<buildtool_depend>pkg-config</buildtool_depend>
<depend>assimp</depend>
<depend>bullet</depend>
<depend>eigen</depend>
<depend>fcl</depend>
<depend>glut</depend>
Expand Down
18 changes: 8 additions & 10 deletions unittests/TestHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -404,41 +404,39 @@ struct TestResource : public dart::common::Resource
//==============================================================================
struct PresentResourceRetriever : public dart::common::ResourceRetriever
{
bool exists(const dart::common::Uri& _uri) const override
bool exists(const dart::common::Uri& _uri) override
{
mExists.push_back(_uri.toString());
return true;
}

dart::common::ResourcePtr retrieve(
const dart::common::Uri& _uri) const override
dart::common::ResourcePtr retrieve(const dart::common::Uri& _uri) override
{
mRetrieve.push_back(_uri.toString());
return std::make_shared<TestResource>();
}

mutable std::vector<std::string> mExists;
mutable std::vector<std::string> mRetrieve;
std::vector<std::string> mExists;
std::vector<std::string> mRetrieve;
};

//==============================================================================
struct AbsentResourceRetriever : public dart::common::ResourceRetriever
{
bool exists(const dart::common::Uri& _uri) const override
bool exists(const dart::common::Uri& _uri) override
{
mExists.push_back(_uri.toString());
return false;
}

dart::common::ResourcePtr retrieve(
const dart::common::Uri& _uri) const override
dart::common::ResourcePtr retrieve(const dart::common::Uri& _uri) override
{
mRetrieve.push_back(_uri.toString());
return nullptr;
}

mutable std::vector<std::string> mExists;
mutable std::vector<std::string> mRetrieve;
std::vector<std::string> mExists;
std::vector<std::string> mRetrieve;
};

#endif // #ifndef DART_UNITTESTS_TEST_HELPERS_H

0 comments on commit 5792cbb

Please sign in to comment.