TINC
Toolkit for Interactive Computation
|
A DiskBuffer that reads and decodes image files. More...
#include <DiskBufferImage.hpp>
Public Member Functions | |
DiskBufferImage (std::string id, std::string fileName="", std::string relPath="", std::string rootPath="", uint16_t size=2) | |
bool | writePixels (unsigned char *newData, int width, int height, int numComponents=3, std::string filename="") |
Write a disk buffer from raw pixel data. More... | |
bool | loadData (std::string filename="", bool notify=true) override |
updateData More... | |
std::string | setData (al::Image &newData) |
Write data from memory to disk buffer and then load it. More... | |
std::shared_ptr< DataType > | get (bool markAsUsed=true) |
Get current buffer for reading. More... | |
std::shared_ptr< DataType > | get (bool *isNew) |
Get current buffer for reading checking if data is new. More... | |
std::shared_ptr< DataType > | getWritable () |
Get a pointer to a writable buffer. More... | |
void | doneWriting (std::shared_ptr< DataType > buffer) |
Mark a buffer as ready to read. More... | |
bool | newDataAvailable () |
Check if there are buffers that have been written but not read. More... | |
std::string | getCurrentFileName () |
getCurrentFileName More... | |
std::string | getBaseFileName () |
void | setBaseFileName (std::string name) |
void | setRelativePath (std::string path) |
std::string | getRelativePath () |
void | setRootPath (std::string path) |
std::string | getRootPath () |
std::string | getFullPath () |
void | cleanupRoundRobinFiles () |
void | enableRoundRobin (int cacheSize=0, bool clearLocks=true) |
void | useFileLock (bool use=true, bool clearLocks=true) |
std::string | getFilenameForWriting () |
void | registerUpdateCallback (std::function< void(bool)> cb) |
register a function to be called when this object generates new buffer data More... | |
void | registerNotifyCallback (std::function< void(bool)> cb) |
register a function to be called when this object generates new buffer data More... | |
std::string | getId () |
get this object's id More... | |
void | setId (std::string id) |
set this object's id More... | |
std::string | getDocumentation () const |
void | setDocumentation (const std::string &documentation) |
Public Attributes | |
const int | mSize |
std::function< void(al::Socket *src)> | modified = [](al::Socket * ) {} |
Protected Member Functions | |
bool | parseFile (std::string fileName, std::shared_ptr< al::Image > newData) override |
bool | encodeData (std::string fileName, al::Image &newData) override |
std::string | makeNextFileName () |
std::string | makeFileName (uint64_t index) |
Protected Attributes | |
std::vector< std::shared_ptr< DataType > > | mData |
std::mutex | mDataLock |
bool | mNewData {false} |
uint16_t | mReadBuffer {0} |
uint16_t | mWriteBuffer {1} |
std::string | m_fileName |
DistributedPath | m_distPath |
std::shared_ptr< al::ParameterString > | m_trigger |
std::mutex | m_writeLock |
uint64_t | m_roundRobinCounter {0} |
uint64_t | m_roundRobinSize {0} |
std::vector< std::function< void(bool)> > | mUpdateCallbacks |
std::vector< std::function< void(bool)> > | mNotifyCallbacks |
std::string | mId |
std::string | mDocumentation |
A DiskBuffer that reads and decodes image files.
Definition at line 53 of file DiskBufferImage.hpp.
|
inline |
Definition at line 55 of file DiskBufferImage.hpp.
|
inlineinherited |
Definition at line 87 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Mark a buffer as ready to read.
buffer | The buffer previously received from getWritable() |
The buffer provided must come from getWritable() otherwise behavior is undefined.
Definition at line 114 of file BufferManager.hpp.
|
inlineinherited |
Definition at line 88 of file DiskBufferAbstract.hpp.
|
inlineoverrideprotectedvirtual |
Implements tinc::DiskBuffer< al::Image >.
Definition at line 119 of file DiskBufferImage.hpp.
|
inlineinherited |
Get current buffer for reading checking if data is new.
isNew | this is set to true if data returned is "new", false otherwise |
Definition at line 76 of file BufferManager.hpp.
|
inlineinherited |
Get current buffer for reading.
markAsUsed | if false, the returned buffer keeps its "new" status |
Definition at line 63 of file BufferManager.hpp.
|
inlineinherited |
Definition at line 75 of file DiskBufferAbstract.hpp.
|
inlineinherited |
getCurrentFileName
This function is not thread safe. Needs to be called synchronously to any process functions
Definition at line 60 of file DiskBufferAbstract.hpp.
|
inherited |
|
inlineinherited |
Definition at line 96 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Definition at line 84 of file DiskBufferAbstract.hpp.
|
inherited |
get this object's id
|
inlineinherited |
Definition at line 79 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Definition at line 82 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Get a pointer to a writable buffer.
When done writing this buffer, call doneWriting()
Definition at line 92 of file BufferManager.hpp.
|
overridevirtualinherited |
updateData
filename |
Whenever overriding this function, you must make sure you call the update callbacks in mUpdateCallbacks
Implements tinc::DiskBufferAbstract.
Definition at line 67 of file DiskBuffer.hpp.
|
inlineprotectedinherited |
Definition at line 156 of file DiskBufferAbstract.hpp.
|
inlineprotectedinherited |
Definition at line 144 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Check if there are buffers that have been written but not read.
Definition at line 124 of file BufferManager.hpp.
|
inlineoverrideprotectedvirtual |
Implements tinc::DiskBuffer< al::Image >.
Definition at line 91 of file DiskBufferImage.hpp.
|
inlineinherited |
register a function to be called when this object generates new buffer data
cb | If this object is registered with a TINC server or client, this function will only be called if the data creation is local to the node. |
When defining loadData(), these callbacks should only be called accodring to the notify argument.
Definition at line 125 of file DiskBufferAbstract.hpp.
|
inlineinherited |
register a function to be called when this object generates new buffer data
cb | If this object is registered with a TINC server or client, this function will only be called if the data creation is local to the node. |
Definition at line 110 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Definition at line 76 of file DiskBufferAbstract.hpp.
|
inherited |
Write data from memory to disk buffer and then load it.
newData |
Definition at line 74 of file DiskBuffer.hpp.
|
inherited |
|
inherited |
set this object's id
|
inlineinherited |
Definition at line 78 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Definition at line 81 of file DiskBufferAbstract.hpp.
|
inlineinherited |
Definition at line 92 of file DiskBufferAbstract.hpp.
|
inline |
Write a disk buffer from raw pixel data.
Definition at line 74 of file DiskBufferImage.hpp.
|
protectedinherited |
Definition at line 132 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 130 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 138 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 139 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 134 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 136 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 130 of file BufferManager.hpp.
|
protectedinherited |
Definition at line 132 of file BufferManager.hpp.
|
protectedinherited |
Definition at line 69 of file IdObject.hpp.
|
protectedinherited |
Definition at line 68 of file IdObject.hpp.
|
protectedinherited |
Definition at line 133 of file BufferManager.hpp.
|
protectedinherited |
Definition at line 142 of file DiskBufferAbstract.hpp.
|
inherited |
Definition at line 65 of file IdObject.hpp.
|
protectedinherited |
Definition at line 134 of file BufferManager.hpp.
|
inherited |
Definition at line 50 of file BufferManager.hpp.
|
protectedinherited |
Definition at line 141 of file DiskBufferAbstract.hpp.
|
protectedinherited |
Definition at line 135 of file BufferManager.hpp.