AbstractSkel.h File Reference

#include <zeusbase/System/Thread.h>
#include <zeusbase/System/ZVariant.h>
#include <zeusbase/System/ByteArray.hpp>
#include <zeusbase/Net/ServerSocket.h>
#include <zeusbase/Remote/RemoteDefines.hpp>
#include <zeusbase/Remote/RemoteMethodCall.h>
#include <zeusbase/Remote/RemoteReference.h>
#include <zeusbase/Remote/Interfaces/IRemoteObject.hpp>

Go to the source code of this file.

Namespaces

namespace  zeus
namespace  zeus::TAbstractSkelObjectRelease

Classes

class  zeus::TAbstractSkel
class  zeus::TAbstractSkel::TClientHandlerThread

Defines

#define SKEL_DECL(classid, objectid)
#define SKEL_REMOTEREF(__param)   pRemote##__param
#define SKEL_DISPATCH_START(classid)
#define SKEL_DISP_SWITCH(__name)
#define SKEL_DISP_SWITCH_END   }
#define SKEL_READ_PARAM(__name, __param)
#define SKEL_READ_PARAM_REMOTEREF(__name, __param)
#define SKEL_REMOTEREF_CHECK(__param)   (SKEL_REMOTEREF(__param) != NULL)
#define SKEL_DISPATCH_END

Functions

template<class T>
void zeus::TAbstractSkelObjectRelease::releaseInstances (T &rObject)
template<class T>
void zeus::TAbstractSkelObjectRelease::releaseInstances (T *&rpObject)
template<>
void zeus::TAbstractSkelObjectRelease::releaseInstances (IRemoteObjectList &rObjectList)
template<>
void zeus::TAbstractSkelObjectRelease::releaseInstances (IStringList &)


Define Documentation

#define SKEL_DECL ( classid,
objectid   ) 

Value:

class classid : public TAbstractSkel \
{ \
  public : \
    classid(objectid& rInstance)\
     : TAbstractSkel(), \
       m_rInstance(rInstance)\
    { \
    } \
    \
  protected: \
    virtual ~classid() \
    { \
    } \
    virtual Retval dispatchCommand(const IRemoteMethodCall& rMethod, IRemoteMethodCall*& rMethodreturn); \
  \
  private: \
    objectid& m_rInstance; \
}; \
Declaration of the skeleton class. The skeleton class inherits the abstract skeleton
Parameters:
classid : ID of the class (Normally [Class]_Skel )
objectid : ID of the wrapped class (Servant)

#define SKEL_DISP_SWITCH ( __name   ) 

Value:

if (strMethodName == __name) \
  {
This selects the correct code for extracting the remote method call according to the name of the method. The name must be given as a string value.
Parameters:
__name : Name of the method (string)

#define SKEL_DISP_SWITCH_END   }

Ends a code of a specific method

#define SKEL_DISPATCH_END

Value:

while(lstParams.getCount() > 0) \
  { \
    lstParams[0]->release(); \
    lstParams.deleteItem(0); \
  } \
  rpMethodreturn = pReturnCall; \
  rpMethodreturn->setReturnValue(*pVarRetval); \
  pVarRetval->release(); \
  return retValue; \
}
Ends the dispatching method of the skeleton.

#define SKEL_DISPATCH_START ( classid   ) 

Value:

Retval classid::dispatchCommand(const IRemoteMethodCall& rMethod, IRemoteMethodCall*& rpMethodreturn) \
{ \
  Retval retValue = RET_NOERROR; \
  \
  TSingleLinkedList<IZUnknown*> lstParams; \
  TString strMethodName; \
  TRemoteMethodCall* pReturnCall = new TRemoteMethodCall(strMethodName); \
  TZVariant* pVarRetval = new TZVariant(); \
  rMethod.getMethodName(strMethodName); \
  RootLogger.printfln(LOGMODE_INFO, "Method received [%s]", strMethodName.c_str(NULL)); \
Starts the dispatching method of the skeleton class
Parameters:
classid : ID of the class

#define SKEL_READ_PARAM ( __name,
__param   ) 

Value:

TString strParam##__param = __name; \
    if (rMethod.getParameterByName(strParam##__param, __param) ==RET_NOERROR) \
    { \
      lstParams.add(__param); \
      RootLogger.printfln(LOGMODE_INFO, "Read param %s...ok",strParam##__param.c_str(NULL)); \
    } \
    else \
    { \
      RootLogger.printfln(LOGMODE_ERROR, "Read param %s...failed", strParam##__param.c_str(NULL)); \
      retValue = RET_REQUEST_FAILED; \
    } \
Reads a parameter out of the remote method call. This parameter is a variant type. The value inside must be extracted manually and given to the real method.
Parameters:
__name : Name of the parameter as string
__param : Parameter signature

    IZVariant* pVarString = NULL;
    SKEL_READ_PARAM("text", pVarString);
    if (pVarString != NULL)
    {
      pVarString->getString(&strText);
      retValue = m_pInstance->getText(&strText);
    }
    

#define SKEL_READ_PARAM_REMOTEREF ( __name,
__param   ) 

Value:

SKEL_READ_PARAM(__name, __param) \
    ISerializable* pSerial##__param = NULL; \
    IRemoteObject* SKEL_REMOTEREF(__param) = NULL; \
    if (__param != NULL && __param->getObject(pSerial##__param) == RET_NOERROR) \
    { \
      if (pSerial##__param->askForInterface(INTERFACE_IRemoteObject, ICAST(SKEL_REMOTEREF(__param))) == RET_NOERROR) \
      { \
        lstParams.add(SKEL_REMOTEREF(__param)); \
      } \
      else \
      { \
        RootLogger.printfln(LOGMODE_ERROR, "Failed. Object is not of type IRemoteObject"); \
        retValue = RET_REQUEST_FAILED; \
      } \
      pSerial##__param->release(); \
    } \
    else \
    { \
      RootLogger.printfln(LOGMODE_ERROR, "Failed. Object is NULL"); \
      retValue = RET_REQUEST_FAILED; \
    } \
This macro reads a remote refefence out of the remote method call. The use of this macro is the same as shown in SKEL_READ_PARAM
Parameters:
__name : Name of the parameter as string
__param : Parameter signature

#define SKEL_REMOTEREF ( __param   )     pRemote##__param

Generates the name of the remote reference parameter

Parameters:
__param : Parameter name of the method

#define SKEL_REMOTEREF_CHECK ( __param   )     (SKEL_REMOTEREF(__param) != NULL)

Helper macro. Dont use directly



Written by Benjamin Hadorn http://www.xatlantis.ch.
Last change made on Wed Oct 28 21:42:31 2009