server_side.h

Go to the documentation of this file.
00001 #ifndef RPC_SERVER_TEST_SUPPORT_CLASS_GROUP
00002 #define RPC_SERVER_TEST_SUPPORT_CLASS_GROUP
00003 
00004 /*****************************************************************************\
00005 *                                                                             *
00006 *  Name   : server side                                                       *
00007 *  Author : Chris Koeritz                                                     *
00008 *                                                                             *
00009 *  Purpose:                                                                   *
00010 *                                                                             *
00011 *     The server side of this example has a list of points that have been     *
00012 *     selected by the user.  This list can be added to by clicking on the     *
00013 *     server window or by clicking on any of the active client windows.       *
00014 *                                                                             *
00015 *******************************************************************************
00016 * Copyright (c) 1995-$now By Author.  This program is free software; you can  *
00017 * redistribute it and/or modify it under the terms of the GNU General Public  *
00018 * License as published by the Free Software Foundation; either version 2 of   *
00019 * the License or (at your option) any later version.  This is online at:      *
00020 *     http://www.fsf.org/copyleft/gpl.html                                    *
00021 * Please send any updates to: fred@gruntose.com                               *
00022 \*****************************************************************************/
00023 
00024 #include "shared_code.h"
00025 
00026 #include <ng_rpc_server/ng_request_interface.h>
00027 #include <ng_rpc_server/ng_rpc_server.h>
00028 
00029 class example_rpc_server : public ng_rpc_server, public mouserciser
00030 {
00031 public:
00032   example_rpc_server(CFrameWnd *parent, window_handle alert = NIL);
00033   virtual ~example_rpc_server();
00034 
00036 
00037   IMPLEMENT_CLASS_NAME("example_rpc_server");
00038 
00040 
00041   void process_client_request(const char *transaction_name,
00042           const rpc_data_block &request, rpc_data_block &response);
00043     // examines and processes a "request" (under the "transaction_name" service)
00044     // from the client and generates a "response" to send back.
00045 
00046   window_handle alert;  // public because this is just a test.  otherwise not.
00047 
00048 private:
00049   drawing_window *mouser;  // my visible list of points.
00050 public: // for instantiation only.
00051   struct client_record {
00052     window_handle window;
00053   };
00054 private:
00055   array<client_record> client_list;  // the list of registered clients.
00056 
00057   virtual void mouse_hit(const rpc_point &position);
00058     // sends the point as an update for the client's advise loop.
00059 
00060   virtual void update();
00061     // sends out all new points to the clients.
00062 
00063   byte_array register_client(const byte_array &data);
00064     // adds a new client to the list.
00065   byte_array unregister_client(const byte_array &data);
00066     // zaps a client out of the list.
00067   byte_array add_point(const byte_array &data);
00068     // puts a new point into the list and causes an update.
00069   byte_array get_entire_list(const byte_array &data);
00070     // returns the entire list.
00071   byte_array get_partial_list(const byte_array &data);
00072     // returns part of the list.
00073 
00075     // the thread that accepts clients.
00076 };
00077 
00078 #endif
00079 

Generated on Fri Nov 28 04:29:33 2008 for HOOPLE Libraries by  doxygen 1.5.1