#include <AimlFacade.h>
Public Member Functions | |
AimlFacade () throw (Exception &) | |
Constructs the facade and all the concrete objects to the interfaces that have get'ers. | |
GraphBuilder & | getGraphBuilder () throw () |
Returns the constructed GraphBuilder object from AimlFacade's constructor. | |
void | operator delete (void *p) |
All delete's will be handled through this dll. | |
void * | operator new (unsigned int size) |
All new's will be handled through this dll. | |
virtual | ~AimlFacade () |
Destructs the facade and all the concrete objects to the interfaces that have get'ers. | |
Private Member Functions | |
AimlFacade (const AimlFacade &aimlFacade) | |
The copy constructor. | |
AimlFacade & | operator= (const AimlFacade &aimlFacade) |
The assignment operator. | |
Private Attributes | |
GraphBuilder * | m_graphBuilder |
The GraphBuilder pointer. |
AimlFacade manages the memory for the GraphBuilder object. When AimlFacade is instantiated it creates the GraphBuilder concerte implementation with a "new" and stores it inside of its pointer to the GraphBuilder interface, m_graphBuilder. When AimlFacade 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 AimlFacade 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".
|
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.
|
|
Destructs 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. |
|
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.
|
|
Returns the constructed GraphBuilder object from AimlFacade's constructor. The GraphBuilder object and memory is constructed in the AimlFacade constructor and destoryed in the AimlFacade destructor. DO NOT try to delete GraphBuilder yourself. Instead let AimlFacade auotmagically handle the construction and deletion of GraphBuilder.
|
|
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.
|
|
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.
|
|
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.
|
|
The GraphBuilder pointer. Use AimlFacade::getGraphBuilder to obtain a reference to this. The GraphBuilder object is constructed in the constructor of AimlFacade and deleted in the destructor of AimlFacade. DO NOT try to delete this yourself. Let AimlFacade handle the memory of this for "dll memory boundary safety". |