ecpp.h File Reference
#include <tnt/component.h>
#include <tnt/scope.h>
#include <tnt/sessionscope.h>
#include <tnt/httprequest.h>
#include <tnt/http.h>
#include <map>
#include <set>

Go to the source code of this file.

Classes

struct  tnt::Subcompident
class  tnt::EcppComponent
class  tnt::EcppSubComponent

Namespaces

namespace  tnt
 in tntnet (mainthread): Jobqueue queue; void mainloop() { while (1) { Jobqueue::JobPtr j = new Tcpjob(); j->accept(poller.get()); queue.put(j); } }

Macros

#define TNT_VAR(scope, type, varname, key, construct)
#define TNT_SESSION_COMPONENT_VAR(type, varname, key, construct)   TNT_VAR(request.getSessionScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SESSION_PAGE_VAR(type, varname, key, construct)   TNT_VAR(request.getSessionScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SESSION_GLOBAL_VAR(type, varname, key, construct)   TNT_VAR(request.getSessionScope(), type, varname, key, construct)
#define TNT_SECURE_SESSION_COMPONENT_VAR(type, varname, key, construct)   TNT_VAR(request.getSecureSessionScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SECURE_SESSION_PAGE_VAR(type, varname, key, construct)   TNT_VAR(request.getSecureSessionScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SECURE_SESSION_GLOBAL_VAR(type, varname, key, construct)   TNT_VAR(request.getSecureSessionScope(), type, varname, key, construct)
#define TNT_APPLICATION_COMPONENT_VAR(type, varname, key, construct)   TNT_VAR(request.getApplicationScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_APPLICATION_PAGE_VAR(type, varname, key, construct)   TNT_VAR(request.getApplicationScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_APPLICATION_GLOBAL_VAR(type, varname, key, construct)   TNT_VAR(request.getApplicationScope(), type, varname, key, construct)
#define TNT_THREAD_COMPONENT_VAR(type, varname, key, construct)   TNT_VAR(request.getThreadScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_THREAD_PAGE_VAR(type, varname, key, construct)   TNT_VAR(request.getThreadScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_THREAD_GLOBAL_VAR(type, varname, key, construct)   TNT_VAR(request.getThreadScope(), type, varname, key, construct)
#define TNT_REQUEST_COMPONENT_VAR(type, varname, key, construct)   TNT_VAR(request.getRequestScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_REQUEST_PAGE_VAR(type, varname, key, construct)   TNT_VAR(request.getRequestScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_REQUEST_GLOBAL_VAR(type, varname, key, construct)   TNT_VAR(request.getRequestScope(), type, varname, key, construct)
#define TNT_PARAM(type, varname, key, construct)   TNT_VAR(qparam.getScope(), type, varname, key, construct)

Functions

std::string tnt::getPageScopePrefix (const Compident &id)
template<typename compident_type >
std::string tnt::getComponentScopePrefix (const compident_type &id)
unsigned tnt::controllerCaller (void *, tnt::HttpRequest &, tnt::HttpReply &, tnt::QueryParams &)
unsigned tnt::controllerCaller (tnt::Component *component, tnt::HttpRequest &request, tnt::HttpReply &reply, tnt::QueryParams &qparams)

Macro Definition Documentation

#define TNT_APPLICATION_COMPONENT_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getApplicationScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_APPLICATION_GLOBAL_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getApplicationScope(), type, varname, key, construct)
#define TNT_APPLICATION_PAGE_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getApplicationScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_PARAM (   type,
  varname,
  key,
  construct 
)    TNT_VAR(qparam.getScope(), type, varname, key, construct)
#define TNT_REQUEST_COMPONENT_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getRequestScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_REQUEST_GLOBAL_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getRequestScope(), type, varname, key, construct)
#define TNT_REQUEST_PAGE_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getRequestScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SECURE_SESSION_COMPONENT_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getSecureSessionScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SECURE_SESSION_GLOBAL_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getSecureSessionScope(), type, varname, key, construct)
#define TNT_SECURE_SESSION_PAGE_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getSecureSessionScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SESSION_COMPONENT_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getSessionScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_SESSION_GLOBAL_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getSessionScope(), type, varname, key, construct)
#define TNT_SESSION_PAGE_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getSessionScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_THREAD_COMPONENT_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getThreadScope(), type, varname, getComponentScopePrefix(getCompident()) + ":" key, construct)
#define TNT_THREAD_GLOBAL_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getThreadScope(), type, varname, key, construct)
#define TNT_THREAD_PAGE_VAR (   type,
  varname,
  key,
  construct 
)    TNT_VAR(request.getThreadScope(), type, varname, getPageScopePrefix(getCompident()) + ":" key, construct)
#define TNT_VAR (   scope,
  type,
  varname,
  key,
  construct 
)
Value:
type* varname##_pointer; \
{ \
const std::string varname##_scopekey = key; \
tnt::Scope& _scope = scope; \
varname##_pointer = _scope.get< type >(varname##_scopekey); \
if ( ! varname##_pointer ) \
_scope.put< type >(varname##_scopekey, \
varname##_pointer = new type construct); \
} \
type& varname = *varname##_pointer; \
{ \
unsigned r = tnt::controllerCaller(varname##_pointer, request, reply, qparam); \
if (r != DECLINED && r != HTTP_OK) \
return r; \
}