/*
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 *
 */


// This file automatically generated by:
//   Apache Etch 1.1.0-incubating (LOCAL-0) / c 1.1.0-incubating (LOCAL-0)
//   Fri Aug 28 15:58:20 CEST 2009
// This file is automatically created and should not be edited!

/*
 * helloworld_client_implx.c 
 * $helper.getImplName functions which would ordinarily not be subject to edit.
 */

#include "helloworld_client_impl.h"
#include "helloworld_remote_server.h"
#include "etch_objecttypes.h"
#include "etch_general.h"
#include "etch_url.h"

int destroy_helloworld_client_impl(void*);

/* - - - - - - - - - - - - - - - - - - - - - - - -   
 *helloworld_client_impl private construction / destruction 
 * - - - - - - - - - - - - - - - - - - - - - - - -    
 */

/**
 * init_helloworld_client_impl()
 * called by helloworld_client_impl constructor to instantiate server implementation 
 * object and initialize with default virtuals.
 * @param client the remote client, not owned.
 * @param usermem_dtor destructor for any custom memory allocations.
 */
helloworld_client_impl* init_helloworld_client_impl(helloworld_remote_server* server, 
    etch_object_destructor usermem_dtor)
{
	helloworld_client_impl* pclient = (helloworld_client_impl*) new_object (sizeof(helloworld_client_impl), 
        ETCHTYPEB_EXECLIENTIMPL, get_dynamic_classid_unique(&CLASSID_HELLOWORLD_CLIENT_IMPL));  
		
    pclient->server  = server;  /* not owned */
    ((etch_object*)pclient)->destroy = destroy_helloworld_client_impl;  /* private destructor */
    pclient->destroyex = usermem_dtor;  /* user memory destructor */

    /* instantiate base and copy virtuals, if any, to this object */
    pclient->helloworld_client_base = new_helloworld_client_base(pclient); /* owned */

    pclient->ihelloworld = pclient->helloworld_client_base->ihelloworld;

    pclient->iobjsession = server->server_base->iobjsession;
    pclient->iobjsession->thisx = pclient;  /* set implementor reference */
    pclient->_session_control = pclient->helloworld_client_base->_session_control;
    pclient->_session_notify  = pclient->helloworld_client_base->_session_notify;
    pclient->_session_query   = pclient->helloworld_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_helloworld_client_impl (void* data)
{
    helloworld_client_impl* thisx = (helloworld_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);
}
