libIntegra
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Public Member Functions | List of all members
integra_api::IServer Class Referenceabstract

Provides methods to query libIntegra and process commands. More...

#include "api/server.h"

Public Member Functions

virtual const guid_set & get_all_module_ids () const =0
 Get the ids of all the modules that are currently loaded.
 
virtual const
IInterfaceDefinition
find_interface (const GUID &module_id) const =0
 Lookup a module interface by its id. More...
 
virtual const node_map & get_nodes () const =0
 Get the set of top-level nodes. More...
 
virtual const INodefind_node (const CPath &path, const INode *relative_to=NULL) const =0
 Lookup a node by its path. More...
 
virtual const node_map & get_siblings (const INode &node) const =0
 Get a node's sibling set. More...
 
virtual const INodeEndpointfind_node_endpoint (const CPath &path, const INode *relative_to=NULL) const =0
 Lookup a node endpoint by its path. More...
 
virtual const CValueget_value (const CPath &path) const =0
 Lookup the value of a stateful control node endpoint. More...
 
virtual CError process_command (ICommand *command, CCommandResult *result=NULL)=0
 Alter libIntegra's state by passing in a subclass of CCommand. More...
 
virtual IModuleManagerget_module_manager () const =0
 Get the Module Manager. See IModuleManager.
 
virtual string get_libintegra_version () const =0
 Get version number. More...
 
virtual void dump_libintegra_state ()=0
 Testing function. More...
 
virtual void dump_dsp_state (const string &file)=0
 Testing function. More...
 
virtual void ping_all_dsp_modules ()=0
 Testing function. More...
 

Detailed Description

Provides methods to query libIntegra and process commands.

Note
All the methods of IServer assumes that the server is locked, ie that exactly one instance of CServerLock exists See documentation for CServerLock for a discussion of how to do this

Member Function Documentation

virtual void integra_api::IServer::dump_dsp_state ( const string &  file)
pure virtual

Testing function.

Uses undocumented libPD function to write libPD's internal state to the specified file as a pd patch

virtual void integra_api::IServer::dump_libintegra_state ( )
pure virtual

Testing function.

Dumps state of all existing nodes and their stateful endpoints to output console

virtual const IInterfaceDefinition* integra_api::IServer::find_interface ( const GUID module_id) const
pure virtual

Lookup a module interface by its id.

Returns
an IInterfaceDefinition, or NULL if not found
virtual const INode* integra_api::IServer::find_node ( const CPath path,
const INode relative_to = NULL 
) const
pure virtual

Lookup a node by its path.

Parameters
pathabsolute or relative path
relative_toif provided, path is interpreted as being relative to this node. If NULL, path is interpreted to be absolute
Returns
the looked-up node, or NULL if not found
virtual const INodeEndpoint* integra_api::IServer::find_node_endpoint ( const CPath path,
const INode relative_to = NULL 
) const
pure virtual

Lookup a node endpoint by its path.

Parameters
pathabsolute or relative path
relative_toif provided, path is interpreted as being relative to this node. If NULL, path is interpreted to be absolute
Returns
the looked-up node endpoint, or NULL if not found
virtual string integra_api::IServer::get_libintegra_version ( ) const
pure virtual

Get version number.

Version number are provided as a dot-separated string containing four numbers: major version, minor version, patch number, build number Build numbers should always go up, that is they are not reset to 0 when we change any other part of the version number. So comparing build numbers should be sufficient to test whether one version is more recent that another.

virtual const node_map& integra_api::IServer::get_nodes ( ) const
pure virtual

Get the set of top-level nodes.

Returns
a map of node name -> INode * containing all top-level nodes
Note
Actually, this function gets all the nodes in the system, since the top-level nodes can be interrogated for their children, and so on. But only the top-level ones are directly available by iterating the returned map
virtual const node_map& integra_api::IServer::get_siblings ( const INode node) const
pure virtual

Get a node's sibling set.

This helper is more convenient than using INode's tree traversal functions, because it can also get siblings of top-level nodes.

Parameters
nodeThe node who's sibling set we're interested in
Returns
All of the node's siblings, including itself
virtual const CValue* integra_api::IServer::get_value ( const CPath path) const
pure virtual

Lookup the value of a stateful control node endpoint.

Parameters
pathpath of the node endpoint
Returns
the node endpoint's value, or NULL if node endpoint not found, not a control or not stateful
virtual void integra_api::IServer::ping_all_dsp_modules ( )
pure virtual

Testing function.

Sends a ping command to all dsp modules, and dumps to output console info about which responded ok

virtual CError integra_api::IServer::process_command ( ICommand command,
CCommandResult result = NULL 
)
pure virtual

Alter libIntegra's state by passing in a subclass of CCommand.

Parameters
commandThe command should be created using one of the IXXXCommand::create methods (see ICommand)
resultIf the caller needs feedback about what the command did, pass a pointer to the relevent subclass of CCommandResult here. It is the caller's responsibility to ensure that this object is of the correct type to match command (see CCommandResult).
Note
Unusually, this method expects to be passed commands which have been created on the heap, and assumes responsibility for deleting them itself. The reason for this is a) to maximise cleanliness of calling code - commands can be created and processed inline and b) for maximum efficiency if we wanted to add an undo/redo stack to libIntegra at some future time.
Returns
an error code, or CError::SUCCESS if no error. See CError for all the codes.

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