VideoTools
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Gv::ImageOutput Class Reference

A class for emiting images etc to a fat pipe that feeds a spawned viewer process, and/or to a publication channel, and/or to a filesystem image repository. More...

#include <gvimageoutput.h>

Public Member Functions

 ImageOutput ()
 Constructor.
 
 ImageOutput (GNet::EventExceptionHandler &)
 Constructor taking a callback interface for handling failed viewer pings. More...
 
 ~ImageOutput ()
 Destructor.
 
void startViewer (const std::string &title=std::string(), unsigned int scale=1U, const std::string &output_channel=std::string())
 Starts the viewer. More...
 
void startPublisher (const std::string &channel)
 Starts the publisher channel.
 
void startPublisher (const std::string &channel, const G::Item &publisher_info)
 Starts the publisher channel with additional infomation describing the publisher. More...
 
void startPublisher (G::Publisher *)
 Starts the publisher channel by taking ownership of a new-ed publisher object.
 
void saveTo (const std::string &base_dir, const std::string &name, bool fast, const Gv::Timezone &tz, bool test_mode=false)
 Saves images to the filesystem inside a deeply-nested directory hierarchy with the given base directory. More...
 
bool viewing () const
 Returns true if startViewer() has been called.
 
bool pingViewer ()
 Returns true if the viewer seems to be running. More...
 
void pingViewerCheck ()
 Checks that the viewer is running if it should be (see pingViewer()), and throws an exeception if not. More...
 
G::Path send (const char *data, size_t size, Gr::ImageType type, G::EpochTime=G::EpochTime(0))
 Emits an image. Returns the path if saveTo()d the filesystem.
 
G::Path send (const Gr::ImageBuffer &data, Gr::ImageType type, G::EpochTime=G::EpochTime(0))
 Emits an image. Returns the path if saveTo()d the filesystem.
 
void sendText (const char *data, size_t size, const std::string &type)
 Emits a non-image message. Non-image messages are not saveTo()d the filesystem.
 
const std::string & dir () const
 Returns the saveTo() path.
 
std::string path (G::EpochTime, Gr::ImageType type, bool fast) const
 Returns the filesystem path corresponding to the given timestamp. More...
 
bool fast () const
 Returns the saveTo() fast flag.
 

Static Public Member Functions

static void path (std::string &out, const std::string &base_dir, const std::string &name, G::EpochTime, Gr::ImageType type, bool fast, const Gv::Timezone &tz, bool test_mode)
 Returns by reference the filesystem path corresponding to the given base directory and timestamp. More...
 

Detailed Description

A class for emiting images etc to a fat pipe that feeds a spawned viewer process, and/or to a publication channel, and/or to a filesystem image repository.

Definition at line 44 of file gvimageoutput.h.

Constructor & Destructor Documentation

Gv::ImageOutput::ImageOutput ( GNet::EventExceptionHandler handler)
explicit

Constructor taking a callback interface for handling failed viewer pings.

Definition at line 75 of file gvimageoutput.cpp.

Member Function Documentation

void Gv::ImageOutput::path ( std::string &  out,
const std::string &  base_dir,
const std::string &  name,
G::EpochTime  time,
Gr::ImageType  type,
bool  fast,
const Gv::Timezone tz,
bool  test_mode 
)
static

Returns by reference the filesystem path corresponding to the given base directory and timestamp.

Definition at line 284 of file gvimageoutput.cpp.

std::string Gv::ImageOutput::path ( G::EpochTime  time,
Gr::ImageType  type,
bool  fast 
) const

Returns the filesystem path corresponding to the given timestamp.

Definition at line 330 of file gvimageoutput.cpp.

bool Gv::ImageOutput::pingViewer ( )

Returns true if the viewer seems to be running.

The transition from true to false can be used to terminate the caller's event loop.

Definition at line 163 of file gvimageoutput.cpp.

void Gv::ImageOutput::pingViewerCheck ( )

Checks that the viewer is running if it should be (see pingViewer()), and throws an exeception if not.

Definition at line 175 of file gvimageoutput.cpp.

void Gv::ImageOutput::saveTo ( const std::string &  base_dir,
const std::string &  name,
bool  fast,
const Gv::Timezone tz,
bool  test_mode = false 
)

Saves images to the filesystem inside a deeply-nested directory hierarchy with the given base directory.

Every filename is prefixed with the given name. Directory paths are derived from a timestamp; if the 'fast' flag is true then sub-second parts of the timestamp are used.

Definition at line 183 of file gvimageoutput.cpp.

void Gv::ImageOutput::startPublisher ( const std::string &  channel,
const G::Item publisher_info 
)

Starts the publisher channel with additional infomation describing the publisher.

Definition at line 93 of file gvimageoutput.cpp.

void Gv::ImageOutput::startViewer ( const std::string &  title = std::string(),
unsigned int  scale = 1U,
const std::string &  output_channel = std::string() 
)

Starts the viewer.

Does periodic pings of the viewer's fat pipe if the relevant constructor overload was used.

Definition at line 107 of file gvimageoutput.cpp.


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