
// This file automatically generated by:
//   Apache Etch 1.2.0-incubating (LOCAL-0) / c 1.2.0-incubating (LOCAL-0)
//   Mon Mar 28 14:18:57 CEST 2011
// This file is automatically created and should not be edited!

/*
 * example_client_implx.c 
 * $helper.getImplName functions which would ordinarily not be subject to edit.
 */

#include "example_client_impl.h"
#include "example_remote_server.h"
#include "etch_objecttypes.h"
#include "etch_general.h"
#include "etch_url.h"

int destroy_example_client_impl(void*);

/* - - - - - - - - - - - - - - - - - - - - - - - -   
 *example_client_impl private construction / destruction 
 * - - - - - - - - - - - - - - - - - - - - - - - -    
 */

/**
 * init_example_client_impl()
 * called by example_client_impl constructor to instantiate server implementation object
 * @param client the remote client, not owned.
 * @param usermem_dtor destructor for any custom memory allocations.
 */
example_client_impl* init_example_client_impl(example_remote_server* server, 
    etch_object_destructor usermem_dtor)
{
	example_client_impl* pclient = (example_client_impl*) new_object (sizeof(example_client_impl), 
        ETCHTYPEB_EXECLIENTIMPL, get_dynamic_classid_unique(&CLASSID_EXAMPLE_CLIENT_IMPL));  
		
    pclient->server  = server;  /* not owned */
    ((etch_object*)pclient)->destroy = destroy_example_client_impl;  /* private destructor */
    pclient->destroyex = usermem_dtor;  /* user memory destructor */

    /* instantiate base */
    pclient->example_client_base = new_example_client_base(pclient); /* owned */

    pclient->iexample = pclient->example_client_base->iexample;

    pclient->iobjsession = server->server_base->iobjsession;
    pclient->iobjsession->thisx = pclient;  /* set implementor reference */
    pclient->_session_control = pclient->example_client_base->_session_control;
    pclient->_session_notify  = pclient->example_client_base->_session_notify;
    pclient->_session_query   = pclient->example_client_base->_session_query;

    return pclient;
}

/**
 * destroy_perf_server_impl()
 * perf_server_impl private destructor.
 * calls back to user destructor to effect cleanup of any perf_server_impl 
 * memory which may have been allocated in custom code added by user.
 */
int destroy_example_client_impl (void* data)
{
    example_client_impl* thisx = (example_client_impl*)data;
    if (NULL == thisx) return -1;  

    if (!is_etchobj_static_content(thisx))
    {    
        if(thisx->destroyex)
        {   /* call back to user memory destructor */
            thisx->destroyex(thisx);
        }
    }
            
    return destroy_objectex((etch_object*)thisx);
}
