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

Represents resource data available from a file or url. More...

#include <resource_locator.h>

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

Public Types

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

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)
 

Friends

class boost::serialization::access
 

Detailed Description

Represents resource data available from a file or url.

Member Typedef Documentation

◆ ConstPtr

using tesseract_common::Resource::ConstPtr = std::shared_ptr<const Resource>

◆ Ptr

using tesseract_common::Resource::Ptr = std::shared_ptr<Resource>

Member Function Documentation

◆ getFilePath()

virtual std::string tesseract_common::Resource::getFilePath ( ) const
pure virtual

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

Returns
The file path to the resource

Implemented in tesseract_common::SimpleLocatedResource, and tesseract_common::BytesResource.

◆ getResourceContents()

virtual std::vector< uint8_t > tesseract_common::Resource::getResourceContents ( ) const
pure virtual

Get the resource as bytes. This function may block.

Returns
Resource bytes as a uint8_t vector

Implemented in tesseract_common::SimpleLocatedResource, and tesseract_common::BytesResource.

◆ getResourceContentStream()

virtual std::shared_ptr< std::istream > tesseract_common::Resource::getResourceContentStream ( ) const
pure virtual

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

Implemented in tesseract_common::SimpleLocatedResource, and tesseract_common::BytesResource.

◆ getUrl()

virtual std::string tesseract_common::Resource::getUrl ( ) const
pure virtual

Get the original URL used to locate the file.

Returns
The URL of the resource

Implemented in tesseract_common::SimpleLocatedResource, and tesseract_common::BytesResource.

◆ isFile()

virtual bool tesseract_common::Resource::isFile ( ) const
pure virtual

Returns true if the located resource is a local file.

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

Implemented in tesseract_common::SimpleLocatedResource, and tesseract_common::BytesResource.

◆ operator!=()

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

◆ operator==()

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

◆ serialize()

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

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

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