OpenVideo Documentation

   Main Page       Modules       Class Hierarchy       Alphabetical List       Compound List       File List       Compound Members       Related Pages   

openvideo::Manager Class Reference
[Core Classes]

The ‘Manager’ class represents OpenVideo's main object which constructs, holds and updates OpenVideo’s runtime data structure. More...

#include <Manager.h>

List of all members.

Public Member Functions

 ~Manager ()
void addNodeFactory (openvideo::NodeFactory *aFactory)
void parseConfiguration (TiXmlElement *element)
bool parseConfiguration (const std::string &filename)
void buildSubGraph (TiXmlElement *parentElement, openvideo::Node *parentNode)
void initTraversal ()
void run ()
openvideo::NodeaddNode (TiXmlElement *element)
openvideo::NodegetNode (std::string nodeName)
void setGLContext (HGLRC _glContext, HDC _dc)
void setGLContext (GLXDrawable _drawable, GLXContext _glContext, Display *_dsp)
void deleteGLContext ()
void stop ()
void setTravFunction (void(*travFunction)(void *), void *data)
void setInitTravFunction (void(*initTravFunction)(void *), void *data)
bool isStarted ()
LoggergetLogger ()

Static Public Member Functions

static ManagergetInstance ()
static void update (void *)

Public Attributes

bool glContextChanged

Static Public Attributes

static bool hasGLContext = false

Protected Member Functions

 Manager ()
void initNodeFactories ()
void pause ()
void doIdleTasks ()
void resume ()

Static Protected Member Functions

static void topologicalSortedTraversal (void *nodeList)
static void initTopologicalSortedTraversal (void *nodeList)
static void * startUserInterface (void *)

Protected Attributes

openvideo::Schedulerscheduler
bool isOVStarted
std::vector< openvideo::Node * > nodes
std::vector< openvideo::Node * > defNodes
std::vector< openvideo::NodeFactory * > factories
Loggerlogger
bool isRunning
bool hasParsed
bool updating
void * controlThreadHandle
ACE_Thread_Mutex * updateLock
ACE_Condition_Thread_Mutex * updateLockCondition
bool idleSetGLContext
bool idleDeleteGLContext
GLXDrawable dc
Display * dsp
GLXContext glContext
HGLRC glContext
HDC dc

Static Protected Attributes

static Managerinstance = NULL
static void(* initTraversalFunc )(void *data) = NULL
static void(* traversalFunc )(void *data) = NULL
static void * traversalData = NULL
static void * initTraversalData = NULL
static bool travBlock = false
static bool isUserInterfaceRunning = false


Detailed Description

The ‘Manager’ class represents OpenVideo's main object which constructs, holds and updates OpenVideo’s runtime data structure.

OpenVideo defines its data structure as a directed acyclic graph which is defined in an xml based configuration file. To construct such an OpenVideo graph the ‘Manager’ provides the necessary functionality to parse a given OpenVideo configuration as well as to construct the graph out of the information gained in the parsing step. To construct a single node the ‘Manager’ uses the related factory this specific node implements. Therefore, a list of factories of all known OpenVideo nodes is stored in an instance of a ‘Manager’.
The basic lifecycle of a Manager object looks like this:

//1)
//1a) initialize the list of node factories
//1b) set the callback function to update the graph
//1c) set the function which initializes the graph 
//
Manager manager;

//2)
//2a) parse the give configuration 
//2b) construct on OpenVideo graph
manager.parseConfiguration(“aConfiguration”);

//3)
//3a)	initialize the graph (by calling the function defined in (1b) –> this 
//	perhaps rearranges the node list the manager holds) 
//	the list 
//3b)	initialize a timer to permanently update the graph data 
//3c)	start the timer which constantly calls the traversal function which was
//   	defined in 1b)
manager.run()

The following drawing shows an example of an OpenVideo graph.

ovgraph.gif

Internal dependencies -> * Timer -> to create the timer to trigger the traversal
* NodeFactory + Various Node Factories -> to create the nodes
* Node -> basic elements in the graph

External dependencies -> * TinyXML – to parse OpenVideo’s xml based configuration

Definition at line 104 of file Manager.h.


Constructor & Destructor Documentation

Manager::~Manager  ) 
 

destructor

Definition at line 132 of file Manager.cxx.

References logger, nodes, and scheduler.

Manager::Manager  )  [protected]
 

constructor

Definition at line 108 of file Manager.cxx.

References dsp, glContext, glContextChanged, hasParsed, idleDeleteGLContext, idleSetGLContext, initNodeFactories(), initTopologicalSortedTraversal(), isRunning, logger, nodes, scheduler, setInitTravFunction(), setTravFunction(), topologicalSortedTraversal(), updateLock, updateLockCondition, and updating.

Referenced by getInstance().


Member Function Documentation

Node * Manager::addNode TiXmlElement *  element  ) 
 

Creates and configures a node by a given (tinyxml)Element.

Before the created node is returned, the node will be added to the managers list of nodes. Notice: The connections between all nodes are set in 'buildSubGraph(void * parentElement, Node* parentNode)'.

Definition at line 300 of file Manager.cxx.

References openvideo::NodeFactory::createNode(), defNodes, factories, openvideo::Node::getDefName(), getNodeTypeId(), openvideo::LoggerBase::logEx(), logger, nodes, and openvideo::Node::setParameter().

Referenced by buildSubGraph(), and parseConfiguration().

void Manager::addNodeFactory openvideo::NodeFactory aFactory  ) 
 

adds a NodeFactory to the list of known factories'

Definition at line 595 of file Manager.cxx.

References factories.

void Manager::buildSubGraph TiXmlElement *  parentElement,
openvideo::Node parentNode
 

Constructs the sub graph for a given (tinyxml)Element.

It adds all child nodes to 'parentNode'

Definition at line 284 of file Manager.cxx.

References openvideo::Node::addInput(), addNode(), and openvideo::Node::addOutput().

Referenced by parseConfiguration().

void Manager::deleteGLContext  ) 
 

Definition at line 253 of file Manager.cxx.

References idleDeleteGLContext, and pause().

void Manager::doIdleTasks  )  [protected]
 

Definition at line 165 of file Manager.cxx.

References dc, dsp, glContext, glContextChanged, hasGLContext, idleDeleteGLContext, idleSetGLContext, openvideo::LoggerBase::logEx(), logger, and resume().

Manager * Manager::getInstance  )  [static]
 

Definition at line 273 of file Manager.cxx.

References Manager().

Referenced by openvideo::DSVLSrcBuffer::getNewFrame(), openvideo::VideoWrapperSrc::init(), openvideo::V4L2Src::init(), openvideo::TestSrc::init(), openvideo::ImageSrc::init(), openvideo::GLUTSink::init(), openvideo::GL_TEXTURE_2D_Sink::init(), openvideo::DSVLSrc::init(), main(), openvideo::GLUTSink::mainDisplayFunc(), TestWinCE::OnInitialize(), openvideo::VideoWrapperSrc::process(), openvideo::V4L2Src::process(), openvideo::TestSrc::process(), openvideo::DSVLSrc::process(), openvideo::V4L2Src::processImage(), openvideo::SchedulerPC::scheduleTimer(), openvideo::V4L2Src::setParameter(), openvideo::V4L2Src::start(), openvideo::GLUTSink::start(), startUserInterface(), and update().

Logger* openvideo::Manager::getLogger  )  [inline]
 

Definition at line 188 of file Manager.h.

Node * Manager::getNode std::string  nodeName  ) 
 

Returns the node with the given 'nodeName'.

NULL is returned if non of those currently exist.

Definition at line 603 of file Manager.cxx.

References nodes.

Referenced by TestWinCE::OnInitialize().

void Manager::initNodeFactories  )  [protected]
 

Initializes all factories.

Adds all known (hard coded) factories to the manager's list of node factories'

Definition at line 619 of file Manager.cxx.

References factories, and SpectecSrcFactory().

Referenced by Manager().

void Manager::initTopologicalSortedTraversal void *  nodeList  )  [static, protected]
 

An implementation of a topological sorted traversal strategy.

This is used as the default traversal strategy OpenVideo implements.

Definition at line 526 of file Manager.cxx.

References openvideo::Node::decCurInDegree(), and nodes.

Referenced by Manager().

void Manager::initTraversal  ) 
 

Definition at line 510 of file Manager.cxx.

References initTraversalData, openvideo::LoggerBase::logEx(), logger, and nodes.

Referenced by main().

bool Manager::isStarted  ) 
 

Definition at line 267 of file Manager.cxx.

References isRunning.

bool Manager::parseConfiguration const std::string &  filename  ) 
 

This method parses an xml configuartion of OpenVideo.

While parsing the file the OpenVideo graph will be created.

Definition at line 375 of file Manager.cxx.

References addNode(), buildSubGraph(), hasParsed, openvideo::LoggerBase::logEx(), logger, and parseConfiguration().

void Manager::parseConfiguration TiXmlElement *  element  ) 
 

Definition at line 368 of file Manager.cxx.

References openvideo::SchedulerBase::parseConfiguration(), and scheduler.

Referenced by main(), TestWinCE::OnInitialize(), and parseConfiguration().

void Manager::pause  )  [protected]
 

Pauses the manger's mainLoop.

Definition at line 216 of file Manager.cxx.

References isRunning, updateLock, and updateLockCondition.

Referenced by deleteGLContext(), and setGLContext().

void Manager::resume  )  [protected]
 

Definition at line 259 of file Manager.cxx.

References isRunning, and updateLock.

Referenced by doIdleTasks().

void Manager::run  ) 
 

Starts the manger's mainLoop.

Before it actually activates the timer -who is resposible for calling the update function- the traversal data is initialized and the graph is 'started' by calling 'initTraversalFunc(...)'.

Definition at line 420 of file Manager.cxx.

References controlThreadHandle, openvideo::SchedulerBase::init(), openvideo::SchedulerBase::run(), scheduler, and startUserInterface().

Referenced by main(), ManagerThreadFunc(), and TestWinCE::OnInitialize().

void Manager::setGLContext GLXDrawable  _drawable,
GLXContext  _glContext,
Display *  _dsp
 

Definition at line 242 of file Manager.cxx.

References dc, dsp, glContext, and pause().

void Manager::setGLContext HGLRC  _glContext,
HDC  _dc
 

Definition at line 230 of file Manager.cxx.

References dc, glContext, idleSetGLContext, and pause().

void Manager::setInitTravFunction void(*)(void *)  initTravFunction,
void *  data
 

Sets the function and data to be called before the actual traversal begins.

Definition at line 413 of file Manager.cxx.

References initTraversalData, and initTraversalFunc.

Referenced by Manager().

void Manager::setTravFunction void(*)(void *)  travFunction,
void *  data
 

Sets the manager's traversal function and data.

"setTravFunction(..)" is called during construction time with Manager::topologicalSortedTraversal as argument to set the default traversal strategy.
Use this function to change OpenVideo's traversal strategy.

Definition at line 406 of file Manager.cxx.

References traversalData, and traversalFunc.

Referenced by Manager().

void * Manager::startUserInterface void *   )  [static, protected]
 

Definition at line 443 of file Manager.cxx.

References getInstance(), and isUserInterfaceRunning.

Referenced by run().

void Manager::stop  ) 
 

Stops the manger's mainLoop.

Definition at line 498 of file Manager.cxx.

References openvideo::LoggerBase::logEx(), logger, nodes, scheduler, and openvideo::SchedulerBase::stop().

void Manager::topologicalSortedTraversal void *  nodeList  )  [static, protected]
 

Implementation of a topological sorted graph traversal.

-- this is the default traversal of OpenVideo.

Definition at line 569 of file Manager.cxx.

References nodes, and travBlock.

Referenced by Manager().

void Manager::update void *   )  [static]
 

Definition at line 146 of file Manager.cxx.

References getInstance(), and traversalData.

Referenced by pollLoop(), openvideo::SchedulerPC::scheduleIdle(), and openvideo::SchedulerPC::scheduleTimer().


Member Data Documentation

void* openvideo::Manager::controlThreadHandle [protected]
 

Definition at line 276 of file Manager.h.

Referenced by run().

HDC openvideo::Manager::dc [protected]
 

Definition at line 307 of file Manager.h.

GLXDrawable openvideo::Manager::dc [protected]
 

Definition at line 300 of file Manager.h.

Referenced by doIdleTasks(), and setGLContext().

std::vector<openvideo::Node *> openvideo::Manager::defNodes [protected]
 

A vector to hold all 'DEF' marked nodes in the xml file.

This list holds references to nodes which are previously marked for later referencing.

Definition at line 220 of file Manager.h.

Referenced by addNode().

Display* openvideo::Manager::dsp [protected]
 

Definition at line 301 of file Manager.h.

Referenced by doIdleTasks(), Manager(), and setGLContext().

std::vector<openvideo::NodeFactory*> openvideo::Manager::factories [protected]
 

A vector which holds objects of all known node factories.

This vector will be searched when a new node is going to be created.

Definition at line 226 of file Manager.h.

Referenced by addNode(), addNodeFactory(), and initNodeFactories().

HGLRC openvideo::Manager::glContext [protected]
 

Definition at line 306 of file Manager.h.

GLXContext openvideo::Manager::glContext [protected]
 

Definition at line 302 of file Manager.h.

Referenced by doIdleTasks(), Manager(), and setGLContext().

bool openvideo::Manager::glContextChanged
 

Definition at line 190 of file Manager.h.

Referenced by doIdleTasks(), and Manager().

bool Manager::hasGLContext = false [static]
 

Definition at line 104 of file Manager.cxx.

Referenced by doIdleTasks(), and openvideo::GL_TEXTURE_2D_Sink::process().

bool openvideo::Manager::hasParsed [protected]
 

Definition at line 272 of file Manager.h.

Referenced by Manager(), and parseConfiguration().

bool openvideo::Manager::idleDeleteGLContext [protected]
 

Definition at line 295 of file Manager.h.

Referenced by deleteGLContext(), doIdleTasks(), and Manager().

bool openvideo::Manager::idleSetGLContext [protected]
 

Definition at line 294 of file Manager.h.

Referenced by doIdleTasks(), Manager(), and setGLContext().

void * Manager::initTraversalData = NULL [static, protected]
 

A pointer to the traversal data Per default, this points to the managers list of nodes.

It's value is overriden by setInitTravFunction(...);

Definition at line 102 of file Manager.cxx.

Referenced by initTraversal(), and setInitTravFunction().

void(* Manager::initTraversalFunc = NULL [static, protected]
 

A pointer to the function which initializes the traversal data.

Definition at line 100 of file Manager.cxx.

Referenced by setInitTravFunction().

Manager * Manager::instance = NULL [static, protected]
 

Definition at line 105 of file Manager.cxx.

bool openvideo::Manager::isOVStarted [protected]
 

Definition at line 207 of file Manager.h.

bool openvideo::Manager::isRunning [protected]
 

Definition at line 270 of file Manager.h.

Referenced by isStarted(), Manager(), pause(), and resume().

bool Manager::isUserInterfaceRunning = false [static, protected]
 

Definition at line 106 of file Manager.cxx.

Referenced by startUserInterface().

Logger* openvideo::Manager::logger [protected]
 

Definition at line 268 of file Manager.h.

Referenced by addNode(), doIdleTasks(), initTraversal(), Manager(), parseConfiguration(), stop(), and ~Manager().

std::vector<openvideo::Node*> openvideo::Manager::nodes [protected]
 

THE GRAPH.

This vector holds all nodes in the current OpenVideo graph in a list.

Definition at line 214 of file Manager.h.

Referenced by addNode(), getNode(), initTopologicalSortedTraversal(), initTraversal(), Manager(), stop(), topologicalSortedTraversal(), and ~Manager().

openvideo::Scheduler* openvideo::Manager::scheduler [protected]
 

Definition at line 200 of file Manager.h.

Referenced by Manager(), parseConfiguration(), run(), stop(), and ~Manager().

bool Manager::travBlock = false [static, protected]
 

A Mutex to block the invocation of a new traversal before the current traversal finishes.

Definition at line 103 of file Manager.cxx.

Referenced by topologicalSortedTraversal().

void * Manager::traversalData = NULL [static, protected]
 

The traversal data.

This void pointer is passed to the traversal function every time it is going to be invoked. Per default, this points to the managers list of nodes. It's value is overriden by setTravFunction(...);

Definition at line 101 of file Manager.cxx.

Referenced by setTravFunction(), and update().

void(* Manager::traversalFunc = NULL [static, protected]
 

A pointer to the traversal function which is called by the run function.

Definition at line 99 of file Manager.cxx.

Referenced by setTravFunction().

ACE_Thread_Mutex* openvideo::Manager::updateLock [protected]
 

Mutex used in updateLockCond .

Definition at line 280 of file Manager.h.

Referenced by Manager(), pause(), and resume().

ACE_Condition_Thread_Mutex* openvideo::Manager::updateLockCondition [protected]
 

A condition variable which waits for an update to updateLock.

Definition at line 285 of file Manager.h.

Referenced by Manager(), and pause().

bool openvideo::Manager::updating [protected]
 

Definition at line 274 of file Manager.h.

Referenced by Manager().


The documentation for this class was generated from the following files:
 This page was generated at Wed May 31 13:04:18 2006 for OpenVideo by Doxygen.
 If you have any comments, please send a message to schmalstieg@icg.tu-graz.ac.at.
www.studierstube.org