Tesseract
Motion Planning Environment
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
tesseract_common::SimpleLocatedResource Class Reference

Resource implementation for a local file. More...

#include <resource_locator.h>

Inheritance diagram for tesseract_common::SimpleLocatedResource:
Inheritance graph
[legend]
Collaboration diagram for tesseract_common::SimpleLocatedResource:
Collaboration graph
[legend]

Public Types

using Ptr = std::shared_ptr< SimpleLocatedResource >
 
using ConstPtr = std::shared_ptr< const SimpleLocatedResource >
 
- Public Types inherited from tesseract_common::Resource
using Ptr = std::shared_ptr< Resource >
 
using ConstPtr = std::shared_ptr< const Resource >
 
- Public Types inherited from tesseract_common::ResourceLocator
using Ptr = std::shared_ptr< ResourceLocator >
 
using ConstPtr = std::shared_ptr< const ResourceLocator >
 

Public Member Functions

 SimpleLocatedResource ()=default
 This is for boost serialization do not use directly. More...
 
 SimpleLocatedResource (std::string url, std::string filename, ResourceLocator::ConstPtr parent=nullptr)
 A generic resource. More...
 
 ~SimpleLocatedResource () override=default
 
 SimpleLocatedResource (const SimpleLocatedResource &)=default
 
SimpleLocatedResourceoperator= (const SimpleLocatedResource &)=default
 
 SimpleLocatedResource (SimpleLocatedResource &&)=default
 
SimpleLocatedResourceoperator= (SimpleLocatedResource &&)=default
 
bool isFile () const override final
 Returns true if the located resource is a local file. More...
 
std::string getUrl () const override final
 Get the original URL used to locate the file. More...
 
std::string getFilePath () const override final
 Get the file path of the resource. Only valid if isFile() is true. More...
 
std::vector< uint8_t > getResourceContents () const override final
 Get the resource as bytes. This function may block. More...
 
std::shared_ptr< std::istream > getResourceContentStream () const override final
 Get the resource as a std::istream. This function and the returned stream may block. More...
 
Resource::Ptr locateResource (const std::string &url) const override final
 Locate a resource based on a URL. More...
 
bool operator== (const SimpleLocatedResource &rhs) const
 
bool operator!= (const SimpleLocatedResource &rhs) const
 
- Public Member Functions inherited from tesseract_common::Resource
virtual bool isFile () const =0
 Returns true if the located resource is a local file. More...
 
virtual std::string getUrl () const =0
 Get the original URL used to locate the file. More...
 
virtual std::string getFilePath () const =0
 Get the file path of the resource. Only valid if isFile() is true. More...
 
virtual std::vector< uint8_t > getResourceContents () const =0
 Get the resource as bytes. This function may block. More...
 
virtual std::shared_ptr< std::istream > getResourceContentStream () const =0
 Get the resource as a std::istream. This function and the returned stream may block. More...
 
bool operator== (const Resource &rhs) const
 
bool operator!= (const Resource &rhs) const
 
- Public Member Functions inherited from tesseract_common::ResourceLocator
virtual ~ResourceLocator ()=default
 
virtual std::shared_ptr< ResourcelocateResource (const std::string &url) const =0
 Locate a resource based on a URL. More...
 
bool operator== (const ResourceLocator &rhs) const
 
bool operator!= (const ResourceLocator &rhs) const
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

std::string url_
 
std::string filename_
 
ResourceLocator::ConstPtr parent_
 

Friends

class boost::serialization::access
 

Detailed Description

Resource implementation for a local file.

Member Typedef Documentation

◆ ConstPtr

◆ Ptr

Constructor & Destructor Documentation

◆ SimpleLocatedResource() [1/4]

tesseract_common::SimpleLocatedResource::SimpleLocatedResource ( )
default

This is for boost serialization do not use directly.

◆ SimpleLocatedResource() [2/4]

tesseract_common::SimpleLocatedResource::SimpleLocatedResource ( std::string  url,
std::string  filename,
ResourceLocator::ConstPtr  parent = nullptr 
)

A generic resource.

Parameters
urlThe url to the resource
filenameThe file path to the resource
parentThe locator used to locate the resource

◆ ~SimpleLocatedResource()

tesseract_common::SimpleLocatedResource::~SimpleLocatedResource ( )
overridedefault

◆ SimpleLocatedResource() [3/4]

tesseract_common::SimpleLocatedResource::SimpleLocatedResource ( const SimpleLocatedResource )
default

◆ SimpleLocatedResource() [4/4]

tesseract_common::SimpleLocatedResource::SimpleLocatedResource ( SimpleLocatedResource &&  )
default

Member Function Documentation

◆ getFilePath()

std::string tesseract_common::SimpleLocatedResource::getFilePath ( ) const
finaloverridevirtual

Get the file path of the resource. Only valid if isFile() is true.

Returns
The file path to the resource

Implements tesseract_common::Resource.

◆ getResourceContents()

std::vector< uint8_t > tesseract_common::SimpleLocatedResource::getResourceContents ( ) const
finaloverridevirtual

Get the resource as bytes. This function may block.

Returns
Resource bytes as a uint8_t vector

Implements tesseract_common::Resource.

◆ getResourceContentStream()

std::shared_ptr< std::istream > tesseract_common::SimpleLocatedResource::getResourceContentStream ( ) const
finaloverridevirtual

Get the resource as a std::istream. This function and the returned stream may block.

Returns
A std::istream shared pointer for the resource data

Implements tesseract_common::Resource.

◆ getUrl()

std::string tesseract_common::SimpleLocatedResource::getUrl ( ) const
finaloverridevirtual

Get the original URL used to locate the file.

Returns
The URL of the resource

Implements tesseract_common::Resource.

◆ isFile()

bool tesseract_common::SimpleLocatedResource::isFile ( ) const
finaloverridevirtual

Returns true if the located resource is a local file.

Returns
true if the resource is a local file, otherwise false

Implements tesseract_common::Resource.

◆ locateResource()

tesseract_common::Resource::Ptr tesseract_common::SimpleLocatedResource::locateResource ( const std::string &  url) const
finaloverridevirtual

Locate a resource based on a URL.

Parameters
urlThe URL of the resource
Returns
A shared pointer to a Resource instance, or nullptr if not found

Implements tesseract_common::ResourceLocator.

◆ operator!=()

bool tesseract_common::SimpleLocatedResource::operator!= ( const SimpleLocatedResource rhs) const

◆ operator=() [1/2]

SimpleLocatedResource & tesseract_common::SimpleLocatedResource::operator= ( const SimpleLocatedResource )
default

◆ operator=() [2/2]

SimpleLocatedResource & tesseract_common::SimpleLocatedResource::operator= ( SimpleLocatedResource &&  )
default

◆ operator==()

bool tesseract_common::SimpleLocatedResource::operator== ( const SimpleLocatedResource rhs) const

◆ serialize()

template<class Archive >
void tesseract_common::SimpleLocatedResource::serialize ( Archive &  ar,
const unsigned int  version 
)
private

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Member Data Documentation

◆ filename_

std::string tesseract_common::SimpleLocatedResource::filename_
private

◆ parent_

ResourceLocator::ConstPtr tesseract_common::SimpleLocatedResource::parent_
private

◆ url_

std::string tesseract_common::SimpleLocatedResource::url_
private

The documentation for this class was generated from the following files: