Template Class Reference

AIML class that represents the AIML XML tag "template". More...

#include <Template.h>

Inheritance diagram for Template:

InnerCategory InnerTopic InnerAIML Tag List of all members.

Public Member Functions

virtual void add (const shared_ptr< InnerTemplate > &tag) throw (InternalProgrammerErrorException &)
 Adds the tag to an internal data structure.
virtual void addCharacters (const StringPimpl &characters) throw (InternalProgrammerErrorException &)
 Creates a PlainWord object, adds the input characters to it and then calls Template::add() with the PlainWord object.
virtual StringPimpl getString () const throw (InternalProgrammerErrorException &)
 Iterates through the internal data structure and calls InnerTemplate::getString() on each element appending the output from each call and then returning the appended output.
virtual void handleInnerTag (const shared_ptr< Tag > &tag) throw (InternalProgrammerErrorException &)
 Calls Template::add() to add the tag to an internal data structure if it's a InnerTemplate otherwise it throws a rebecca::impl::InternalProgrammerErrorException.
 Template () throw (InternalProgrammerErrorException &)
 Default constructor to initalize the private implementation (m_pimpl) data.
virtual ~Template ()
 Default virtual destructor.

Private Attributes

shared_ptr< TemplateImpl > m_pimpl
 The private implementation in which you cannot get access to.

Detailed Description

AIML class that represents the AIML XML tag "template".

Every time a XML Tag of AIML is encountered, an instance of this class will be created. All text inbetween the begin and end tag, all attributes, and all inner Tags will go through methods of this class.


Constructor & Destructor Documentation

Template  )  throw (InternalProgrammerErrorException &)
 

Default constructor to initalize the private implementation (m_pimpl) data.

Exceptions:
InternalProgrammerErrorException is thrown only if the error is so grave that the entire AIML engine has to be shut down.

virtual ~Template  )  [virtual]
 

Default virtual destructor.

Destroys the private implementation (m_pimpl) data.


Member Function Documentation

virtual void add const shared_ptr< InnerTemplate > &  tag  )  throw (InternalProgrammerErrorException &) [virtual]
 

Adds the tag to an internal data structure.

This method goes hand-in-hand with Template::getString(). This adds the InnerTemplate Tag to the data structure. Template::getString() retrieves the template's string from the data structure.

The internal data stucture is usually a linked list or vector of InnerTemplate. Each new tag is added to the end of the data structure.

Parameters:
tag The tag to add to the internal data structure.
Exceptions:
InternalProgrammerErrorException is thrown only if the error is so grave that the entire AIML engine has to be shut down.

virtual void addCharacters const StringPimpl characters  )  throw (InternalProgrammerErrorException &) [virtual]
 

Creates a PlainWord object, adds the input characters to it and then calls Template::add() with the PlainWord object.

Characters are usually intermingled with other InnerTemplate Tags. For Template::getString() to work, a PlainWord is created for each intermingled set of characters and added as an object among the other InnerTemplate objects in the internal data structure.

Here is a simple example of intermingled characters, <template>Hi, <formal>frank</formal> how are you</template> When this example occurs, a PlainWord object for "Hi,", and "how are you" will be created. Once added through this method and the other objects are added through Template::handleInnerTag(), the internal data structure would look something like: PlainWord -> Formal -> PlainWord

Parameters:
characters The characters that will be put into a PlainWord object and added by calling Template::add()
Exceptions:
InternalProgrammerErrorException is thrown only if the error is so grave that the entire AIML engine has to be shut down.

Reimplemented from Tag.

virtual StringPimpl getString  )  const throw (InternalProgrammerErrorException &) [virtual]
 

Iterates through the internal data structure and calls InnerTemplate::getString() on each element appending the output from each call and then returning the appended output.

The internal data stucture is usually a linked list or vector of InnerTemplate. This method of is usually what the internal NodeMapper calls to get the response from the AIML engine after it does path matching on user input.

Returns:
The string after calling InnerTemplate::getString() on each element of the internal data structure and appending the output of each call together.
Exceptions:
InternalProgrammerErrorException is thrown only if the error is so grave that the entire AIML engine has to be shut down.

Implements InnerCategory.

virtual void handleInnerTag const shared_ptr< Tag > &  tag  )  throw (InternalProgrammerErrorException &) [virtual]
 

Calls Template::add() to add the tag to an internal data structure if it's a InnerTemplate otherwise it throws a rebecca::impl::InternalProgrammerErrorException.

Using Tag::instanceOf() it first checks to ensure that the Tag is an instance of InnerTemplate. Otherwise it throws rebecca::impl::InternalProgrammerErrorException. After it verifies it is an instance of InnerTemplate it calls Template::add() to add it to the internal data structure.

The internal data stucture is usually a linked list or vector of InnerTemplate. Each new tag is added to the end of the data structure.

Parameters:
tag The tag to add to the internal data structure.
Exceptions:
InternalProgrammerErrorException is thrown if the tag is not an instance of an InnerTemplate

Reimplemented from Tag.


Member Data Documentation

shared_ptr<TemplateImpl> m_pimpl [private]
 

The private implementation in which you cannot get access to.

This shared_ptr holds the private methods and private member variables of this class. This makes ABI (Application Binary Interface) more resilient to change. See the private implementation idiom on the internet for more information about this.

Reimplemented from InnerCategory.


The documentation for this class was generated from the following file:
Generated on Thu Sep 7 22:05:46 2006 for RebeccaAIML by  doxygen 1.4.5