|
PLearn 0.1
|
Documentation holder for a remote method. More...
#include <RemoteMethodDoc.h>

Public Member Functions | |
| RemoteMethodDoc () | |
| Constructors. | |
| RemoteMethodDoc (const BodyDoc &doc) | |
| RemoteMethodDoc (const RetDoc &doc) | |
| RemoteMethodDoc (const ArgDoc &doc) | |
| void | setName (const string &methodname) const |
| const string & | name () const |
| Access documentation components. | |
| void | checkConsistency () const |
| Will perform consistency checks (such as verifying if margs_doc and m_args_type have the same size) and launch an exception if inconsistencies are detected. | |
| int | nArgs () const |
| const string & | bodyDoc () const |
| const string & | returnDoc () const |
| const string & | returnType () const |
| const list< ArgDoc > & | argListDoc () const |
| const list< string > & | argListType () const |
| const RemoteMethodDoc & | operator, (const BodyDoc &doc) const |
| Set a body. | |
| const RemoteMethodDoc & | operator, (const RetDoc &doc) const |
| Set a return value. | |
| const RemoteMethodDoc & | operator, (const RetTypeDoc &doc) const |
| Set a return type. | |
| const RemoteMethodDoc & | operator, (const ArgDoc &doc) const |
| Add a new argument. | |
| const RemoteMethodDoc & | operator, (const ArgTypeDoc &doc) const |
| Add type information to the corresponding argument (must add type information in the same order and number as argument documentation) | |
| string | getPrototypeString (string argsep=", ") const |
| Returns a string repretenting the "prototype" (signature) of the function in the doc. | |
| string | getFullHelpText () const |
| return full help text for the function in the doc. | |
Protected Attributes | |
| string | m_name |
| Function name. | |
| string | m_body_doc |
| Function body documentation. | |
| string | m_return_doc |
| Return value documentation. | |
| string | m_return_type |
| Type string for return value. | |
| list< ArgDoc > | m_args_doc |
| Arguments documentation. | |
| list< string > | m_args_type |
| Type string for each argument. | |
Documentation holder for a remote method.
Method documentation consists of the following:
(Added later by trampolines: type information for the return value and arguments)
Definition at line 132 of file RemoteMethodDoc.h.
| PLearn::RemoteMethodDoc::RemoteMethodDoc | ( | ) | [inline] |
| PLearn::RemoteMethodDoc::RemoteMethodDoc | ( | const BodyDoc & | doc | ) | [inline] |
Definition at line 139 of file RemoteMethodDoc.h.
: m_body_doc(doc.m_doc) { }
| PLearn::RemoteMethodDoc::RemoteMethodDoc | ( | const RetDoc & | doc | ) | [inline] |
Definition at line 143 of file RemoteMethodDoc.h.
: m_return_doc(doc.m_doc) { }
| PLearn::RemoteMethodDoc::RemoteMethodDoc | ( | const ArgDoc & | doc | ) | [inline] |
Definition at line 147 of file RemoteMethodDoc.h.
: m_args_doc(1, doc) { }
| const list<ArgDoc>& PLearn::RemoteMethodDoc::argListDoc | ( | ) | const [inline] |
Definition at line 187 of file RemoteMethodDoc.h.
References m_args_doc.
Referenced by PLearn::HTMLHelpCommand::helpOnClass().
{
return m_args_doc;
}

| const list<string>& PLearn::RemoteMethodDoc::argListType | ( | ) | const [inline] |
Definition at line 192 of file RemoteMethodDoc.h.
References m_args_type.
Referenced by PLearn::HTMLHelpCommand::helpOnClass().
{
return m_args_type;
}

| const string& PLearn::RemoteMethodDoc::bodyDoc | ( | ) | const [inline] |
Definition at line 172 of file RemoteMethodDoc.h.
References m_body_doc.
Referenced by PLearn::HTMLHelpCommand::helpOnClass().
{
return m_body_doc;
}

| void PLearn::RemoteMethodDoc::checkConsistency | ( | ) | const |
Will perform consistency checks (such as verifying if margs_doc and m_args_type have the same size) and launch an exception if inconsistencies are detected.
Definition at line 41 of file RemoteMethodDoc.cc.
References PLERROR.
Referenced by nArgs(), and PLearn::RemoteTrampoline::RemoteTrampoline().
{
int argdocsize = m_args_doc.size();
int argtypesize = m_args_type.size();
if(argdocsize != argtypesize)
PLERROR("For function '%s', number of ArgDoc (%d) inconsistent with number of arguments (%d)",
m_name.c_str(), argdocsize, argtypesize);
}

| string PLearn::RemoteMethodDoc::getFullHelpText | ( | ) | const |
return full help text for the function in the doc.
Definition at line 69 of file RemoteMethodDoc.cc.
Referenced by PLearn::RemoteMethodMap::getMethodHelpText().
{
int nargs = nArgs();
string txt = getPrototypeString() + "\n";
txt += bodyDoc() + "\n";
if(nargs==0)
txt += "TAKES NO ARGUMENTS.\n";
else
{
list<ArgDoc>::const_iterator arg = argListDoc().begin();
list<ArgDoc>::const_iterator argend = argListDoc().end();
list<string>::const_iterator argtype = argListType().begin();
txt += "ARGUMENTS: \n";
for(; arg!=argend; ++arg, ++argtype)
{
txt += arg->m_argument_name + " : "
+ *argtype + "\n"
+ '\t' + arg->m_doc + "\n";
}
}
txt += "RETURNS: ";
txt += returnType() + "\n";
txt += returnDoc() + "\n";
return txt;
}

| string PLearn::RemoteMethodDoc::getPrototypeString | ( | string | argsep = ", " | ) | const |
Returns a string repretenting the "prototype" (signature) of the function in the doc.
Argsep is used a sthe separator between arguments (typically ", " or ",\n")
Definition at line 52 of file RemoteMethodDoc.cc.
{
string txt = returnType()+" "+name()+"(";
list<ArgDoc>::const_iterator arg;
list<ArgDoc>::const_iterator argbegin = argListDoc().begin();
list<ArgDoc>::const_iterator argend = argListDoc().end();
list<string>::const_iterator argtype = argListType().begin();
for(arg=argbegin; arg!=argend; ++arg, ++argtype)
{
if(arg!=argbegin)
txt += argsep;
txt += *argtype+" "+arg->m_argument_name;
}
txt += ")";
return txt;
}
| const string& PLearn::RemoteMethodDoc::name | ( | ) | const [inline] |
Access documentation components.
Definition at line 156 of file RemoteMethodDoc.h.
References m_name.
{
return m_name;
}
| int PLearn::RemoteMethodDoc::nArgs | ( | ) | const [inline] |
Definition at line 166 of file RemoteMethodDoc.h.
References checkConsistency(), and m_args_type.
{
checkConsistency();
return m_args_type.size();
}

| const RemoteMethodDoc& PLearn::RemoteMethodDoc::operator, | ( | const BodyDoc & | doc | ) | const [inline] |
Set a body.
Definition at line 198 of file RemoteMethodDoc.h.
References m_body_doc, and PLearn::BodyDoc::m_doc.
{
m_body_doc += doc.m_doc;
return *this;
}
| const RemoteMethodDoc& PLearn::RemoteMethodDoc::operator, | ( | const ArgTypeDoc & | doc | ) | const [inline] |
Add type information to the corresponding argument (must add type information in the same order and number as argument documentation)
Definition at line 227 of file RemoteMethodDoc.h.
References m_args_type, and PLearn::ArgTypeDoc::m_typestr.
{
m_args_type.push_back(doc.m_typestr);
return *this;
}
| const RemoteMethodDoc& PLearn::RemoteMethodDoc::operator, | ( | const ArgDoc & | doc | ) | const [inline] |
Add a new argument.
Definition at line 219 of file RemoteMethodDoc.h.
References m_args_doc.
{
m_args_doc.push_back(doc);
return *this;
}
| const RemoteMethodDoc& PLearn::RemoteMethodDoc::operator, | ( | const RetTypeDoc & | doc | ) | const [inline] |
Set a return type.
Definition at line 212 of file RemoteMethodDoc.h.
References m_return_type, and PLearn::RetTypeDoc::m_typestr.
{
m_return_type = doc.m_typestr;
return *this;
}
| const RemoteMethodDoc& PLearn::RemoteMethodDoc::operator, | ( | const RetDoc & | doc | ) | const [inline] |
Set a return value.
Definition at line 205 of file RemoteMethodDoc.h.
References PLearn::RetDoc::m_doc, and m_return_doc.
{
m_return_doc += doc.m_doc;
return *this;
}
| const string& PLearn::RemoteMethodDoc::returnDoc | ( | ) | const [inline] |
Definition at line 177 of file RemoteMethodDoc.h.
References m_return_doc.
Referenced by PLearn::HTMLHelpCommand::helpOnClass().
{
return m_return_doc;
}

| const string& PLearn::RemoteMethodDoc::returnType | ( | ) | const [inline] |
Definition at line 182 of file RemoteMethodDoc.h.
References m_return_type.
Referenced by PLearn::HTMLHelpCommand::helpOnClass().
{
return m_return_type;
}

| void PLearn::RemoteMethodDoc::setName | ( | const string & | methodname | ) | const [inline] |
Definition at line 151 of file RemoteMethodDoc.h.
References m_name.
Referenced by PLearn::RemoteTrampoline::RemoteTrampoline().
{ m_name = methodname; }

list<ArgDoc> PLearn::RemoteMethodDoc::m_args_doc [mutable, protected] |
Arguments documentation.
Definition at line 246 of file RemoteMethodDoc.h.
Referenced by argListDoc(), and operator,().
list<string> PLearn::RemoteMethodDoc::m_args_type [mutable, protected] |
Type string for each argument.
Definition at line 247 of file RemoteMethodDoc.h.
Referenced by argListType(), nArgs(), and operator,().
string PLearn::RemoteMethodDoc::m_body_doc [mutable, protected] |
Function body documentation.
Definition at line 243 of file RemoteMethodDoc.h.
Referenced by bodyDoc(), and operator,().
string PLearn::RemoteMethodDoc::m_name [mutable, protected] |
Function name.
Definition at line 242 of file RemoteMethodDoc.h.
string PLearn::RemoteMethodDoc::m_return_doc [mutable, protected] |
Return value documentation.
Definition at line 244 of file RemoteMethodDoc.h.
Referenced by operator,(), and returnDoc().
string PLearn::RemoteMethodDoc::m_return_type [mutable, protected] |
Type string for return value.
Definition at line 245 of file RemoteMethodDoc.h.
Referenced by operator,(), and returnType().
1.7.4