Clay Library  1.0.1
All Classes Functions Variables Groups
Public Member Functions | Static Public Member Functions | List of all members
clay::core::ClayServiceAgent Class Reference

Service Agent Class. More...

#include <clay.h>

Public Member Functions

int RegSp (ClayServiceProvider *pServiceProvider)
 
int UnregSp (int iSpCode)
 
int UnregSp (const std::string &sSpName)
 
ClayServiceProviderGetSp (int iSpCode)
 
ClayServiceProviderGetSp (const std::string &sSpName)
 
int GetSpCount ()
 
int CallService (int iSpCode, int iSvcCode, void *pParam)
 
int CallService (int iSpCode, const std::string &sSvcName, void *pParam)
 
int CallService (const std::string &sSpName, int iSvcCode, void *pParam)
 
int CallService (const std::string &sSpName, const std::string &sSvcName, void *pParam)
 
bool SpExists (int iSpCode)
 
bool SpExists (const std::string &sSpName)
 
bool SvcExists (int iSpCode, int iSvcCode)
 
bool SvcExists (int iSpCode, const std::string &sSvcName)
 
bool SvcExists (const std::string &sSpName, int iSvcCode)
 
bool SvcExists (const std::string &sSpName, const std::string &sSvcName)
 
void Clear ()
 Remove all service providers.
 
void SetExternalAgent (ClayServiceAgent *pAgent)
 

Static Public Member Functions

static ClayServiceAgentGetAgent ()
 

Detailed Description

Service Agent Class.

Member Function Documentation

int clay::core::ClayServiceAgent::CallService ( int  iSpCode,
int  iSvcCode,
void *  pParam 
)

Execute the service function by the provider code and the service code

Parameters
iSpCodeThe provider code
iSvcCodeThe service code
pParamThe parameter passed to the service function
Returns
The return code of the service function
int clay::core::ClayServiceAgent::CallService ( int  iSpCode,
const std::string &  sSvcName,
void *  pParam 
)

Execute the service function by the provider code and the service name

Parameters
iSpCodeThe provider code
sSvcNameThe service name
pParamThe parameter passed to the service function
Returns
The return code of the service function
int clay::core::ClayServiceAgent::CallService ( const std::string &  sSpName,
int  iSvcCode,
void *  pParam 
)

Execute the service function by the provider name and the service code

Parameters
sSpNameThe provider name
iSvcCodeThe service code
pParamThe parameter passed to the service function
Returns
The return code of the service function
int clay::core::ClayServiceAgent::CallService ( const std::string &  sSpName,
const std::string &  sSvcName,
void *  pParam 
)

Execute the service function by the provider name and the service name

Parameters
sSpNameThe provider name
sSvcNameThe service name
pParamThe parameter passed to the service function
Returns
The return code of the service function
static ClayServiceAgent* clay::core::ClayServiceAgent::GetAgent ( )
inlinestatic

Get current active service agent

Returns
The pointer of current active agent
ClayServiceProvider* clay::core::ClayServiceAgent::GetSp ( int  iSpCode)

Get the service provider by its code

Parameters
iSpCodeThe code of the service provider
Returns
The pointer of the service provider
ClayServiceProvider* clay::core::ClayServiceAgent::GetSp ( const std::string &  sSpName)

Get the service provider by its name

Parameters
sSpNameThe name of the service provider
Returns
The pointer of the service provider
int clay::core::ClayServiceAgent::GetSpCount ( )

Get the count of the registered service providers

Returns
The total count of the service providers
int clay::core::ClayServiceAgent::RegSp ( ClayServiceProvider pServiceProvider)

Register a service provider

Parameters
pServiceProviderThe pointer of the service provider
Returns
Return -1 if fail
void clay::core::ClayServiceAgent::SetExternalAgent ( ClayServiceAgent pAgent)

Set external agent (normally it will be called only when integrating with external DLL file)

Parameters
pAgentThe pointer of another service agent object
bool clay::core::ClayServiceAgent::SpExists ( int  iSpCode)

Check the existence of the service provider by its code

Parameters
iSpCodeThe code of the service provider
Returns
Return true if the service provider with the code exists
bool clay::core::ClayServiceAgent::SpExists ( const std::string &  sSpName)

Check the existence of the service provider by its name

Parameters
sSpNameThe name of the service provider
Returns
Return true if the service provider with the name exists
bool clay::core::ClayServiceAgent::SvcExists ( int  iSpCode,
int  iSvcCode 
)

Check the existence of the service by provider code and service code

Parameters
iSpCodeThe provider code
iSvcCodeThe service code
Returns
Return true if the service exists
bool clay::core::ClayServiceAgent::SvcExists ( int  iSpCode,
const std::string &  sSvcName 
)

Check the existence of the service by provider code and service name

Parameters
iSpCodeThe provider code
sSvcNameThe service name
Returns
Return true if the service exists
bool clay::core::ClayServiceAgent::SvcExists ( const std::string &  sSpName,
int  iSvcCode 
)

Check the existence of the service by provider name and service code

Parameters
sSpNameThe provider name
iSvcCodeThe service code
Returns
Return true if the service exists
bool clay::core::ClayServiceAgent::SvcExists ( const std::string &  sSpName,
const std::string &  sSvcName 
)

Check the existence of the service by provider name and service name

Parameters
sSpNameThe provider name
sSvcNameThe service name
Returns
Return true if the service exists
int clay::core::ClayServiceAgent::UnregSp ( int  iSpCode)

Unregister a service provider by its code

Parameters
iSpCodeThe code of the service provider
Returns
If the service provider is not found then return 0
int clay::core::ClayServiceAgent::UnregSp ( const std::string &  sSpName)

Unregister a service provider by its name

Parameters
sSpNameThe name of the service provider
Returns
If the service provider is not found then return 0

The documentation for this class was generated from the following file: