NAP
Public Member Functions | Protected Member Functions | List of all members
SequenceService Class Referencefinal

#include <sequenceservice.h>

Public Member Functions

 SequenceService (ServiceConfiguration *configuration)
 
 ~SequenceService () override
 
bool registerDefaultTrackCreatorForOutput (rtti::TypeInfo outputType, std::function< std::unique_ptr< SequenceTrack >(const SequencePlayerOutput *)> func)
 
SequencecreateDefaultSequence (std::vector< std::unique_ptr< rtti::Object >> &createdObjects, std::unordered_set< std::string > &objectIDs, const std::vector< ResourcePtr< SequencePlayerOutput >> &outputs)
 
bool registerControllerTypeForTrackType (rtti::TypeInfo trackType, rtti::TypeInfo controllerType)
 
rtti::TypeInfo getControllerTypeForTrackType (rtti::TypeInfo trackType)
 
bool registerControllerFactoryFunc (rtti::TypeInfo controllerType, SequenceControllerFactoryFunc factory)
 
bool registerAdapterFactoryFunc (rtti::TypeInfo typeInfo, SequencePlayerAdapterFactoryFunc factory)
 
std::unique_ptr< SequencePlayerAdapterinvokeAdapterFactory (rtti::TypeInfo type, const SequenceTrack &track, SequencePlayerOutput &output, const SequencePlayer &player)
 
std::unique_ptr< SequenceControllerinvokeControllerFactory (rtti::TypeInfo controllerType, SequencePlayer &player, SequenceEditor &editor)
 
std::vector< rtti::TypeInfogetRegisteredControllerTypes () const
 
std::string generateUniqueID (std::unordered_set< std::string > &objectIDs, const std::string &baseID="Generated")
 
void registerStandardClock (SequencePlayerStandardClock *standardClock)
 
void unregisterStandardClock (SequencePlayerStandardClock *standardClock)
 
- Public Member Functions inherited from Service
UNPREFIXED_MODULE_NAME_INPUTCASE Service (ServiceConfiguration *configuration)
 
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies) override
 
virtual void shutdown () override
 
 Service (ServiceConfiguration *configuration)
 
virtual ~Service ()
 
CoregetCore ()
 
const CoregetCore () const
 
std::string getTypeName () const
 
const ModulegetModule () const
 
 Service (Service &)=delete
 
Serviceoperator= (const Service &)=delete
 
 Service (Service &&)=delete
 
Serviceoperator= (Service &&)=delete
 

Protected Member Functions

void registerObjectCreators (rtti::Factory &factory) override
 
bool init (nap::utility::ErrorState &errorState) override
 
void update (double deltaTime) override
 
- Protected Member Functions inherited from Service
virtual void getDependentServices (std::vector< rtti::TypeInfo > &dependencies)
 
virtual void created ()
 
virtual void preUpdate (double deltaTime)
 
virtual void postUpdate (double deltaTime)
 
virtual void preShutdown ()
 
virtual void shutdown ()
 
virtual void preResourcesLoaded ()
 
virtual void postResourcesLoaded ()
 
template<typename SERVICE_CONFIG >
SERVICE_CONFIG * getConfiguration ()
 
template<typename SERVICE_CONFIG >
const SERVICE_CONFIG * getConfiguration () const
 
std::string getIniFilePath () const
 
std::string getIniFilePath (const std::string &appendix) const
 

Description

SequenceService is responsible for updating outputs and contains information about which controller, adapter is used for editing registered track types. When adding a new track type, make sure to register the new controller and adapter factory methods by calling the appropriate register functions on the SequenceService. A good place to do this from is from your own (app) Module Service that will always initialize itself before any SequenceEditor resource

Inheritance diagram for SequenceService:
[legend]
Collaboration diagram for SequenceService:
[legend]

Constructor & Destructor Documentation

◆ SequenceService()

SequenceService ( ServiceConfiguration configuration)

Constructor

◆ ~SequenceService()

~SequenceService ( )
override

Deconstructor

Member Function Documentation

◆ createDefaultSequence()

Sequence* createDefaultSequence ( std::vector< std::unique_ptr< rtti::Object >> &  createdObjects,
std::unordered_set< std::string > &  objectIDs,
const std::vector< ResourcePtr< SequencePlayerOutput >> &  outputs 
)

creates a default sequence based on given outputs

Parameters
createdObjectsa reference to a vector that will be filled with unique pointers of created objects
objectIDsa list of unique ids, used to created unique ids for each object in this sequence
outputsa list of player outputs
Returns
a raw pointer to the newly created sequence, ownership of sequence is stored as a unique pointer in createdObjects

◆ generateUniqueID()

std::string generateUniqueID ( std::unordered_set< std::string > &  objectIDs,
const std::string &  baseID = "Generated" 
)

generate a unique id

Parameters
objectIDsreference to collections of id's
baseIDbase id
Returns
unique id

◆ getControllerTypeForTrackType()

rtti::TypeInfo getControllerTypeForTrackType ( rtti::TypeInfo  trackType)

returns controller type info for give track type

Parameters
trackTypethe track type
Returns
the controller type

◆ getRegisteredControllerTypes()

std::vector<rtti::TypeInfo> getRegisteredControllerTypes ( ) const

returns all registered controller types that have registered factory functions

Returns
vector of controller type info

◆ init()

bool init ( nap::utility::ErrorState errorState)
overrideprotectedvirtual

initializes service

Parameters
errorStatecontains any errors
Returns
returns true on successful initialization

Reimplemented from Service.

◆ invokeAdapterFactory()

std::unique_ptr<SequencePlayerAdapter> invokeAdapterFactory ( rtti::TypeInfo  type,
const SequenceTrack track,
SequencePlayerOutput output,
const SequencePlayer player 
)

Invokes adapter factory method and returns unique ptr to created adapter, assert when track type not found

Parameters
typetrack type
trackreference to track
outputreference to input
playersequence player creating adapter
Returns
unique ptr to created adapter, nullptr upon failure

◆ invokeControllerFactory()

std::unique_ptr<SequenceController> invokeControllerFactory ( rtti::TypeInfo  controllerType,
SequencePlayer player,
SequenceEditor editor 
)

Invokes controller factory method and returns unique_ptr to controller, asserts when controller type is not found

Parameters
controllerTypethe type of controller to create
playerreference to player
editorreference to editor
Returns
unique_ptr to controller

◆ registerAdapterFactoryFunc()

bool registerAdapterFactoryFunc ( rtti::TypeInfo  typeInfo,
SequencePlayerAdapterFactoryFunc  factory 
)

registers adapter factory method for specific track type

Parameters
typeInfothe type of track that is associated with the factory method
factorythe factory method
Returns
true if registration is successful

◆ registerControllerFactoryFunc()

bool registerControllerFactoryFunc ( rtti::TypeInfo  controllerType,
SequenceControllerFactoryFunc  factory 
)

registers a new controller factory function for controller type

Parameters
controllerTypethe type of controller for which to register a new factory function
factoryfactory method of controller type
Returns
true on success

◆ registerControllerTypeForTrackType()

bool registerControllerTypeForTrackType ( rtti::TypeInfo  trackType,
rtti::TypeInfo  controllerType 
)

Method that registers a certain controller type for a certain view type, this can be used by views to map controller types to view types

Parameters
trackTypethe trackType
controllerTypethe controller type
Returns
true on successful registration

◆ registerDefaultTrackCreatorForOutput()

bool registerDefaultTrackCreatorForOutput ( rtti::TypeInfo  outputType,
std::function< std::unique_ptr< SequenceTrack >(const SequencePlayerOutput *)>  func 
)

can be used to register a default creation method to the factory. When createDefaultSequence is called, it will iterate trough the given outputs and create a SequenceTrack that fits the output. Whenever we create a new type of output, we should also add a way to create a default track

Parameters
outputTypethe type information of the sequence output
functhe factory method
Returns
true on successful creation

◆ registerObjectCreators()

void registerObjectCreators ( rtti::Factory factory)
overrideprotectedvirtual

registers all objects that need a specific way of construction

Parameters
factorythe factory to register the object creators with

Reimplemented from Service.

◆ registerStandardClock()

void registerStandardClock ( SequencePlayerStandardClock standardClock)

registers a standard clock for updating

Parameters
standardClockpointer to standard clock

◆ unregisterStandardClock()

void unregisterStandardClock ( SequencePlayerStandardClock standardClock)

unregisters a standard clock

Parameters
standardClockpointer to standard clock

◆ update()

void update ( double  deltaTime)
overrideprotectedvirtual

updates any outputs and editors

Parameters
deltaTimedeltaTime

Reimplemented from Service.