Equalizer
1.4.1
|
A configuration is a visualization session driven by an application. More...
#include <config.h>
Public Member Functions | |
Config (ServerPtr parent) | |
Construct a new config. | |
virtual | ~Config () |
Destruct a config. | |
void | setupMessagePump (Pipe *pipe) |
void | setupServerConnections (const char *connectionData) |
Data Access | |
ClientPtr | getClient () |
ConstClientPtr | getClient () const |
co::NodePtr | getApplicationNode () |
co::CommandQueue * | getMainThreadQueue () |
co::CommandQueue * | getCommandThreadQueue () |
uint32_t | getCurrentFrame () const |
uint32_t | getFinishedFrame () const |
void | getStatistics (std::vector< FrameStatistics > &stats) |
bool | isRunning () const |
void | stopRunning () |
Stop the config. | |
int64_t | getTime () const |
Get the current time in milliseconds. | |
MessagePump * | getMessagePump () |
const Channel * | findChannel (const std::string &name) const |
Operations | |
virtual bool | init (const uint128_t &initID) |
Initialize this configuration. | |
virtual bool | exit () |
Exit this configuration. | |
bool | update () |
Update the configuration. | |
virtual void | setLatency (const uint32_t latency) |
Object registry. | |
virtual bool | registerObject (co::Object *object) |
Register a distributed object. | |
virtual void | deregisterObject (co::Object *object) |
Deregister a distributed object. | |
virtual bool | mapObject (co::Object *object, const UUID &id, const uint128_t &version=co::VERSION_OLDEST) |
Map a distributed object. | |
virtual uint32_t | mapObjectNB (co::Object *object, const UUID &id, const uint128_t &version=co::VERSION_OLDEST) |
Start mapping a distributed object. | |
virtual uint32_t | mapObjectNB (co::Object *object, const UUID &id, const uint128_t &version, co::NodePtr master) |
Start mapping a distributed object from a known master. | |
virtual bool | mapObjectSync (const uint32_t requestID) |
Finalize the mapping of a distributed object. | |
virtual void | unmapObject (co::Object *object) |
Unmap a mapped object. | |
void | releaseObject (co::Object *object) |
Convenience method to deregister or unmap an object. | |
Frame Control | |
virtual uint32_t | startFrame (const uint128_t &frameID) |
Request a new frame of rendering. | |
virtual uint32_t | finishFrame () |
Finish the rendering of a frame. | |
virtual uint32_t | finishAllFrames () |
Finish rendering all pending frames. | |
void | releaseFrameLocal (const uint32_t frameNumber) |
Release the local synchronization of the config for a frame. | |
void | stopFrames () |
Asynchronously signal all channels to interrupt their rendering. | |
Event handling | |
void | sendEvent (ConfigEvent &event) |
Send an event to the application node. | |
const ConfigEvent * | nextEvent () |
Get the next event. | |
const ConfigEvent * | tryNextEvent () |
Try to get the next event. | |
bool | checkEvent () const |
virtual void | handleEvents () |
Handle all config events. | |
virtual bool | handleEvent (const ConfigEvent *event) |
Handle one config event. | |
Public Types | |
typedef fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor > | Super |
base class | |
Protected Member Functions | |
virtual void | attach (const UUID &id, const uint32_t instanceID) |
virtual void | notifyAttached () |
Notify that this object has been registered or mapped. | |
virtual void | notifyDetach () |
Notify that this object will be deregistered or unmapped. | |
virtual void | changeLatency (const uint32_t latency) |
virtual bool | mapViewObjects () const |
Friends | |
class | Node |
A configuration is a visualization session driven by an application.
The application Client can choose a configuration from a Server. The Config will be instantiated though the NodeFactory. The Config groups all processes of the application in a single session.
A configuration has a number of nodes, which represent the processes involved in it. While the Server drives all nodes, a Config instance in a given process only has its Node instantiated, that is, any given Config has at most one Node.
The Config in the application process has access to all Canvas, Segment, Layout, View and Observer instances. Only the active Layout of the each Canvas, the Frustum of each View and the Observer parameters are writable. Views can be sub-classed to attach application-specific data.
The render client processes have only access to the current View for each of their channels.
Definition at line 54 of file include/eq/client/config.h.
eq::Config::Config | ( | ServerPtr | parent | ) |
Construct a new config.
Reimplemented in eqPly::Config, osgScaleViewer::Config, eqNbody::Config, eVolve::Config, and eqPixelBench::Config.
virtual eq::Config::~Config | ( | ) | [virtual] |
Destruct a config.
Reimplemented from eq::fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor >.
Reimplemented in eqPly::Config, eqNbody::Config, eVolve::Config, and eqPixelBench::Config.
bool eq::Config::checkEvent | ( | ) | const |
virtual void eq::Config::deregisterObject | ( | co::Object * | object | ) | [virtual] |
Deregister a distributed object.
This method ensures that the data for buffered object is kept for latency frames to allow mapping on slave nodes.
object | the object instance. |
Implements co::ObjectHandler.
Referenced by osgScaleViewer::Config::exit().
virtual bool eq::Config::exit | ( | ) | [virtual] |
Exit this configuration.
This method is to be called only on the application node on an initialized configuration.
Exiting a configuration calls configExit on all active render entities, releases the entities using the NodeFactory and stops the render clients.
A configuration which was not exited properly may not be re-initialized.
Reimplemented in eqPly::Config, osgScaleViewer::Config, eqNbody::Config, and eVolve::Config.
virtual uint32_t eq::Config::finishAllFrames | ( | ) | [virtual] |
Finish rendering all pending frames.
This method is to be called only on the application node on an initialized configuration.
Referenced by eVolve::EVolve::run(), osgScaleViewer::OSGScaleViewer::run(), and eqPly::EqPly::run().
virtual uint32_t eq::Config::finishFrame | ( | ) | [virtual] |
Finish the rendering of a frame.
This method is to be called only on the application node on an initialized configuration.
This method synchronizes the local and global rendering. The global rendering is always synchronized to finish the frame (current - latency). The local rendering is synchronized according to the current thread model (cf. Node::IATTR_THREAD_MODEL)
Referenced by eVolve::EVolve::run(), osgScaleViewer::OSGScaleViewer::run(), and eqPly::EqPly::run().
Referenced by eqPly::Config::getModel(), and eqPly::Config::loadData().
Referenced by eqPly::Config::getModel().
ConstClientPtr eq::Config::getClient | ( | ) | const |
uint32_t eq::Config::getCurrentFrame | ( | ) | const |
uint32_t eq::Config::getFinishedFrame | ( | ) | const |
Referenced by eqPly::EqPly::run().
int64_t eq::Config::getTime | ( | ) | const |
Get the current time in milliseconds.
The clock in all processes of the config is synchronized to the Server clock. The precision of this synchronization is typically about 1 ms. The clock of the last instantiated config is used as the lunchbox::Log clock.
virtual bool eq::Config::handleEvent | ( | const ConfigEvent * | event | ) | [virtual] |
Handle one config event.
event | the event. |
Reimplemented in eqPly::Config, osgScaleViewer::Config, eVolve::Config, eqNbody::Config, and eqPixelBench::Config.
virtual void eq::Config::handleEvents | ( | ) | [virtual] |
Handle all config events.
To be called only on the application node.
Called automatically at the end of each frame to handle pending config events. The default implementation calls handleEvent() on all pending events, without blocking.
Referenced by eqPly::EqPly::run().
virtual bool eq::Config::init | ( | const uint128_t & | initID | ) | [virtual] |
Initialize this configuration.
This method is to be called only on the application node on an uninitialized configuration.
Initializing a configuration starts and connects all render clients, instantiates all active render entities (Node, Pipe, Window, Channel) using the NodeFactory of each process, and calls the configInit task methods on each of these entities, passing the given identifier.
The identifier is typically the identifier of a static Object containing initialization data.
The initialization fails if at least one of the configInit task methods fails. The application can use setErrorMessage on the render client to pass an error string to the application process, which it can query it using getError().
initID | an identifier to be passed to all init methods. |
Referenced by eVolve::Config::init(), and eqPly::Config::init().
bool eq::Config::isRunning | ( | ) | const |
Referenced by eVolve::EVolve::run(), osgScaleViewer::OSGScaleViewer::run(), and eqPly::EqPly::run().
virtual bool eq::Config::mapObject | ( | co::Object * | object, |
const UUID & | id, | ||
const uint128_t & | version = co::VERSION_OLDEST |
||
) | [virtual] |
Map a distributed object.
Provided for symmetry with deregisterObject. Forwards mapping to local client node.
Referenced by eqNbody::Pipe::configInit(), eVolve::Pipe::configInit(), eqPly::Pipe::configInit(), osgScaleViewer::Pipe::configInit(), and eVolve::Config::mapData().
virtual uint32_t eq::Config::mapObjectNB | ( | co::Object * | object, |
const UUID & | id, | ||
const uint128_t & | version = co::VERSION_OLDEST |
||
) | [virtual] |
Start mapping a distributed object.
Referenced by eqPly::Config::loadData().
virtual uint32_t eq::Config::mapObjectNB | ( | co::Object * | object, |
const UUID & | id, | ||
const uint128_t & | version, | ||
co::NodePtr | master | ||
) | [virtual] |
virtual bool eq::Config::mapObjectSync | ( | const uint32_t | requestID | ) | [virtual] |
Finalize the mapping of a distributed object.
Implements co::ObjectHandler.
Referenced by eqPly::Config::loadData().
const ConfigEvent* eq::Config::nextEvent | ( | ) |
Get the next event.
To be called only on the application node.
The returned event is valid until the next call to this method. This method may block.
Referenced by eqPly::EqPly::run().
virtual void eq::Config::notifyAttached | ( | ) | [protected, virtual] |
Notify that this object has been registered or mapped.
The method is called from the thread initiating the registration or mapping, after the operation has been completed successfully.
Reimplemented from co::Serializable.
virtual void eq::Config::notifyDetach | ( | ) | [protected, virtual] |
Notify that this object will be deregistered or unmapped.
The method is called from the thread initiating the deregistration or unmapping, before the operation is executed.
Reimplemented from eq::fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor >.
virtual bool eq::Config::registerObject | ( | co::Object * | object | ) | [virtual] |
Register a distributed object.
Provided for symmetry with deregisterObject. Forwards registration to local client node.
Implements co::ObjectHandler.
Referenced by eVolve::Config::init(), osgScaleViewer::Config::init(), and eqPly::Config::init().
void eq::Config::releaseFrameLocal | ( | const uint32_t | frameNumber | ) |
Release the local synchronization of the config for a frame.
Used by the local Node to release the process-local frame synchronization. An application typically does not call this method directly, it is called from Node::releaseFrameLocal(), which in turn is called from the appropriate task method depending on the thread model.
frameNumber | the frame to release. |
void eq::Config::releaseObject | ( | co::Object * | object | ) |
Convenience method to deregister or unmap an object.
void eq::Config::sendEvent | ( | ConfigEvent & | event | ) |
Send an event to the application node.
event | the event. |
Referenced by eqPixelBench::Channel::frameStart(), and eqPly::Channel::frameViewFinish().
virtual void eq::Config::setLatency | ( | const uint32_t | latency | ) | [virtual] |
Reimplemented from eq::fabric::Config< Server, Config, Observer, Layout, Canvas, Node, ConfigVisitor >.
virtual uint32_t eq::Config::startFrame | ( | const uint128_t & | frameID | ) | [virtual] |
Request a new frame of rendering.
This method is to be called only on the application node on an initialized configuration. It implicitely calls update().
The server will sync to the new data, and generate all render tasks, which are queued on the render clients for execution.
Each call to startFrame() has to be completed by a finishFrame() or finishAllFrames() before the next call to startFrame().
frameID | a per-frame identifier passed to all rendering methods. |
Reimplemented in eqPixelBench::Config.
void eq::Config::stopFrames | ( | ) |
Asynchronously signal all channels to interrupt their rendering.
This method may be called from any thread in the application process. It causes Channel::notifyStopFrame() to be called immediately on all active channels.
void eq::Config::stopRunning | ( | ) |
Stop the config.
const ConfigEvent* eq::Config::tryNextEvent | ( | ) |
Try to get the next event.
To be called only on the application node.
The returned event is valid until the next call to this method. This method does not block.
virtual void eq::Config::unmapObject | ( | co::Object * | object | ) | [virtual] |
Unmap a mapped object.
Provided for symmetry with deregisterObject. Forwards unmapping to local client node.
Implements co::ObjectHandler.
Referenced by eqNbody::Pipe::configExit(), eVolve::Pipe::configExit(), eqPly::Pipe::configExit(), osgScaleViewer::Pipe::configExit(), eqPly::Config::loadData(), and eVolve::Config::mapData().
bool eq::Config::update | ( | ) |
Update the configuration.
This method is to be called only on the application node on an initialized configuration. Dirty objects on the config are committed, i.e., the View, Canvas and Observer, and any changes on the configuration are effected. Changes may be caused by the eq::admin API or by the application, e.g., through a layout change on a Canvas. Any change causes an implicit finish of all outstanding frames.
This function always returns false when a resource failed to initialize or exit. When robustness is not activated, the config is exited by the update upon failure. When robustness is activated, the config keeps running and may be used with reduced functionality.