Go to the documentation of this file.00001
00002
00003
00004 #ifndef __CDC_DAYNAMIC_HTML
00005 #define __CDC_DAYNAMIC_HTML
00006
00007 #include <Python.h>
00008
00009 #include "../../Interfaces/DcEngine.h"
00010
00011 #include <iostream>
00012 #include <map>
00013 #include <set>
00014 using namespace std;
00015
00016 #include <time.h>
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 class BnPython : public IdcEngine
00032 {
00033 private:
00034
00035 IdcResponse* pRes;
00036
00037
00038 IdcRequest* pReq;
00039
00040
00041 IdcAdaptersSet* pSet;
00042
00043
00044 set<unsigned int> oAdaptersList;
00045
00046
00047
00048 bool (*pfGetParam)(const char*, char*, int);
00049
00050
00051 string sName;
00052
00053
00054 PyThreadState* oTS;
00055
00056
00057 string sBuffer;
00058
00059
00060 int nPointerCell;
00061
00062
00063 int nSizeLimit;
00064
00065
00066 int nException;
00067
00068
00069 bool bExit;
00070
00071
00072
00073 static int counter;
00074
00075
00076 static map<int, BnPython*> mPointers;
00077
00078
00079
00080 static BnPython* GetPointer (int num);
00081
00082
00083 void ReleaseAdapters ();
00084
00085
00086 bool CheckSizeLimit ();
00087
00088 public:
00089
00090
00091
00092
00093
00094 BnPython (const char* name, bool (*pGetParam)(const char*, char*, int));
00095
00096
00097
00098
00099 virtual ~BnPython ();
00100
00101
00102
00103
00104 virtual bool Process (BufferHolder code, BufferHolder& result, int size_limit);
00105
00106
00107
00108
00109
00110 virtual void Prepare (IdcRequest* preq, IdcResponse* pres, IdcAdaptersSet* pset);
00111
00112
00113
00114
00115 virtual bool IsStorable () { return nException == 0; }
00116
00117
00118
00119
00120
00121 virtual void Stored ();
00122
00123
00124
00125
00126 friend PyObject* Print (PyObject *self, PyObject *args);
00127 friend PyObject* GetRequestHeader (PyObject *self, PyObject *args);
00128 friend PyObject* GetRequestVariable (PyObject *self, PyObject *args);
00129 friend PyObject* SetRequestVariable (PyObject *self, PyObject *args);
00130 friend PyObject* GetRequestVarsNamesList (PyObject *self, PyObject *args);
00131 friend PyObject* SetResponseHeader (PyObject *self, PyObject *args);
00132 friend PyObject* SetResponseCookie (PyObject *self, PyObject *args);
00133 friend PyObject* Clear (PyObject *self, PyObject *args);
00134 friend PyObject* Flush (PyObject *self, PyObject *args);
00135 friend PyObject* GetAdapter (PyObject *self, PyObject *args);
00136 friend PyObject* ReleaseAdapter (PyObject *self, PyObject *args);
00137 friend PyObject* Read (PyObject *self, PyObject *args);
00138 friend PyObject* Write (PyObject *self, PyObject *args);
00139 friend PyObject* Exit (PyObject *self, PyObject *args);
00140 };
00141
00142 #endif
00143