SOFA API  ca665544
Open source framework for multi-physics simuation
sofa::simulation::SceneLoader Class Referenceabstract

#include <SceneLoaderFactory.h>

Main class used to register scene file loaders. More...

Inheritance diagram for sofa::simulation::SceneLoader:

Detailed Description

Main class used to register scene file loaders.

It uses the Factory design pattern, where each class is registered in a map, and dynamically retrieved given the type name. Abstract interface of a scene loader

Classes

struct  Listener
 to be able to inform when a scene is loaded More...
 

Static Protected Attributes

static Listeners s_listeners
 

Public Member Functions

virtual ~SceneLoader ()=default
 
virtual bool canLoadFileName (const char *filename)
 Pre-loading check. More...
 
virtual bool canWriteFileName (const char *filename)
 Pre-saving check. More...
 
virtual bool canLoadFileExtension (const char *extension)=0
 
virtual bool canWriteFileExtension (const char *)
 
sofa::simulation::NodeSPtr load (const std::string &filename, bool reload=false, const std::vector< std::string > &sceneArgs=std::vector< std::string >(0))
 load the file More...
 
virtual sofa::simulation::NodeSPtr doLoad (const std::string &filename, const std::vector< std::string > &sceneArgs)=0
 
virtual void write (sofa::simulation::Node *, const char *)
 write scene graph in the file More...
 
virtual std::string getFileTypeDesc ()=0
 get the file type description More...
 
virtual void getExtensionList (ExtensionList *list)=0
 get the list of file extensions More...
 
virtual bool syntaxForAddingRequiredPlugin (const std::string &pluginName, const std::vector< std::string > &listComponents, std::ostream &ss, sofa::simulation::Node *nodeWhereAdded)
 

Static Public Member Functions

static void addListener (Listener *l)
 adding a listener More...
 
static void removeListener (Listener *l)
 removing a listener More...
 

Static Protected Member Functions

static void notifyLoadingSceneBefore (SceneLoader *sceneLoader)
 
static void notifyReloadingSceneBefore (SceneLoader *sceneLoader)
 
static void notifyLoadingSceneAfter (sofa::simulation::NodeSPtr node, SceneLoader *sceneLoader)
 
static void notifyReloadingSceneAfter (sofa::simulation::NodeSPtr node, SceneLoader *sceneLoader)
 

Attribute details

◆ s_listeners

SceneLoader::Listeners sofa::simulation::SceneLoader::s_listeners
staticprotected

Constructor details

◆ ~SceneLoader()

virtual sofa::simulation::SceneLoader::~SceneLoader ( )
virtualdefault

Function details

◆ addListener()

void sofa::simulation::SceneLoader::addListener ( Listener l)
static

adding a listener

◆ canLoadFileExtension()

virtual bool sofa::simulation::SceneLoader::canLoadFileExtension ( const char extension)
pure virtual

◆ canLoadFileName()

bool sofa::simulation::SceneLoader::canLoadFileName ( const char filename)
virtual

Pre-loading check.

◆ canWriteFileExtension()

virtual bool sofa::simulation::SceneLoader::canWriteFileExtension ( const char )
inlinevirtual

◆ canWriteFileName()

bool sofa::simulation::SceneLoader::canWriteFileName ( const char filename)
virtual

Pre-saving check.

◆ doLoad()

virtual sofa::simulation::NodeSPtr sofa::simulation::SceneLoader::doLoad ( const std::string &  filename,
const std::vector< std::string > &  sceneArgs 
)
pure virtual

◆ getExtensionList()

virtual void sofa::simulation::SceneLoader::getExtensionList ( ExtensionList list)
pure virtual

get the list of file extensions

Implemented in sofa::simulation::SceneLoaderXML, and sofa::simulation::SceneLoaderPHP.

◆ getFileTypeDesc()

virtual std::string sofa::simulation::SceneLoader::getFileTypeDesc ( )
pure virtual

get the file type description

Implemented in sofa::simulation::SceneLoaderXML, and sofa::simulation::SceneLoaderPHP.

◆ load()

sofa::simulation::NodeSPtr sofa::simulation::SceneLoader::load ( const std::string &  filename,
bool  reload = false,
const std::vector< std::string > &  sceneArgs = std::vector<std::string>(0) 
)

load the file

◆ notifyLoadingSceneAfter()

void sofa::simulation::SceneLoader::notifyLoadingSceneAfter ( sofa::simulation::NodeSPtr  node,
SceneLoader sceneLoader 
)
staticprotected

◆ notifyLoadingSceneBefore()

void sofa::simulation::SceneLoader::notifyLoadingSceneBefore ( SceneLoader sceneLoader)
staticprotected

◆ notifyReloadingSceneAfter()

void sofa::simulation::SceneLoader::notifyReloadingSceneAfter ( sofa::simulation::NodeSPtr  node,
SceneLoader sceneLoader 
)
staticprotected

◆ notifyReloadingSceneBefore()

void sofa::simulation::SceneLoader::notifyReloadingSceneBefore ( SceneLoader sceneLoader)
staticprotected

◆ removeListener()

void sofa::simulation::SceneLoader::removeListener ( Listener l)
static

removing a listener

◆ syntaxForAddingRequiredPlugin()

bool sofa::simulation::SceneLoader::syntaxForAddingRequiredPlugin ( const std::string &  pluginName,
const std::vector< std::string > &  listComponents,
std::ostream &  ss,
sofa::simulation::Node nodeWhereAdded 
)
virtual

Write into a ostream the syntax to add a RequiredPlugin component in the scene file. The syntax depends on the file format, hence the SceneLoader. The function returns true if the derived SceneLoader implements this function, false otherwise.

Reimplemented in sofa::simulation::SceneLoaderXML.

◆ write()

virtual void sofa::simulation::SceneLoader::write ( sofa::simulation::Node ,
const char  
)
inlinevirtual

write scene graph in the file

Reimplemented in sofa::simulation::SceneLoaderXML.