opensurgsim
Public Member Functions | Public Attributes | Friends | List of all members
MockManager Class Reference

Manager class for testing. More...

#include <MockObjects.h>

Inheritance diagram for MockManager:
SurgSim::Graphics::Manager SurgSim::Framework::ComponentManager SurgSim::Framework::ComponentManager SurgSim::Framework::BasicThread SurgSim::Framework::BasicThread

Public Member Functions

 MockManager (bool succeedInit=true, bool succeedStartup=true)
 
int getType () const override
 Returns the type of Manager.
 
const std::vector< std::shared_ptr< MockComponent > > & getComponents ()
 
bool testTryAddComponent (const std::shared_ptr< SurgSim::Framework::Component > &component)
 
bool testTryRemoveComponent (const std::shared_ptr< SurgSim::Framework::Component > &component)
 
void testProcessComponents ()
 
 MockManager ()
 Constructor. More...
 
int getNumUpdates () const
 Returns the number of times the manager has been updated.
 
double getSumDt () const
 Returns the sum of the dt that the manager has been updated with.
 
void dumpDebugInfo () const
 Generic unspecified debug handle, there are no requirements on this interface the manager implementation can decide what to do.
 
int getType () const override
 Returns the type of Manager.
 
virtual std::shared_ptr< SurgSim::Graphics::GroupgetOrCreateGroup (const std::string &name)
 Fetch a group with a given name, if the group does not exist, create it. More...
 
- Public Member Functions inherited from SurgSim::Graphics::Manager
 Manager ()
 Constructor.
 
virtual ~Manager ()
 Destructor.
 
const std::vector< std::shared_ptr< Representation > > & getRepresentations () const
 Returns the representations assigned to the manager.
 
const std::unordered_map< std::string, std::shared_ptr< Group > > & getGroups () const
 Returns the groups assigned to the manager.
 
const std::vector< std::shared_ptr< View > > & getViews () const
 Returns the views assigned to the manager.
 
- Public Member Functions inherited from SurgSim::Framework::ComponentManager
 ComponentManager (const std::string &name="Unknown Component Manager")
 
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.
 
void start (std::shared_ptr< Barrier > startupBarrier=nullptr, bool isSynchronous=false)
 Live cycle functions, public implementation. 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.
 
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...
 
double getCpuTime () const
 
size_t getUpdateCount () const
 
void resetCpuTimeAndUpdateCount ()
 Reset the cpu time and the update count to 0.
 
bool ignoresExceptions () const
 
void setIgnoreExceptions (bool val)
 

Public Attributes

bool succeedInit
 
bool succeedStartup
 
bool didInitialize
 
bool didStartUp
 
bool didBeforeStop
 
int count
 

Friends

class GraphicsManagerTest
 

Additional Inherited Members

- Protected Member Functions inherited from SurgSim::Graphics::Manager
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 void addGroup (std::shared_ptr< Group > group)
 Adds a group to the manager, override for manager specific behavior when adding. More...
 
void doBeforeStop () override
 Prepares the thread for its execution to be stopped. 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, std::vector< std::shared_ptr< SceneElement >> *inflightElements)
 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::LoggergetLogger () const
 Returns this manager's logger.
 
template<class T >
void retireComponents (const std::vector< std::shared_ptr< T >> &container)
 
- 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)
 
- Protected Attributes inherited from SurgSim::Framework::ComponentManager
boost::mutex m_componentMutex
 Blocks protects addition and removal queues.
 
std::vector< std::shared_ptr< SurgSim::Framework::Behavior > > m_behaviors
 Collection of behaviors.
 
std::vector< std::shared_ptr< Component > > m_componentAdditions
 
std::vector< std::shared_ptr< Component > > m_componentRemovals
 
std::vector< std::shared_ptr< SceneElement > > m_elementCache
 
- Protected Attributes inherited from SurgSim::Framework::BasicThread
Timer m_timer
 Timer to measure the actual time taken to doUpdate.
 
std::shared_ptr< SurgSim::Framework::Loggerm_logger
 Logger for this thread.
 

Detailed Description

Manager class for testing.

Constructor & Destructor Documentation

§ MockManager()

MockManager::MockManager ( )
inline

Constructor.

Postcondition
m_numUpdates and m_sumDt are initialized to 0

Member Function Documentation

§ getOrCreateGroup()

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

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.

Implements SurgSim::Graphics::Manager.


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