The Engines Bank class is responsible for loading the scripts engines from their libraries, and passing them to the CdcConnectionThread object so it can execute scripts on the buffer that is going back to the client. More...
#include <DcEnginesBank.h>
Public Member Functions | |
CdcEnginesBank (IdcRequest *preq, IdcResponse *pres, CdcUserStatus *pstatus) | |
Constructor, initialize an EnginesBank object with pointers to the current Request, Response and AdaptersSet objects. | |
~CdcEnginesBank () | |
Destructor, stores or releases every engine this object loaded. | |
IdcEngine * | GetEngine (const CdcString &name) |
This function will look for a loaded engine from the type 'name' in the engines map. | |
void | DeleteEngine (const CdcString &name) |
This function will delete an loaded engine (if it exists). | |
Static Public Member Functions | |
static void | Init () |
Just set the default engine name. | |
static void | Term () |
Static function to terminate engines. |
The Engines Bank class is responsible for loading the scripts engines from their libraries, and passing them to the CdcConnectionThread object so it can execute scripts on the buffer that is going back to the client.
This class loads an engine library on the first request for this engine. Then it initializes the engine, and stores the loaded library. The library will stay loaded until Beesnest exits. EngineBank can store engines in the user EnginesSet object (if the user is logged in so he has an Engine Set). When CdcConnectionThread asks for an engine the class first looks if an engine from this type (engine name) is in the user Engines Set. If not, it creates the engine from it's library, and passes it down. For the same page though, EnginesBank will store the engines it creates, so the engine can process different sections of scripts under the same environment. But, as mentioned, if the user is logged in, Engine Bank can store an engine over multiple pages. That means a programmer can create a script that will start to run in one page, and continue on another one (with all the data still in place).
This class built in a very smiler way to CdcAdaptersBank. Both works on the exact same principle, But here, unlike in the Adapters Bank, the EnginesSet is a server for this class.
This class is thread safe.
Definition at line 62 of file DcEnginesBank.h.
CdcEnginesBank::CdcEnginesBank | ( | IdcRequest * | preq, |
IdcResponse * | pres, | ||
CdcUserStatus * | pstatus | ||
) |
Constructor, initialize an EnginesBank object with pointers to the current Request, Response and AdaptersSet objects.
This class does nothing with these objects apart of passing them to every engine it loads. Note: pstatus will be NULL if the user is not logged in!
Definition at line 42 of file DcEnginesBank.cpp.
CdcEnginesBank::~CdcEnginesBank | ( | ) |
Destructor, stores or releases every engine this object loaded.
Definition at line 53 of file DcEnginesBank.cpp.
void CdcEnginesBank::DeleteEngine | ( | const CdcString & | name ) |
This function will delete an loaded engine (if it exists).
I use this function to prevent the class from storing a "Storable" engine in the Engines Set. Beesnest will call this function if the script ends with "[delete]%>"
name | The name of the engine to delete. An empty string will delete the default engine. |
Definition at line 116 of file DcEnginesBank.cpp.
This function will look for a loaded engine from the type 'name' in the engines map.
If it founds one, it returns it's pointer, if not it loads the engine from it's library, puts it in the map, and returns the pointer.
name | The name of the engine to load. An empty string will load the default engine. |
Definition at line 74 of file DcEnginesBank.cpp.
void CdcEnginesBank::Init | ( | ) | [static] |
Just set the default engine name.
Getting it from the configuration file.
Definition at line 178 of file DcEnginesBank.cpp.
void CdcEnginesBank::Term | ( | ) | [static] |
Static function to terminate engines.
Every engine library may have a termination function, this function will call it.
Definition at line 183 of file DcEnginesBank.cpp.