- Main Page
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Mers::Executives::DeductiveController::Command::CommandDispatcherEntry Class Reference

`#include <CommandDispatcherEntry.h>`

Inheritance diagram for Mers::Executives::DeductiveController::Command::CommandDispatcherEntry:

[legend]
Collaboration diagram for Mers::Executives::DeductiveController::Command::CommandDispatcherEntry:

[legend]
List of all members.

## Public Member Functions
| CommandDispatcherEntry (const char *fromFunctionName, unsigned int numFromParams, const char *toFunctionName)
| CommandDispatcherEntry (const Mers::Utils::Lang::String &fromFunctionName, unsigned int numFromParams, const Mers::Utils::Lang::String &toFunctionName)
virtual | ~CommandDispatcherEntry ()
void | addToParameter (const char *str)
void | addToParameter (const Mers::Utils::Lang::String &str)
void | addToParameter (unsigned int index) throw (Mers::Utils::Exceptions::IllegalArgumentException *)
void | setFromParameter (unsigned int index, const char *str)
void | setFromParameter (unsigned int index, const Mers::Utils::Lang::String &str)
void | clearFromParameter (unsigned int index)
unsigned int | getNumFromParameters () const
bool | matches (const Mers::Utils::Lang::String &funcName, const std::vector< const Mers::Utils::Lang::String * > &params) const
void | convertParameters (const std::vector< const Mers::Utils::Lang::String * > &fromParams, std::vector< const Mers::Utils::Lang::String * > &out_toParams) const throw (Mers::Utils::Exceptions::IllegalArgumentException *)
const Mers::Utils::Lang::String & | getFromFunctionName () const
const Mers::Utils::Lang::String & | getToFunctionName () const
virtual void | print (std::ostream &out) const
virtual CommandDispatcherEntry * | duplicate () const
bool | operator== (CommandDispatcherEntry const &other) const
## Protected Attributes
Mers::Utils::Lang::String | m_fromFuncName
unsigned int | m_numFromParams
Mers::Utils::Lang::String | m_toFuncName
Mers::Utils::Containers::DynamicArrayTemplate< Parameter > | m_toFuncParams
Mers::Utils::Containers::DynamicArrayTemplate< ParameterLiteral > | m_fromFuncParams
## Classes
class | Parameter
class | ParameterLiteral
class | ParameterReference

## Detailed Description

This class contains all the relevant information need to map a function call from one system to a function call on another system, where each system takes only strings as parameters. This object allows the mapping to make a few transformations. The function name can be changed. The number of parameters can be changed. For each parameter in the destination system, the parameter can either be a constant string literal or any one parameter from the initial function call. Each parameter from the calling system can be used zero or more times. String manipulation is not supported (concatination, substring, etc).

For example. The function foo( bar1, bar2, bar3 ) can be mapped to foobar( &bar3, &bar2, &bar2, "foomatic", &bar2, "12" ).

Definition at line 56 of file CommandDispatcherEntry.h.

## Constructor & Destructor Documentation

CommandDispatcherEntry::CommandDispatcherEntry | ( | const char * | fromFunctionName,
|  | unsigned int | numFromParams,
|  | const char * | toFunctionName |
| ) |  |  |

Constructs this object.

Parameters:

  | fromFunctionName | The name of the function of the calling function.
  | numFromParams | The number of parameters that the calling function accepts. This is used to verify the references and used limit this rule so it only matches functions of a specified length.
  | toFunctionName | The name that fromFunctionName will be mapped to. The name of the function on the destination system.

Definition at line 28 of file CommandDispatcherEntry.cpp.

CommandDispatcherEntry::CommandDispatcherEntry | ( | const Mers::Utils::Lang::String & | fromFunctionName,
|  | unsigned int | numFromParams,
|  | const Mers::Utils::Lang::String & | toFunctionName |
| ) |  |  |

Constructs this object.

Parameters:

  | fromFunctionName | The name of the function of the calling function.
  | numFromParams | The number of parameters that the calling function accepts. This is used to verify the references and used limit this rule so it only matches functions of a specified length.
  | toFunctionName | The name that fromFunctionName will be mapped to. The name of the function on the destination system.

Definition at line 39 of file CommandDispatcherEntry.cpp.

CommandDispatcherEntry::~CommandDispatcherEntry | ( |  | ) | `[virtual]`

Destroys this object.

Definition at line 52 of file CommandDispatcherEntry.cpp.

## Member Function Documentation

void CommandDispatcherEntry::addToParameter | ( | const char * | str | ) |

Adds a new literal parameter to the destination function. This adds one to the number of parameters used when calling the destination function. The extra parameter will be the string str.

Parameters:

  | str | The string literal used for the additional parameter.

Definition at line 58 of file CommandDispatcherEntry.cpp.

References m_toFuncParams.

void CommandDispatcherEntry::addToParameter | ( | const Mers::Utils::Lang::String & | str | ) |

Adds a new literal parameter to the destination function. This adds one to the number of parameters used when calling the destination function. The extra parameter will be the string str.

Parameters:

  | str | The string literal used for the additional parameter.

Definition at line 69 of file CommandDispatcherEntry.cpp.

References m_toFuncParams.

void CommandDispatcherEntry::addToParameter | ( | unsigned int | index | ) | throw (Mers::Utils::Exceptions::IllegalArgumentException *)

Adds a new reference parameter to the destination function. This adds one to the number of parameters used when calling the destination function. The extra parameter will be the calling function's index'th parameter.

Parameters:

  | index | The index of the parameter from the calling function that should be used as the additional parameter. Note that index should be less than getNumFromParameters().

Definition at line 80 of file CommandDispatcherEntry.cpp.

void CommandDispatcherEntry::setFromParameter | ( | unsigned int | index,
|  | const char * | str |
| ) |  |  |

Sets the index'th parameter of the from function as matching the specific string str. This string must match for this entry to match the function. This overrides any previous value stored for this index. Setting this to NULL will clear the current entry.

Parameters:

  | index | The index of the function parameter (starting at 0) that must be matched.
  | str | The string that will be matched.

Definition at line 97 of file CommandDispatcherEntry.cpp.

References clearFromParameter(), and m_fromFuncParams.

Here is the call graph for this function:

void CommandDispatcherEntry::setFromParameter | ( | unsigned int | index,
|  | const Mers::Utils::Lang::String & | str |
| ) |  |  |

Sets the index'th parameter of the from function as matching the specific string str. This string must match for this entry to match the function. This overrides any previous value stored for this index.

Parameters:

  | index | The index of the function parameter (starting at 0) that must be matched.
  | str | The string that will be matched.

Definition at line 116 of file CommandDispatcherEntry.cpp.

References clearFromParameter(), and m_fromFuncParams.

Here is the call graph for this function:

void CommandDispatcherEntry::clearFromParameter | ( | unsigned int | index | ) |

Removes the from parameter entry at the specified index, setting it to NULL. If the from parameter entry is not currently allocated, the fromFuncParams is resized to accommodate the specified index.

Parameters:

  | index | The index that should be cleared.

Definition at line 133 of file CommandDispatcherEntry.cpp.

References m_fromFuncParams, and m_numFromParams.

Referenced by setFromParameter().

unsigned int Mers::Executives::DeductiveController::Command::CommandDispatcherEntry::getNumFromParameters | ( |  | ) | const`[inline]`

Returns the number of parameters that the calling function provides.

Definition at line 183 of file CommandDispatcherEntry.h.

References m_numFromParams.

bool Mers::Executives::DeductiveController::Command::CommandDispatcherEntry::matches | ( | const Mers::Utils::Lang::String & | funcName,
|  | const std::vector< const Mers::Utils::Lang::String * > & | params |
| ) |  |  | const

Returns true if this function name and parameters match this function entry. Parameters should only be matched before they are converted.

Parameters:

  | funcName | The name of the function being converted.
  | params | The list of parameters of the function that is being converted.

Returns:
  true if the from function matches the funcName( params ) specified, and false if it doesn't match.

void CommandDispatcherEntry::convertParameters | ( | const std::vector< const Mers::Utils::Lang::String * > & | fromParams,
|  | std::vector< const Mers::Utils::Lang::String * > & | out_toParams |
| ) |  |  | const throw (Mers::Utils::Exceptions::IllegalArgumentException *)

Converts a parameter list from the source function to the destination function, using the internal conversion data structure.

Note that all of the pointers returned in the out_toParams list are copied from the fromParams list or the internal objects and not duplicated, so they should not be deleted.

Parameters:

  | fromParams | The parameters given for the source function.
  | out_toParams | An empty list which will be filled with references to the appropriate parameter strings.

Definition at line 181 of file CommandDispatcherEntry.cpp.

const Mers::Utils::Lang::String& Mers::Executives::DeductiveController::Command::CommandDispatcherEntry::getFromFunctionName | ( |  | ) | const`[inline]`

Returns the name of the source function.

Definition at line 228 of file CommandDispatcherEntry.h.

References m_fromFuncName.

const Mers::Utils::Lang::String& Mers::Executives::DeductiveController::Command::CommandDispatcherEntry::getToFunctionName | ( |  | ) | const`[inline]`

Returns the name of the destination function.

Definition at line 235 of file CommandDispatcherEntry.h.

References m_toFuncName.

void CommandDispatcherEntry::print | ( | std::ostream & | out | ) | const`[virtual]`

called to print this object to the specified ostream. Derived classes must define this.

Parameters:

  | out | the ostream to print this object information to

Implements Mers::Utils::Lang::BaseModelObject.

Definition at line 219 of file CommandDispatcherEntry.cpp.

References m_fromFuncName, m_numFromParams, m_toFuncName, and m_toFuncParams.

CommandDispatcherEntry * CommandDispatcherEntry::duplicate | ( |  | ) | const`[virtual]`

returns a copy of this object if the object can be copied or NULL if the object cannot be copied. This function returns NULL by default, overide this function to return something different.

Returns:
  a pointer to a copy of this object or NULL if it can't be copied.

Reimplemented from Mers::Utils::Lang::BaseModelObject.

Definition at line 263 of file CommandDispatcherEntry.cpp.

bool CommandDispatcherEntry::operator== | ( | CommandDispatcherEntry const & | other | ) | const

Returns true if the two CD Entries are the same.

Parameters:

  | other | the entry being compared to this entry

Returns:
  true if the two entries are the same.

Definition at line 271 of file CommandDispatcherEntry.cpp.

References m_fromFuncName, m_numFromParams, m_toFuncName, and m_toFuncParams.

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

- /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Command/CommandDispatcherEntry.h
- /Users/fpy/titan-1-5-MBARI/Mers/Executives/DeductiveController/Command/CommandDispatcherEntry.cpp