|
libflute
|
File Description object. More...
#include <Transmitter.h>
Public Types | |
| enum | CompressionAlgorithm { COMPRESSION_NONE = 0 , COMPRESSION_GZIP , COMPRESSION_DEFLATE } |
| using | date_time_type = std::chrono::system_clock::time_point |
Public Member Functions | |
| FileDescription ()=delete | |
| FileDescription (const std::string &content_location, const std::string &filename) | |
| Make a file description using the contents of a local file. More... | |
| FileDescription (const std::string &content_location, const char *data, size_t length) | |
| Make a file description using the contents of a memory buffer. More... | |
| FileDescription (const std::string &content_location) | |
| Make a file description without contents. More... | |
| FileDescription (const FileDescription &other) | |
| Copy constructor. More... | |
| FileDescription (FileDescription &&other) | |
| Move constructor. More... | |
| virtual | ~FileDescription () |
| Destructor. More... | |
| FileDescription & | operator= (const FileDescription &other) |
| Copy operator. More... | |
| FileDescription & | operator= (FileDescription &&other) |
| Move operator. More... | |
| bool | operator== (const FileDescription &other) const |
| Equality operator. More... | |
| bool | has_tsi () const |
| Has a Transmitter associated a TSI with this file? More... | |
| uint64_t | tsi () const |
| Get the associated TSI value. More... | |
| uint32_t | toi () const |
| Get the TOI associated with this file description. More... | |
| const FileDeliveryTable::FileEntry & | file_entry () const |
| Get the FDT file entry. More... | |
| const char * | data () |
| Get the data to be transmitted. More... | |
| size_t | data_length () |
| Get the length in bytes of the data to be transmitted. More... | |
| FileDescription & | set_compression (CompressionAlgorithm compression) |
| Set the compression algorithm. More... | |
| FileDescription & | set_content_location (const std::string &location) |
| Set Content-Location. More... | |
| FileDescription & | set_content (const std::string &filename) |
| Change the file contents using a local file. More... | |
| FileDescription & | set_content (const char *data, size_t data_length) |
| Change the file contents using a memory buffer. More... | |
| FileDescription & | set_content_type (const std::string &content_type) |
| Change the file content type. More... | |
| FileDescription & | set_expiry_time (const date_time_type &expiry_time) |
| Change the file expiry time. More... | |
| date_time_type | get_expiry_time () const |
| Get the currently set expiry time. More... | |
| FileDescription & | set_etag (const std::string &etag) |
| Set the ETag value for the file. More... | |
| const std::string & | get_etag () const |
| Get the current ETag value. More... | |
| FileDescription (const std::string &content_location, const std::vector< char > &data) | |
| Make a file description using the contents of a vector. More... | |
| FileDescription (const std::string &content_location, const std::vector< unsigned char > &data) | |
| FileDescription & | set_content (const std::vector< char > &data) |
| Change the file contents using a vector. More... | |
| FileDescription & | set_content (const std::vector< unsigned char > &data) |
Protected Member Functions | |
| FileDescription & | tsi (uint64_t val) |
| Set the TSI (used by the Transmitter class) More... | |
| FileDescription & | toi (uint32_t val) |
| Set the TOI (used by the Transmitter class) More... | |
| uint32_t | previous_toi () const |
| Get the TOI before reset. More... | |
| FileDescription & | reset_previous_toi () |
| Reset the previous TOI value. More... | |
| FileDescription & | merge_fec_oti (const FecOti &fec_oti) |
| Merge the FecOti values. More... | |
Friends | |
| class | Transmitter |
File Description object.
Definition at line 52 of file Transmitter.h.
| using LibFlute::Transmitter::FileDescription::date_time_type = std::chrono::system_clock::time_point |
Definition at line 54 of file Transmitter.h.
| Enumerator | |
|---|---|
| COMPRESSION_NONE | |
| COMPRESSION_GZIP | |
| COMPRESSION_DEFLATE | |
Definition at line 56 of file Transmitter.h.
|
delete |
| LibFlute::Transmitter::FileDescription::FileDescription | ( | const std::string & | content_location, |
| const std::string & | filename | ||
| ) |
Make a file description using the contents of a local file.
| content_location | The URL to use as the content location in the FDT when sending the file |
| filename | The filename in the local filesystem of the file contents associated with this file description |
Definition at line 63 of file Transmitter.cpp.
| LibFlute::Transmitter::FileDescription::FileDescription | ( | const std::string & | content_location, |
| const std::vector< char > & | data | ||
| ) |
Make a file description using the contents of a vector.
This does not copy the data, it only retains a reference to it. It is up to the application to ensure that the data is retained in memory until it has finished with this file description and the Transmitter has finished sending the file.
| content_location | The URL to use as the content location in the FDT when sending the file |
| data | The vector containing the file contents |
Definition at line 76 of file Transmitter.cpp.
| LibFlute::Transmitter::FileDescription::FileDescription | ( | const std::string & | content_location, |
| const std::vector< unsigned char > & | data | ||
| ) |
Definition at line 88 of file Transmitter.cpp.
| LibFlute::Transmitter::FileDescription::FileDescription | ( | const std::string & | content_location, |
| const char * | data, | ||
| size_t | length | ||
| ) |
Make a file description using the contents of a memory buffer.
This does not copy the data, it only retains a reference to it. It is up to the application to ensure that the data is retained in memory until it has finished with this file description and the Transmitter has finished sending the file.
| content_location | The URL to use as the content location in the FDT when sending the file |
| data | A pointer to the memory buffer containing the file contents |
| length | The size of the file contents in the memory buffer in bytes |
Definition at line 100 of file Transmitter.cpp.
| LibFlute::Transmitter::FileDescription::FileDescription | ( | const std::string & | content_location | ) |
Make a file description without contents.
Create a file description with just a URL location and no body content. The content can be added later using the set_content() methods.
| content_location | The URL to use as the content location in the FDT when sending the file |
Definition at line 112 of file Transmitter.cpp.
| LibFlute::Transmitter::FileDescription::FileDescription | ( | const FileDescription & | other | ) |
Copy constructor.
This will make a copy of the file description.
| other | The other file description to copy |
Definition at line 124 of file Transmitter.cpp.
| LibFlute::Transmitter::FileDescription::FileDescription | ( | Transmitter::FileDescription && | other | ) |
Move constructor.
This will move the resources of the other file description into a new file description.
| other | The other file description to move |
Definition at line 149 of file Transmitter.cpp.
|
virtual |
Destructor.
Free all resources associated with this file description.
Definition at line 163 of file Transmitter.cpp.
| const char * LibFlute::Transmitter::FileDescription::data | ( | ) |
Get the data to be transmitted.
This will apply the compression standard currently set to the contents and provide a transfer buffer.
Definition at line 229 of file Transmitter.cpp.
| size_t LibFlute::Transmitter::FileDescription::data_length | ( | ) |
Get the length in bytes of the data to be transmitted.
This will apply the compression standard currently set to the contents and provide the resulting transfer buffer length.
Definition at line 234 of file Transmitter.cpp.
|
inline |
Get the FDT file entry.
Definition at line 193 of file Transmitter.h.
| const std::string & LibFlute::Transmitter::FileDescription::get_etag | ( | ) | const |
Get the current ETag value.
Definition at line 381 of file Transmitter.cpp.
| Transmitter::FileDescription::date_time_type LibFlute::Transmitter::FileDescription::get_expiry_time | ( | ) | const |
Get the currently set expiry time.
Definition at line 369 of file Transmitter.cpp.
|
inline |
Has a Transmitter associated a TSI with this file?
true if the TSI has been set Definition at line 169 of file Transmitter.h.
|
protected |
Merge the FecOti values.
Takes any values that are unset in _file_entry.fec_oti from fec_oti.
| fec_oti | The FecOti to merge values from. |
Definition at line 386 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::operator= | ( | const FileDescription & | other | ) |
Copy operator.
This will make a copy of the other file description into this one.
| other | The other file description to copy |
Definition at line 168 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::operator= | ( | Transmitter::FileDescription && | other | ) |
Move operator.
This will move the resources of the other file description into this one.
| other | The other file description to move into this |
Definition at line 196 of file Transmitter.cpp.
| bool LibFlute::Transmitter::FileDescription::operator== | ( | const FileDescription & | other | ) | const |
Equality operator.
Check if two file descriptions are equivalent
Definition at line 213 of file Transmitter.cpp.
|
inlineprotected |
Get the TOI before reset.
Definition at line 342 of file Transmitter.h.
|
inlineprotected |
Reset the previous TOI value.
Definition at line 349 of file Transmitter.h.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_compression | ( | CompressionAlgorithm | compression | ) |
Set the compression algorithm.
This sets the compression algorithm that will be used to compress the file contents before sending. This will reset the TOI if the compression algorithm is changed.
| compression | The compression algorithm to set |
Definition at line 250 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_content | ( | const char * | data, |
| size_t | data_length | ||
| ) |
Change the file contents using a memory buffer.
This will alter the contents associated with this file description and replace them with a reference to the memory buffer. It is up to the application to ensure that the data is retained in memory until it has finished with this file description and the Transmitter has finished sending the file. This will reset the TOI if the contents have changed.
| data | The in memory buffer to use for the new file contents |
| data_length | The length of the contents in the memory buffer |
Definition at line 294 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_content | ( | const std::string & | filename | ) |
Change the file contents using a local file.
This will alter the contents associated with this file description and replace them with the contents of the local file. This will reset the TOI if the contents have changed.
| filename | The local file path for the new contents |
Definition at line 281 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_content | ( | const std::vector< char > & | data | ) |
Change the file contents using a vector.
This will alter the contents associated with this file description and replace them with a reference to the contents of the vector. It is up to the application to ensure that the data is retained in memory until it has finished with this file description and the Transmitter has finished sending the file. This will reset the TOI if the contents have changed.
| data | The vector to use for the new file contents |
Definition at line 331 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_content | ( | const std::vector< unsigned char > & | data | ) |
Definition at line 336 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_content_location | ( | const std::string & | location | ) |
Set Content-Location.
| location | The location URL or filename. |
Definition at line 274 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_content_type | ( | const std::string & | content_type | ) |
Change the file content type.
This will set the Content-Type that is associated with this file.
| content_type | The content type to set. |
Definition at line 341 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_etag | ( | const std::string & | etag | ) |
Set the ETag value for the file.
Set to the empty string to remove the ETag.
| etag | The ETag to set |
Definition at line 375 of file Transmitter.cpp.
| Transmitter::FileDescription & LibFlute::Transmitter::FileDescription::set_expiry_time | ( | const date_time_type & | expiry_time | ) |
Change the file expiry time.
| expiry_time | The expiry time of the file in the FLUTE session. |
Definition at line 359 of file Transmitter.cpp.
|
inline |
Get the TOI associated with this file description.
This is meaningless if has_tsi() is false.
Definition at line 186 of file Transmitter.h.
|
inlineprotected |
Set the TOI (used by the Transmitter class)
| val | The new TOI value |
Definition at line 335 of file Transmitter.h.
|
inline |
Get the associated TSI value.
Definition at line 177 of file Transmitter.h.
|
inlineprotected |
Set the TSI (used by the Transmitter class)
| val | The new TSI value |
Definition at line 328 of file Transmitter.h.
|
friend |
Definition at line 321 of file Transmitter.h.