NetworkAimlFacade Class Reference

Facade to manage the memory allocation and deallocation of concrete objects that have publicly exposed interfaces as well as provide get'ers to the concrete objects using their exposed interfaces. More...

#include <NetworkAimlFacade.h>

List of all members.

Public Member Functions

NetworkGraphBuildergetNetworkGraphBuilder () throw ()
 Returns the constructed GraphBuilder object from NetworkAimlFacade's constructor.
 NetworkAimlFacade (int argc, char *argv[]) throw (NetworkException &, Exception &)
 Constructs the facade and all the concrete objects to the interfaces that have get'ers.
void operator delete (void *p)
 All delete's will be handled through this dll.
void * operator new (size_t size)
 All new's will be handled through this dll.
virtual ~NetworkAimlFacade ()
 Destroys the facade and all the concrete objects to the interfaces that have get'ers.

Private Member Functions

 NetworkAimlFacade (const NetworkAimlFacade &networkAimlFacade)
 The copy constructor.
NetworkAimlFacadeoperator= (const NetworkAimlFacade &networkAimlFacade)
 The assignment operator.

Private Attributes

NetworkGraphBuilderm_graphBuilder
 The GraphBuilder pointer.


Detailed Description

Facade to manage the memory allocation and deallocation of concrete objects that have publicly exposed interfaces as well as provide get'ers to the concrete objects using their exposed interfaces.

NetworkAimlFacade manages the memory for the GraphBuilder object. When NetworkAimlFacade is instantiated it creates the GraphBuilder concrete implementation with a "new" and stores it inside of its pointer to the GraphBuilder interface, m_graphBuilder. When NetworkAimlFacade is destroyed it in turn destroys the GraphBuilder object through this same pointer.

This indirection is needed since GraphBuilder is an interface and users cannot directly instantiate it without access to a concrete implementation.

Since NetworkAimlFacade creates and deletes the GraphBuilder object from the heap with a "new", the memory management stays inside of the dll. This is a requirement for "dll memory boundary safety".


Constructor & Destructor Documentation

NetworkAimlFacade ( int  argc,
char *  argv[] 
) throw (NetworkException &, Exception &)

Constructs the facade and all the concrete objects to the interfaces that have get'ers.

Underneath the covers the constructor creates a factory and from that factor creates the GraphBuilder concrete representation and stores it in the m_graphBuilder pointer. Pass in your argc and argv from your main() to this constructor so it can parse any commands it might want. If you don't have access to your arguments from main() you can "fake" it by passing in 1 to argc, and a string with the name of your program to argv.

Parameters:
argc Pass this from your main()
argv Pass this from your main()
Exceptions:
NetworkException If it cannot contact the server upon construction to make the initial connection it will throw a network exception with the message of why it cannot contact the server.
Exception If an underlying method throws an exception, it will be wrapped and thrown as a Exception.

virtual ~NetworkAimlFacade (  )  [virtual]

Destroys the facade and all the concrete objects to the interfaces that have get'ers.

Underneath the covers it deletes the GraphBuilder and its respective factory which created it.

NetworkAimlFacade ( const NetworkAimlFacade networkAimlFacade  )  [private]

The copy constructor.

For now, I am not allowing this to be invoked. In the future, if I do, it will more than likely be a shallow copy since it could be potentially expensive to do a deep copy of the GraphBuilder object.

Parameters:
networkAimlFacade The standard second reference


Member Function Documentation

NetworkGraphBuilder& getNetworkGraphBuilder (  )  throw ()

Returns the constructed GraphBuilder object from NetworkAimlFacade's constructor.

The GraphBuilder object and memory is constructed in the NetworkAimlFacade constructor and destroyed in the NetworkAimlFacade destructor. DO NOT try to delete GraphBuilder yourself. Instead let NetworkAimlFacade auotmagically handle the construction and deletion of GraphBuilder.

Returns:
The GraphBuilder constructed in the NetworkAimlFacade constructor.
Exceptions:
No exceptions will be thrown.

void operator delete ( void *  p  ) 

All delete's will be handled through this dll.

This is required for dll boundary safety. Instead of allowing the compiler to choose if it wants to inline this we have made it so that it cannot. If we let the compiler choose to inline or not inline this and the "new operator" we can run into dll boundary issues. The issue would be that the compiler would inline one and not the other. Thus, your executable with its own heap would allocate/delete and this dll would do the other. That's a dll boundary safety violation.

Parameters:
p The pointer to an instance of this object.

void* operator new ( size_t  size  ) 

All new's will be handled through this dll.

This is required for dll boundary safety. Instead of allowing the compiler to choose if it wants to inline this we have made it so that it cannot. If we let the compiler choose to inline or not inline this and the "delete operator" we can run into dll boundary issues. The issue would be that the compiler would inline one and not the other. Thus, your executable with its own heap would allocate/delete and this dll would do the other. That's a dll boundary safety violation.

Parameters:
size The size to allocate an instance of this object with.
Returns:
An instance of this object

NetworkAimlFacade& operator= ( const NetworkAimlFacade networkAimlFacade  )  [private]

The assignment operator.

For now, I am not allowing a copy to be made. In the future, if I do, it will more than likely be a shallow copy since it could be potentially expensive to do a deep copy of the GraphBuilder object.

Parameters:
networkAimlFacade The standard second reference.


Member Data Documentation

NetworkGraphBuilder* m_graphBuilder [private]

The GraphBuilder pointer.

Use NetworkAimlFacade::getGraphBuilder to obtain a reference to this. The GraphBuilder object is constructed in the constructor of NetworkAimlFacade and deleted in the destructor of NetworkAimlFacade. DO NOT try to delete this yourself. Let NetworkAimlFacade handle the memory of this for "dll memory boundary safety".


The documentation for this class was generated from the following file:
Generated on Mon Aug 27 12:27:00 2007 for RebeccaAIML by  doxygen 1.5.3