[interface] Base class for all interfaces that OpenRAVE provides. See Base Interface Concepts.
More...
#include <interface.h>
|
typedef boost::function< bool(std::ostream
&, std::istream &)> | InterfaceCommandFn |
| The function to be executed for every command.
|
|
|
virtual void | RegisterCommand (const std::string &cmdname, InterfaceCommandFn fncmd, const std::string &strhelp) |
| Registers a command and its help string. [multi-thread safe]
|
|
virtual void | UnregisterCommand (const std::string &cmdname) |
| Unregisters the command. [multi-thread safe]
|
|
virtual const char * | GetHash () const =0 |
|
virtual boost::shared_mutex & | GetInterfaceMutex () const |
|
[interface] Base class for all interfaces that OpenRAVE provides. See Base Interface Concepts.
Definition at line 42 of file interface.h.
The function to be executed for every command.
- Parameters
-
sinput | - input of the command |
sout | - output of the command |
- Returns
- If false, there was an error with the command, true if successful
Definition at line 161 of file interface.h.
OpenRAVE::InterfaceBase::~InterfaceBase |
( |
| ) |
|
|
virtual |
virtual const std::string& OpenRAVE::InterfaceBase::GetDescription |
( |
| ) |
const |
|
inlinevirtual |
- Returns
- The environment that this interface is attached to. [multi-thread safe]
Definition at line 68 of file interface.h.
virtual const char* OpenRAVE::InterfaceBase::GetHash |
( |
| ) |
const |
|
protectedpure virtual |
virtual boost::shared_mutex& OpenRAVE::InterfaceBase::GetInterfaceMutex |
( |
| ) |
const |
|
inlineprotectedvirtual |
InterfaceType OpenRAVE::InterfaceBase::GetInterfaceType |
( |
| ) |
const |
|
inline |
const std::string& OpenRAVE::InterfaceBase::GetPluginName |
( |
| ) |
const |
|
inline |
set internally by RaveDatabase [multi-thread safe]
- Returns
- the pluginname this interface was loaded from
Definition at line 63 of file interface.h.
XMLReadablePtr OpenRAVE::InterfaceBase::GetReadableInterface |
( |
const std::string & |
xmltag | ) |
const |
|
virtual |
Returns the readable interface. [multi-thread safe]
Definition at line 198 of file interface.cpp.
const READERSMAP& OpenRAVE::InterfaceBase::GetReadableInterfaces |
( |
| ) |
const |
|
inline |
Returns the raw map reference, this is not multithread safe and the GetInterfaceMutex should be locked before using.
Definition at line 73 of file interface.h.
virtual const std::string& OpenRAVE::InterfaceBase::GetURI |
( |
| ) |
const |
|
inlinevirtual |
the URI used to load the interface (sometimes this is not possible if the definition lies inside an environment file). [multi-thread safe]
Definition at line 110 of file interface.h.
UserDataPtr OpenRAVE::InterfaceBase::GetUserData |
( |
const std::string & |
key = std::string() | ) |
const |
|
virtual |
return the user custom data [multi-thread safe]
Definition at line 53 of file interface.cpp.
virtual const std::string& OpenRAVE::InterfaceBase::GetXMLFilename |
( |
| ) |
const |
|
inlinevirtual |
const std::string& OpenRAVE::InterfaceBase::GetXMLId |
( |
| ) |
const |
|
inline |
set internally by RaveDatabase [multi-thread safe]
- Returns
- the unique identifier that describes this class type, case is ignored should be the same id used to create the object
Definition at line 57 of file interface.h.
Registers a command and its help string. [multi-thread safe]
- Parameters
-
cmdname | - command name, converted to lower case |
fncmd | function to execute for the command |
strhelp | - help string in reStructuredText, see Documenting Interfaces. |
- Exceptions
-
Definition at line 121 of file interface.cpp.
bool OpenRAVE::InterfaceBase::RemoveUserData |
( |
const std::string & |
key | ) |
const |
|
virtual |
removes a user data pointer. if user data pointer does not exist, then return 0, otherwise 1. [multi-thread safe]
Definition at line 63 of file interface.cpp.
bool OpenRAVE::InterfaceBase::SendCommand |
( |
std::ostream & |
os, |
|
|
std::istream & |
is |
|
) |
| |
|
virtual |
Used to send special commands to the interface and receive output.
The command must be registered by RegisterCommand. A special command 'help' is always supported and provides a way for the user to query the current commands and the help string. The format of the returned help commands are in reStructuredText. The following commands are possible:
- 'help [command name]' - get the help string of just that command.
- 'help commands' - return the names of all the possible commands
- Parameters
-
is | the input stream containing the command |
os | the output stream containing the output |
- Exceptions
-
- Returns
- true if the command is successfully processed, otherwise false.
Definition at line 91 of file interface.cpp.
void OpenRAVE::InterfaceBase::Serialize |
( |
BaseXMLWriterPtr |
writer, |
|
|
int |
options = 0 |
|
) |
| const |
|
virtual |
serializes the interface
The readable interfaces are also serialized within the tag, for example:
<sometag> <!-- root writer -->
<interface> <!-- first child -->
<readableinterface/> <!-- readable interface -->
</interface>
</sometag>
Depending on the writer format, extra tags might be created.
Reimplemented in OpenRAVE::KinBody.
Definition at line 114 of file interface.cpp.
virtual void OpenRAVE::InterfaceBase::SetDescription |
( |
const std::string & |
description | ) |
|
|
inlinevirtual |
sets a description [multi-thread safe]
Definition at line 89 of file interface.h.
Set a new readable interface and return the previously set interface if it exists. [multi-thread safe]
Definition at line 205 of file interface.cpp.
void OpenRAVE::InterfaceBase::SetUserData |
( |
const std::string & |
key, |
|
|
UserDataPtr |
data |
|
) |
| const |
|
virtual |
set user data for a specific key. [multi-thread safe]
Because user data can be used for caching objects, it is necessary to allow functions taking const pointers of the interface can reset the pointers.
Definition at line 36 of file interface.cpp.
virtual void OpenRAVE::InterfaceBase::SetUserData |
( |
UserDataPtr |
data | ) |
|
|
inlinevirtual |
void OpenRAVE::InterfaceBase::UnregisterCommand |
( |
const std::string & |
cmdname | ) |
|
|
protectedvirtual |
Unregisters the command. [multi-thread safe]
Definition at line 133 of file interface.cpp.
std::string OpenRAVE::InterfaceBase::__description |
|
protected |
The documentation for this class was generated from the following files: