All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
SurgSim::Graphics::Manager Class Referenceabstract

Basic graphics manager class which manages graphics components to provide a visualization of the scene to the user. More...

#include <SurgSim/Graphics/Manager.h>

Inheritance diagram for SurgSim::Graphics::Manager:
Inheritance graph
[legend]
Collaboration diagram for SurgSim::Graphics::Manager:
Collaboration graph
[legend]

Public Member Functions

 Manager ()
 Constructor. More...
 
virtual ~Manager ()
 Destructor. More...
 
const std::vector
< std::shared_ptr
< Representation > > & 
getRepresentations () const
 Returns the representations assigned to the manager. More...
 
const std::unordered_map
< std::string, std::shared_ptr
< Group > > & 
getGroups () const
 Returns the groups assigned to the manager. More...
 
const std::vector
< std::shared_ptr< View > > & 
getViews () const
 Returns the views assigned to the manager. More...
 
virtual void dumpDebugInfo () const =0
 Generic unspecified debug handle, there are no requirements on this interface the manager implementation can decide what to do. More...
 
- Public Member Functions inherited from SurgSim::Framework::ComponentManager
 ComponentManager (const std::string &name="Unknown Component Manager")
 
virtual ~ComponentManager ()
 
bool enqueueAddComponent (const std::shared_ptr< Component > &component)
 Queues a component to be added later. More...
 
bool enqueueRemoveComponent (const std::shared_ptr< Component > &component)
 Queues a component to be removed. More...
 
std::shared_ptr< RuntimegetRuntime () const
 
void setRuntime (std::shared_ptr< Runtime > val)
 
- Public Member Functions inherited from SurgSim::Framework::BasicThread
 BasicThread (const std::string &name="Unknown Thread")
 
virtual ~BasicThread () noexcept(false)
 C++11 introduced noexcept. More...
 
void start (std::shared_ptr< Barrier > startupBarrier=nullptr, bool isSynchronous=false)
 C++11 introduced noexcept. More...
 
void stop ()
 Stopping the execution, blocks until the running thread has actually stopped,. More...
 
void setIdle (bool isIdle)
 Set/Unset the thread in an idle state (doUpdate() called or not in the update() method) More...
 
bool isIdle ()
 Query if this thread is in idle state or not. More...
 
bool isInitialized ()
 Query if this object is initialized. More...
 
bool isRunning () const
 Query if this object is running. More...
 
void operator() ()
 This is what boost::thread executes on thread creation. More...
 
boost::thread & getThread ()
 
std::string getName () const
 
void setRate (double val)
 Set the update rate of the thread. More...
 
bool setSynchronous (bool val)
 Sets the thread to synchronized execution in concert with the startup barrier, the startup barrier has to exist for this call to succeed. More...
 
bool isSynchronous ()
 Query if this object is synchronized. More...
 

Protected Member Functions

virtual bool executeAdditions (const std::shared_ptr< SurgSim::Framework::Component > &component)
 Adds a component. More...
 
virtual bool executeRemovals (const std::shared_ptr< SurgSim::Framework::Component > &component)
 Removes a component. More...
 
virtual bool addRepresentation (std::shared_ptr< Representation > representation)
 Adds an representation to the manager. More...
 
virtual bool addView (std::shared_ptr< View > view)
 Adds a view to the manager. More...
 
virtual bool removeRepresentation (std::shared_ptr< Representation > representation)
 Removes an representation from the manager. More...
 
virtual bool removeView (std::shared_ptr< View > view)
 Removes a view from the manager. More...
 
virtual bool doUpdate (double dt)
 Performs an update for a single timestep. More...
 
virtual int getType () const override
 Overrides ComponentManager::getType() More...
 
virtual std::shared_ptr< GroupgetOrCreateGroup (const std::string &name)=0
 Fetch a group with a given name, if the group does not exist, create it. More...
 
virtual void addGroup (std::shared_ptr< Group > group)
 Adds a group to the manager, override for manager specific behavior when adding. More...
 
- Protected Member Functions inherited from SurgSim::Framework::ComponentManager
template<class T >
std::shared_ptr< T > tryAddComponent (std::shared_ptr< SurgSim::Framework::Component > component, std::vector< std::shared_ptr< T >> *container)
 Template version of the addComponent method. More...
 
template<class T >
bool tryRemoveComponent (std::shared_ptr< SurgSim::Framework::Component > component, std::vector< std::shared_ptr< T >> *container)
 Template version of the removeComponent method. More...
 
void processComponents ()
 Processes all the components that are scheduled for addition or removal, this needs to be called inside the doUpdate() function. More...
 
void processBehaviors (const double dt)
 Processes behaviors This needs to be called inside doUpdate() function in each 'sub' manager. More...
 
void copyScheduledComponents (std::vector< std::shared_ptr< Component >> *inflightAdditions, std::vector< std::shared_ptr< Component >> *inflightRemovals)
 Helper, blocks access to the additions and removal queue and copies the components from there to the intermediate inflight queues, after this call, the incoming queues will be empty. More...
 
std::shared_ptr
< SurgSim::Framework::Logger
getLogger () const
 Returns this manager's logger. More...
 
- Protected Member Functions inherited from SurgSim::Framework::BasicThread
bool initialize ()
 Trigger the initialization of this object, this will be called before all other threads doStartup() are called. More...
 
bool startUp ()
 Trigger the startup of this object, this will be called after all other threads doInit() was called the thread will only enter the run loop triggering upated() if all threads doInit() and doStartup() returned true. More...
 
bool waitForBarrier (bool success)
 

Private Member Functions

virtual bool doInitialize ()
 Initializes the manager. More...
 
virtual bool doStartUp ()
 Starts up the manager after all threads have initialized. More...
 

Private Attributes

std::vector< std::shared_ptr
< Representation > > 
m_representations
 Representations assigned to the manager. More...
 
std::unordered_map
< std::string, std::shared_ptr
< Group > > 
m_groups
 Groups assigned to the manager. More...
 
std::vector< std::shared_ptr
< View > > 
m_views
 Views assigned to the manager. More...
 

Additional Inherited Members

- Protected Attributes inherited from SurgSim::Framework::ComponentManager
boost::mutex m_componentMutex
 Blocks protects addition and removal queues. More...
 
std::shared_ptr
< SurgSim::Framework::Logger
m_logger
 Logger for this class. More...
 
std::vector< std::shared_ptr
< SurgSim::Framework::Behavior > > 
m_behaviors
 Collection of behaviors. More...
 
std::vector< std::shared_ptr
< Component > > 
m_componentAdditions
 
std::vector< std::shared_ptr
< Component > > 
m_componentRemovals
 

Detailed Description

Basic graphics manager class which manages graphics components to provide a visualization of the scene to the user.

Graphics::Manager manages Graphics::Representation, Graphics::Group, and Graphics::View components.

Constructor & Destructor Documentation

Manager::Manager ( )

Constructor.

Manager::~Manager ( )
virtual

Destructor.

Member Function Documentation

void SurgSim::Graphics::Manager::addGroup ( std::shared_ptr< Group group)
protectedvirtual

Adds a group to the manager, override for manager specific behavior when adding.

Parameters
groupThe group to be added.
bool Manager::addRepresentation ( std::shared_ptr< Representation representation)
protectedvirtual

Adds an representation to the manager.

This will also add the representation to all of the groups contained in its groupRenferences.

Parameters
representationThe representation to be added.
Returns
True if the representation was not in this manager and has been successfully added, false if it fails.

Reimplemented in SurgSim::Graphics::OsgManager.

bool Manager::addView ( std::shared_ptr< View view)
protectedvirtual

Adds a view to the manager.

Parameters
viewThe view to be added.
Returns
True if the view was not in this manager and has been successfully added, false if it fails.

Reimplemented in SurgSim::Graphics::OsgManager.

bool Manager::doInitialize ( )
privatevirtual

Initializes the manager.

Returns
True if it succeeds, false if it fails

Implements SurgSim::Framework::BasicThread.

Reimplemented in SurgSim::Graphics::OsgManager.

bool Manager::doStartUp ( )
privatevirtual

Starts up the manager after all threads have initialized.

Returns
True if it succeeds, false if it fails

Implements SurgSim::Framework::BasicThread.

Reimplemented in SurgSim::Graphics::OsgManager.

bool Manager::doUpdate ( double  dt)
protectedvirtual

Performs an update for a single timestep.

Parameters
dtThe time in seconds of the preceding timestep.

Reimplemented from SurgSim::Framework::BasicThread.

Reimplemented in SurgSim::Graphics::OsgManager.

virtual void SurgSim::Graphics::Manager::dumpDebugInfo ( ) const
pure virtual

Generic unspecified debug handle, there are no requirements on this interface the manager implementation can decide what to do.

Implemented in SurgSim::Graphics::OsgManager.

bool Manager::executeAdditions ( const std::shared_ptr< SurgSim::Framework::Component > &  component)
protectedvirtual

Adds a component.

Parameters
componentThe component to be added.
Returns
True if it succeeds or the manager is not concerned with the component, false if it fails.

Implements SurgSim::Framework::ComponentManager.

bool Manager::executeRemovals ( const std::shared_ptr< SurgSim::Framework::Component > &  component)
protectedvirtual

Removes a component.

Parameters
componentThe component to be removed.
Returns
True if it succeeds or the manager is not concerned with the component, false if it fails.

Implements SurgSim::Framework::ComponentManager.

const std::unordered_map<std::string, std::shared_ptr<Group> >& SurgSim::Graphics::Manager::getGroups ( ) const
inline

Returns the groups assigned to the manager.

virtual std::shared_ptr<Group> SurgSim::Graphics::Manager::getOrCreateGroup ( const std::string &  name)
protectedpure virtual

Fetch a group with a given name, if the group does not exist, create it.

Parameters
nameName of the group to be fetched.
Returns
group with the given name.

Implemented in SurgSim::Graphics::OsgManager.

const std::vector<std::shared_ptr<Representation> >& SurgSim::Graphics::Manager::getRepresentations ( ) const
inline

Returns the representations assigned to the manager.

int Manager::getType ( ) const
overrideprotectedvirtual

Overrides ComponentManager::getType()

Implements SurgSim::Framework::ComponentManager.

const std::vector<std::shared_ptr<View> >& SurgSim::Graphics::Manager::getViews ( ) const
inline

Returns the views assigned to the manager.

bool Manager::removeRepresentation ( std::shared_ptr< Representation representation)
protectedvirtual

Removes an representation from the manager.

Parameters
representationThe representation to be removed.
Returns
True if the representation was in this manager and has been successfully removed, false if it fails.
bool Manager::removeView ( std::shared_ptr< View view)
protectedvirtual

Removes a view from the manager.

Parameters
viewThe view to be removed.
Returns
True if the view was in this manager and has been successfully removed, false if it fails.

Reimplemented in SurgSim::Graphics::OsgManager.

Member Data Documentation

std::unordered_map<std::string, std::shared_ptr<Group> > SurgSim::Graphics::Manager::m_groups
private

Groups assigned to the manager.

std::vector<std::shared_ptr<Representation> > SurgSim::Graphics::Manager::m_representations
private

Representations assigned to the manager.

std::vector<std::shared_ptr<View> > SurgSim::Graphics::Manager::m_views
private

Views assigned to the manager.


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